[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Tue Mar 13 11:58:28 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/91f9422fc6f8
changeset: 431:91f9422fc6f8
user:      ray at terran.dlink.ua
date:      Tue Mar 13 13:59:17 2012 +0200
description:
Change printf("%s" ..., device_get_nameunit, ...) to device_printf.

diffstat:

 head/sys/dev/ral/rt2860.c |  289 ++++++++++++++++++++++-----------------------
 1 files changed, 144 insertions(+), 145 deletions(-)

diffs (748 lines):

diff -r f799a5e7eb16 -r 91f9422fc6f8 head/sys/dev/ral/rt2860.c
--- a/head/sys/dev/ral/rt2860.c	Tue Mar 13 12:58:39 2012 +0200
+++ b/head/sys/dev/ral/rt2860.c	Tue Mar 13 13:59:17 2012 +0200
@@ -671,17 +671,15 @@
 	}
 
 	if (ntries == 100) {
-		printf("%s: timeout waiting for NIC to initialize\n",
-			device_get_nameunit(dev));
+		device_printf(dev, "timeout waiting for NIC to initialize\n");
 		error = EIO;
 		goto fail;
 	}
 
 	rt2860_read_eeprom(sc);
 
-	printf("%s: MAC/BBP RT2860 (rev 0x%08x), RF %s\n",
-	    device_get_nameunit(sc->sc_dev), sc->mac_rev,
-		rt2860_rf_name(sc->rf_rev));
+	device_printf(sc->sc_dev, "MAC/BBP RT2860 (rev 0x%08x), RF %s\n",
+	    sc->mac_rev,rt2860_rf_name(sc->rf_rev));
 
 	RT2860_SOFTC_LOCK(sc);
 	/* clear key tables */
@@ -692,8 +690,8 @@
 	for (i = 0; i < RT2860_SOFTC_TX_RING_COUNT; i++) {
 		error = rt2860_alloc_tx_ring(sc, &sc->tx_ring[i], i);
 		if (error != 0) {
-			printf("%s: could not allocate Tx ring #%d\n",
-				device_get_nameunit(sc->sc_dev), i);
+			device_printf(sc->sc_dev, "could not allocate Tx "
+			    "ring #%d\n", i);
 			goto fail;
 		}
 	}
@@ -702,8 +700,7 @@
 
 	error = rt2860_alloc_rx_ring(sc, &sc->rx_ring);
 	if (error != 0) {
-		printf("%s: could not allocate Rx ring\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "could not allocate Rx ring\n");
 		goto fail;
 	}
 
@@ -712,8 +709,7 @@
 
 	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
-		printf("%s: could not if_alloc()\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "could not if_alloc()\n");
 		error = ENOMEM;
 		goto fail;
 	}
@@ -1150,8 +1146,8 @@
 			cent = ieee80211_find_channel_byieee(ic, i,
 				flags & ~IEEE80211_CHAN_HT);
 			if (cent == NULL) {
-				printf("%s: skip channel %d, could not find center channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find center channel\n", i);
 				continue;
 			}
 
@@ -1160,8 +1156,8 @@
 			ext = ieee80211_find_channel(ic, cent->ic_freq + 20,
 				flags & ~IEEE80211_CHAN_HT);
 			if (ext == NULL) {
-				printf("%s: skip channel %d, could not find extension channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find extension channel\n", i);
 				continue;
 			}
 
@@ -1187,8 +1183,8 @@
 			cent = ieee80211_find_channel_byieee(ic, i,
 				flags & ~IEEE80211_CHAN_HT);
 			if (cent == NULL) {
-				printf("%s: skip channel %d, could not find center channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find center channel\n", i);
 				continue;
 			}
 
@@ -1196,8 +1192,8 @@
 			ext = ieee80211_find_channel(ic, cent->ic_freq + 20,
 				flags & ~IEEE80211_CHAN_HT);
 			if (ext == NULL) {
-				printf("%s: skip channel %d, could not find extension channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find extension channel\n", i);
 				continue;
 			}
 
@@ -1224,8 +1220,8 @@
 			cent = ieee80211_find_channel_byieee(ic, i,
 				flags & ~IEEE80211_CHAN_HT);
 			if (cent == NULL) {
-				printf("%s: skip channel %d, could not find center channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find center channel\n", i);
 				continue;
 			}
 
@@ -1234,8 +1230,8 @@
 			ext = ieee80211_find_channel(ic, cent->ic_freq + 20,
 				flags & ~IEEE80211_CHAN_HT);
 			if (ext == NULL) {
-				printf("%s: skip channel %d, could not find extension channel\n",
-					device_get_nameunit(sc->sc_dev), i);
+				device_printf(sc->sc_dev, "skip channel %d, "
+				    "could not find extension channel\n", i);
 				continue;
 			}
 
@@ -1285,8 +1281,8 @@
 
 		error = rt2860_io_mcu_load_ucode(sc, rt2860_ucode, sizeof(rt2860_ucode));
 		if (error != 0) {
-			printf("%s: could not load 8051 microcode\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "could not load 8051 microcode\n");
 			goto fail;
 		}
 
@@ -1339,8 +1335,7 @@
 	}
 
 	if (ntries == 100) {
-		printf("%s: timeout waiting for DMA engine\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "timeout waiting for DMA engine\n");
 		goto fail;
 	}
 
@@ -1397,8 +1392,7 @@
 	}
 
 	if (ntries == 100) {
-		printf("%s: timeout waiting for MAC\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "timeout waiting for MAC\n");
 		goto fail;
 	}
 	
@@ -1506,8 +1500,7 @@
 	}
 
 	if (ntries == 100) {
-		printf("%s: timeout waiting for DMA engine\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "timeout waiting for DMA engine\n");
 		goto fail;
 	}
 
@@ -1692,8 +1685,8 @@
 	}
 
 	if (tmp == 0x00 || tmp == 0xff) {
-		printf("%s: timeout waiting for BBP to wakeup\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "timeout waiting for BBP to wakeup\n");
 		return ETIMEDOUT;
 	}
 
@@ -3171,8 +3164,8 @@
 	tid = WME_AC_TO_TID(tap->txa_ac);
 
 	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+	    "%s: stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
 
 	if (tap->txa_flags & IEEE80211_AGGR_RUNNING) {
 		if (sc->tx_ampdu_sessions > 0) {
@@ -3184,8 +3177,8 @@
 				RT2860_SOFTC_UNLOCK(sc);
 			}
 		} else {
-			printf("%s: number of A-MPDU Tx sessions cannot be negative\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "number of A-MPDU Tx sessions cannot be negative\n");
 		}
 	}
 
@@ -3246,8 +3239,8 @@
 		if (sc->rx_ampdu_sessions > 0)
 			sc->rx_ampdu_sessions--;
 		else
-			printf("%s: number of A-MPDU Rx sessions cannot be negative\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev, "number of A-MPDU Rx "
+			    "sessions cannot be negative\n");
 	}
 
 	sc->ampdu_rx_stop(ni, rap);
@@ -3395,8 +3388,7 @@
 		return;
 
 	if (--sc->tx_timer == 0) {
-		printf("%s: Tx watchdog timeout: resetting\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "Tx watchdog timeout: resetting\n");
 
 		rt2860_stop_locked(sc);
 		rt2860_init_locked(sc);
@@ -3739,9 +3731,8 @@
 
 	ifp = sc->sc_ifp;
 
-	printf("%s: %s promiscuous mode\n",
-		device_get_nameunit(sc->sc_dev),
-		(ifp->if_flags & IFF_PROMISC) ? "entering" : "leaving");
+	device_printf(sc->sc_dev, "%s promiscuous mode\n",
+	    (ifp->if_flags & IFF_PROMISC) ? "entering" : "leaving");
 
 	tmp = rt2860_io_mac_read(sc, RT2860_REG_RX_FILTER_CFG);
 
@@ -4530,8 +4521,9 @@
 		error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag, data->dma_map, m,
 	    	dma_seg, &ndmasegs, BUS_DMA_NOWAIT);
 		if (error != 0) {
-			printf("%s: could not load mbuf DMA map: ndmasegs=%d, len=%d, error=%d\n",
-				device_get_nameunit(sc->sc_dev), ndmasegs, m->m_pkthdr.len, error);
+			device_printf(sc->sc_dev, "could not load mbuf DMA "
+			    "map: ndmasegs=%d, len=%d, error=%d\n",
+			    ndmasegs, m->m_pkthdr.len, error);
 			m_freem(m);
 			return error;
 		}
@@ -4897,8 +4889,10 @@
 		/* too many fragments, linearize */
 
 		RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-			"%s: could not load mbuf DMA map, trying to linearize mbuf: ndmasegs=%d, len=%d, error=%d\n",
-			device_get_nameunit(sc->sc_dev), ndmasegs, m->m_pkthdr.len, error);
+		    "%s: could not load mbuf DMA map, trying to linearize "
+		    "mbuf: ndmasegs=%d, len=%d, error=%d\n",
+		    device_get_nameunit(sc->sc_dev), ndmasegs,
+		    m->m_pkthdr.len, error);
 
 		m = m_defrag(m, M_DONTWAIT);
 		if (m == NULL)
@@ -4906,12 +4900,13 @@
 
 		sc->tx_defrag_packets++;
 
-		error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag, data->dma_map, m,
-	    	dma_seg, &ndmasegs, BUS_DMA_NOWAIT);
+		error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag,
+		    data->dma_map, m, dma_seg, &ndmasegs, BUS_DMA_NOWAIT);
 		if (error != 0)
 		{
-			printf("%s: could not load mbuf DMA map: ndmasegs=%d, len=%d, error=%d\n",
-				device_get_nameunit(sc->sc_dev), ndmasegs, m->m_pkthdr.len, error);
+			device_printf(sc->sc_dev, "could not load mbuf DMA "
+			    "map: ndmasegs=%d, len=%d, error=%d\n",
+			    ndmasegs, m->m_pkthdr.len, error);
 			m_freem(m);
 			return error;
 		}
@@ -6310,8 +6305,7 @@
 
 	if (ntries == 200)
 	{
-		printf("%s: timeout waiting for DMA engine\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "timeout waiting for DMA engine\n");
 		return -1;
 	}
 
@@ -6367,15 +6361,15 @@
 	bus_dma_segment_t segs[1];
 	int i, nsegs, error;
 
-	error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0, 
-		BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-		RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc), 1,
-		RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
-		0, NULL, NULL, &ring->desc_dma_tag);
+	error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc), 1,
+	    RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
+	    0, NULL, NULL, &ring->desc_dma_tag);
 	if (error != 0)
 	{
-		printf("%s: could not create Rx desc DMA tag\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "could not create Rx desc DMA tag\n");
 		goto fail;
 	}
 
@@ -6383,30 +6377,30 @@
 	    BUS_DMA_NOWAIT | BUS_DMA_ZERO, &ring->desc_dma_map);
 	if (error != 0)
 	{
-		printf("%s: could not allocate Rx desc DMA memory\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "could not allocate Rx desc DMA memory\n");
 		goto fail;
 	}
 
 	error = bus_dmamap_load(ring->desc_dma_tag, ring->desc_dma_map,
-		ring->desc,
-		RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
-		rt2860_dma_map_addr, &ring->desc_phys_addr, 0);
+	    ring->desc,
+	    RT2860_SOFTC_RX_RING_DATA_COUNT * sizeof(struct rt2860_rxdesc),
+	    rt2860_dma_map_addr, &ring->desc_phys_addr, 0);
 	if (error != 0)
 	{
-		printf("%s: could not load Rx desc DMA map\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "could not load Rx desc DMA map\n");
 		goto fail;
 	}
 
 	error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), PAGE_SIZE, 0, 
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-		MJUMPAGESIZE, 1, MJUMPAGESIZE, 0, NULL, NULL,
-		&ring->data_dma_tag);
+	    MJUMPAGESIZE, 1, MJUMPAGESIZE, 0, NULL, NULL,
+	    &ring->data_dma_tag);
 	if (error != 0)
 	{
-		printf("%s: could not create Rx data DMA tag\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "could not create Rx data DMA tag\n");
 		goto fail;
 	}
 
@@ -6415,31 +6409,33 @@
 		desc = &ring->desc[i];
 		data = &ring->data[i];
 
-		error = bus_dmamap_create(ring->data_dma_tag, 0, &data->dma_map);
+		error = bus_dmamap_create(ring->data_dma_tag, 0,
+		    &data->dma_map);
 		if (error != 0)
 		{
-			printf("%s: could not create Rx data DMA map\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "could not create Rx data DMA map\n");
 			goto fail;
 		}
 
-		data->m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUMPAGESIZE);
+		data->m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR,
+		    MJUMPAGESIZE);
 		if (data->m == NULL)
 		{
-			printf("%s: could not allocate Rx mbuf\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "could not allocate Rx mbuf\n");
 			error = ENOMEM;
 			goto fail;
 		}
 
 		data->m->m_len = data->m->m_pkthdr.len = MJUMPAGESIZE;
 
-		error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag, data->dma_map,
-			data->m, segs, &nsegs, BUS_DMA_NOWAIT);
+		error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag,
+		    data->dma_map, data->m, segs, &nsegs, BUS_DMA_NOWAIT);
 		if (error != 0)
 		{
-			printf("%s: could not load Rx mbuf DMA map\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "could not load Rx mbuf DMA map\n");
 			goto fail;
 		}
 
@@ -6450,11 +6446,12 @@
 		desc->sdl0 = htole16(MJUMPAGESIZE);
 	}
 
-	error = bus_dmamap_create(ring->data_dma_tag, 0, &ring->spare_dma_map);
+	error = bus_dmamap_create(ring->data_dma_tag, 0,
+	    &ring->spare_dma_map);
 	if (error != 0)
 	{
-		printf("%s: could not create Rx spare DMA map\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev,
+		    "could not create Rx spare DMA map\n");
 		goto fail;
 	}
 
@@ -6548,7 +6545,8 @@
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    size, 1, size, 0, NULL, NULL, &ring->desc_dma_tag);
 	if (error != 0) {
-		device_printf(sc->sc_dev, "could not create Tx desc DMA tag\n");
+		device_printf(sc->sc_dev,
+		    "could not create Tx desc DMA tag\n");
 		goto fail;
 	}
 
@@ -6576,14 +6574,16 @@
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    size, 1, size, 0, NULL, NULL, &ring->seg0_dma_tag);
 	if (error != 0) {
-		device_printf(sc->sc_dev, "could not create Tx seg0 DMA tag\n");
+		device_printf(sc->sc_dev,
+		    "could not create Tx seg0 DMA tag\n");
 		goto fail;
 	}
 
 	error = bus_dmamem_alloc(ring->seg0_dma_tag, (void **) &ring->seg0,
 	    BUS_DMA_NOWAIT | BUS_DMA_ZERO, &ring->seg0_dma_map);
 	if (error != 0) {
-		device_printf(sc->sc_dev, "could not allocate Tx seg0 DMA memory\n");
+		device_printf(sc->sc_dev,
+		    "could not allocate Tx seg0 DMA memory\n");
 		goto fail;
 	}
 
@@ -6600,7 +6600,8 @@
 	    MJUMPAGESIZE, RT2860_SOFTC_MAX_SCATTER, MJUMPAGESIZE, 0,
 	    NULL, NULL, &ring->data_dma_tag);
 	if (error != 0) {
-		device_printf(sc->sc_dev, "could not create Tx data DMA tag\n");
+		device_printf(sc->sc_dev,
+		    "could not create Tx data DMA tag\n");
 		goto fail;
 	}
 
@@ -6610,7 +6611,8 @@
 		error = bus_dmamap_create(ring->data_dma_tag, 0,
 		    &data->dma_map);
 		if (error != 0) {
-			device_printf(sc->sc_dev, "could not create Tx data DMA map\n");
+			device_printf(sc->sc_dev,
+			    "could not create Tx data DMA map\n");
 			goto fail;
 		}
 	}
@@ -7567,8 +7569,7 @@
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: BBP busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			printf("%s:%s: BBP busy after 100 probes\n",device_get_nameunit(sc->sc_dev), __func__);
 			return (0);
 		}
 		rt2860_io_mac_write(sc, RT2860_REG_BBP_CSR_CFG, 
@@ -7582,8 +7583,7 @@
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: BBP busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			printf("%s:%s: BBP busy after 100 probes\n",device_get_nameunit(sc->sc_dev), __func__);
 			return (0);
 		}
 		else {
@@ -7606,8 +7606,8 @@
 
 	if (ntries == 100)
 	{
-		printf("%s: could not read from BBP through MCU: reg=0x%02x\n",
-			device_get_nameunit(sc->sc_dev), reg);
+		device_printf(sc->sc_dev,
+		    "could not read from BBP through MCU: reg=0x%02x\n", reg);
 		return 0;
 	}
 
@@ -7633,8 +7633,8 @@
 		DELAY(1);
 	}
 
-	printf("%s: could not read from BBP through MCU: reg=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), reg);
+	device_printf(sc->sc_dev, "could not read from BBP through MCU: "
+	    "reg=0x%02x\n", reg);
 
 	return 0;
 }
@@ -7647,17 +7647,16 @@
 	int ntries;
 	uint32_t tmp;
 
-	if (sc->mac_rev == 0x28720200)
-	{
+	if (sc->mac_rev == 0x28720200) {
 		for (ntries = 0; ntries < 100; ntries ++) {
-			if ( !(rt2860_io_mac_read(sc, RT2860_REG_BBP_CSR_CFG) & 
+			if ( !(rt2860_io_mac_read(sc, RT2860_REG_BBP_CSR_CFG) &
 			    RT2860_REG_BBP_CSR_BUSY) )
 				break;
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: BBP busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			device_printf(sc->sc_dev,
+			    "BBP busy after 100 probes\n");
 			return;
 		}
 		rt2860_io_mac_write(sc, RT2860_REG_BBP_CSR_CFG, 
@@ -7668,8 +7667,7 @@
 		return;
 	}
 
-	for (ntries = 0; ntries < 100; ntries++)
-	{
+	for (ntries = 0; ntries < 100; ntries++) {
 		if (!(rt2860_io_mac_read(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT) &
 			RT2860_REG_BBP_CSR_BUSY))
 			break;
@@ -7679,8 +7677,8 @@
 
 	if (ntries == 100)
 	{
-		printf("%s: could not write to BBP through MCU: reg=0x%02x\n",
-			device_get_nameunit(sc->sc_dev), reg);
+		device_printf(sc->sc_dev,
+		    "could not write to BBP through MCU: reg=0x%02x\n", reg);
 		return;
 	}
 
@@ -7712,8 +7710,8 @@
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: RF busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			device_printf(sc->sc_dev,
+			    "RF busy after 100 probes\n");
 			return;
 		}
 		rt2860_io_mac_write(sc, RT2872_REG_RF_CSR_CFG, 
@@ -7732,8 +7730,8 @@
 
 	if (ntries == 100)
 	{
-		printf("%s: could not write to RF: reg=0x%02x\n",
-			device_get_nameunit(sc->sc_dev), reg);
+		device_printf(sc->sc_dev,
+		    "could not write to RF: reg=0x%02x\n", reg);
 		return;
 	}
 
@@ -7755,8 +7753,8 @@
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: RF busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			device_printf(sc->sc_dev,
+			    "RF busy after 100 probes\n");
 			return (-1);
 		}
 		rt2860_io_mac_write(sc, RT2872_REG_RF_CSR_CFG, 
@@ -7770,8 +7768,8 @@
 			DELAY(1);
 		}
 		if (ntries == 100) {
-			printf("%s:%s: RF busy after 100 probes\n",
-				device_get_nameunit(sc->sc_dev), __func__);
+			device_printf(sc->sc_dev,
+			    "RF busy after 100 probes\n");
 		}
 
 		return (rt2860_io_mac_read(sc, RT2872_REG_RF_CSR_CFG) & RT2872_REG_RF_VAL_MASK);
@@ -7815,8 +7813,8 @@
 
 	if (ntries == 100)
 	{
-		printf("%s: could not read H2M: cmd=0x%02x\n",
-			device_get_nameunit(sc->sc_dev), cmd);
+		device_printf(sc->sc_dev,
+		    "could not read H2M: cmd=0x%02x\n", cmd);
 		return;
 	}
 
@@ -7898,8 +7896,7 @@
 	if (ucode[len - 2] != rt2860_io_byte_rev(crc >> 8) ||
 		ucode[len - 1] != rt2860_io_byte_rev(crc))
 	{
-		printf("%s: wrong microcode crc\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "wrong microcode crc\n");
 		return EINVAL;
 	}
 
@@ -7942,8 +7939,8 @@
 
 		if (ntries == 1000)
 		{
-			printf("%s: timeout waiting for MCU to initialize\n",
-				device_get_nameunit(sc->sc_dev));
+			device_printf(sc->sc_dev,
+			    "timeout waiting for MCU to initialize\n");
 			return ETIMEDOUT;
 		}
 	}
@@ -8124,8 +8121,7 @@
 	val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_ANTENNA);
 	if (val == 0xffff)
 	{
-		printf("%s: invalid EEPROM antenna info\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "invalid EEPROM antenna info\n");
 
 		sc->rf_rev = RT2860_EEPROM_RF_2820;
 		sc->ntxpath = 1;
@@ -8184,15 +8180,13 @@
 	}
 	else
 	{
-		printf("%s: invalid EEPROM RF freq offset\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "invalid EEPROM RF freq offset\n");
 
 		sc->rf_freq_off = 0;
 	}
 
 	RT2860_DPRINTF(sc, RT2860_DEBUG_EEPROM,
-		"%s: EEPROM freq offset=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), sc->rf_freq_off);
+		"%s: EEPROM freq offset=0x%02x\n",device_get_nameunit(sc->sc_dev), sc->rf_freq_off);
 
 	/* read LEDs operating mode */
 
@@ -8205,8 +8199,7 @@
 	}
 	else
 	{
-		printf("%s: invalid EEPROM LED settings\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "invalid EEPROM LED settings\n");
 
 		sc->led_cntl = RT2860_EEPROM_LED_CNTL_DEFAULT;
 		sc->led_off[0] = RT2860_EEPROM_LED1_OFF_DEFAULT;
@@ -8261,8 +8254,9 @@
 	{
 		if (sc->lna_gain[i] == 0x00 || sc->lna_gain[i] == (int8_t) 0xff)
 		{
-			printf("%s: invalid EEPROM LNA gain #%d: 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->lna_gain[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM LNA gain #%d: 0x%02x\n",
+			    i, sc->lna_gain[i]);
 
 			sc->lna_gain[i] = sc->lna_gain[1];
 		}
@@ -8278,8 +8272,9 @@
 		if (sc->rssi_off_2ghz[i] < RT2860_EEPROM_RSSI_OFF_MIN ||
 			sc->rssi_off_2ghz[i] > RT2860_EEPROM_RSSI_OFF_MAX)
 		{
-			printf("%s: invalid EEPROM RSSI offset #%d (2GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->rssi_off_2ghz[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM RSSI offset #%d (2GHz): 0x%02x\n",
+			    i, sc->rssi_off_2ghz[i]);
 
 			sc->rssi_off_2ghz[i] = 0;
 		}
@@ -8287,8 +8282,9 @@
 		if (sc->rssi_off_5ghz[i] < RT2860_EEPROM_RSSI_OFF_MIN ||
 			sc->rssi_off_5ghz[i] > RT2860_EEPROM_RSSI_OFF_MAX)
 		{
-			printf("%s: invalid EEPROM RSSI offset #%d (5GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->rssi_off_5ghz[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM RSSI offset #%d (5GHz): 0x%02x\n",
+			    i, sc->rssi_off_5ghz[i]);
 
 			sc->rssi_off_5ghz[i] = 0;
 		}
@@ -8341,8 +8337,9 @@
 		if (sc->txpow1[i] < RT2860_EEPROM_TXPOW_2GHZ_MIN ||
 			sc->txpow1[i] > RT2860_EEPROM_TXPOW_2GHZ_MAX)
 		{
-			printf("%s: invalid EEPROM Tx power1 #%d (2GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->txpow1[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM Tx power1 #%d (2GHz): 0x%02x\n",
+			    i, sc->txpow1[i]);
 
 			sc->txpow1[i] = RT2860_EEPROM_TXPOW_2GHZ_DEFAULT;
 		}
@@ -8350,8 +8347,9 @@
 		if (sc->txpow2[i] < RT2860_EEPROM_TXPOW_2GHZ_MIN ||
 			sc->txpow2[i] > RT2860_EEPROM_TXPOW_2GHZ_MAX)
 		{
-			printf("%s: invalid EEPROM Tx power2 #%d (2GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->txpow2[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM Tx power2 #%d (2GHz): 0x%02x\n",
+			    i, sc->txpow2[i]);
 
 			sc->txpow2[i] = RT2860_EEPROM_TXPOW_2GHZ_DEFAULT;
 		}
@@ -8362,8 +8360,9 @@
 		if (sc->txpow1[i] < RT2860_EEPROM_TXPOW_5GHZ_MIN ||
 			sc->txpow1[i] > RT2860_EEPROM_TXPOW_5GHZ_MAX)
 		{
-			printf("%s: invalid EEPROM Tx power1 #%d (5GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->txpow1[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM Tx power1 #%d (5GHz): 0x%02x\n",
+			    i, sc->txpow1[i]);
 
 			sc->txpow1[i] = RT2860_EEPROM_TXPOW_5GHZ_DEFAULT;
 		}
@@ -8371,8 +8370,9 @@
 		if (sc->txpow2[i] < RT2860_EEPROM_TXPOW_5GHZ_MIN ||
 			sc->txpow2[i] > RT2860_EEPROM_TXPOW_5GHZ_MAX)
 		{
-			printf("%s: invalid EEPROM Tx power2 #%d (5GHz): 0x%02x\n",
-				device_get_nameunit(sc->sc_dev), i, sc->txpow2[i]);
+			device_printf(sc->sc_dev,
+			    "invalid EEPROM Tx power2 #%d (5GHz): 0x%02x\n",
+			    i, sc->txpow2[i]);
 
 			sc->txpow2[i] = RT2860_EEPROM_TXPOW_5GHZ_DEFAULT;
 		}
@@ -8524,8 +8524,7 @@
 	sc->powersave_level = val & 0xff;
 
 	if ((sc->powersave_level & 0xff) == 0xff)
-		printf("%s: invalid EEPROM powersave level\n",
-			device_get_nameunit(sc->sc_dev));
+		device_printf(sc->sc_dev, "invalid EEPROM powersave level\n");
 
 	RT2860_DPRINTF(sc, RT2860_DEBUG_EEPROM,
 		"%s: EEPROM powersave level=0x%02x\n",


More information about the Zrouter-src-freebsd mailing list