Module Name:    src
Committed By:   cegger
Date:           Tue May  5 21:33:21 UTC 2009

Modified Files:
        src/sys/dev/pci: if_sip.c

Log Message:
device_t/softc split
tested by and ok dyoung@


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/pci/if_sip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_sip.c
diff -u src/sys/dev/pci/if_sip.c:1.138 src/sys/dev/pci/if_sip.c:1.139
--- src/sys/dev/pci/if_sip.c:1.138	Thu Apr  2 00:09:33 2009
+++ src/sys/dev/pci/if_sip.c	Tue May  5 21:33:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sip.c,v 1.138 2009/04/02 00:09:33 dyoung Exp $	*/
+/*	$NetBSD: if_sip.c,v 1.139 2009/05/05 21:33:21 cegger Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.138 2009/04/02 00:09:33 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.139 2009/05/05 21:33:21 cegger Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -206,7 +206,7 @@
  * Software state per device.
  */
 struct sip_softc {
-	struct device sc_dev;		/* generic device information */
+	device_t sc_dev;		/* generic device information */
 	bus_space_tag_t sc_st;		/* bus space tag */
 	bus_space_handle_t sc_sh;	/* bus space handle */
 	bus_size_t sc_sz;		/* bus space size */
@@ -613,10 +613,10 @@
 int	gsip_copy_small = 0;
 int	sip_copy_small = 0;
 
-CFATTACH_DECL3(gsip, sizeof(struct sip_softc),
+CFATTACH_DECL3_NEW(gsip, sizeof(struct sip_softc),
     sipcom_match, sipcom_attach, sipcom_detach, NULL, NULL, NULL,
     DVF_DETACH_SHUTDOWN);
-CFATTACH_DECL3(sip, sizeof(struct sip_softc),
+CFATTACH_DECL3_NEW(sip, sizeof(struct sip_softc),
     sipcom_match, sipcom_attach, sipcom_detach, NULL, NULL, NULL,
     DVF_DETACH_SHUTDOWN);
 
@@ -795,7 +795,7 @@
 	if (bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_PTSCR) &
 	    PTSCR_EELOAD_EN) {
 		printf("%s: timeout loading configuration from EEPROM\n",
-		    device_xname(&sc->sc_dev));
+		    device_xname(sc->sc_dev));
 		return;
 	}
 
@@ -803,7 +803,7 @@
 
 	reg = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_CFG);
 	if (reg & CFG_PCI64_DET) {
-		printf("%s: 64-bit PCI slot detected", device_xname(&sc->sc_dev));
+		printf("%s: 64-bit PCI slot detected", device_xname(sc->sc_dev));
 		/*
 		 * Check to see if this card is 64-bit.  If so, enable 64-bit
 		 * data transfers.
@@ -833,7 +833,7 @@
 
 	if (reg & (CFG_TBI_EN|CFG_EXT_125)) {
 		const char *sep = "";
-		printf("%s: using ", device_xname(&sc->sc_dev));
+		printf("%s: using ", device_xname(sc->sc_dev));
 		if (reg & CFG_EXT_125) {
 			sc->sc_cfg |= CFG_EXT_125;
 			printf("%s125MHz clock", sep);
@@ -1007,6 +1007,7 @@
 		printf("\n");
 		panic("%s: impossible", __func__);
 	}
+	sc->sc_dev = self;
 	sc->sc_gigabit = sip->sip_gigabit;
 
 	sc->sc_pc = pc;
@@ -1074,7 +1075,7 @@
 		sc->sc_sz = iosz;
 	} else {
 		printf("%s: unable to map device registers\n",
-		    device_xname(&sc->sc_dev));
+		    device_xname(sc->sc_dev));
 		return;
 	}
 
@@ -1093,7 +1094,7 @@
 	/* power up chip */
 	error = pci_activate(pa->pa_pc, pa->pa_tag, self, pci_activate_null);
 	if (error != 0 && error != EOPNOTSUPP) {
-		aprint_error_dev(&sc->sc_dev, "cannot activate %d\n", error);
+		aprint_error_dev(sc->sc_dev, "cannot activate %d\n", error);
 		return;
 	}
 
@@ -1101,19 +1102,19 @@
 	 * Map and establish our interrupt.
 	 */
 	if (pci_intr_map(pa, &ih)) {
-		aprint_error_dev(&sc->sc_dev, "unable to map interrupt\n");
+		aprint_error_dev(sc->sc_dev, "unable to map interrupt\n");
 		return;
 	}
 	intrstr = pci_intr_string(pc, ih);
 	sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, sipcom_intr, sc);
 	if (sc->sc_ih == NULL) {
-		aprint_error_dev(&sc->sc_dev, "unable to establish interrupt");
+		aprint_error_dev(sc->sc_dev, "unable to establish interrupt");
 		if (intrstr != NULL)
 			printf(" at %s", intrstr);
 		printf("\n");
 		return sipcom_do_detach(self, SIP_ATTACH_MAP);
 	}
-	printf("%s: interrupting at %s\n", device_xname(&sc->sc_dev), intrstr);
+	printf("%s: interrupting at %s\n", device_xname(sc->sc_dev), intrstr);
 
 	SIMPLEQ_INIT(&sc->sc_txfreeq);
 	SIMPLEQ_INIT(&sc->sc_txdirtyq);
@@ -1125,7 +1126,7 @@
 	if ((error = bus_dmamem_alloc(sc->sc_dmat,
 	    sizeof(struct sip_control_data), PAGE_SIZE, 0, &sc->sc_seg, 1,
 	    &rseg, 0)) != 0) {
-		aprint_error_dev(&sc->sc_dev, "unable to allocate control data, error = %d\n",
+		aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n",
 		    error);
 		return sipcom_do_detach(self, SIP_ATTACH_INTR);
 	}
@@ -1133,7 +1134,7 @@
 	if ((error = bus_dmamem_map(sc->sc_dmat, &sc->sc_seg, rseg,
 	    sizeof(struct sip_control_data), (void **)&sc->sc_control_data,
 	    BUS_DMA_COHERENT|BUS_DMA_NOCACHE)) != 0) {
-		aprint_error_dev(&sc->sc_dev, "unable to map control data, error = %d\n",
+		aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n",
 		    error);
 		sipcom_do_detach(self, SIP_ATTACH_ALLOC_MEM);
 	}
@@ -1141,7 +1142,7 @@
 	if ((error = bus_dmamap_create(sc->sc_dmat,
 	    sizeof(struct sip_control_data), 1,
 	    sizeof(struct sip_control_data), 0, 0, &sc->sc_cddmamap)) != 0) {
-		aprint_error_dev(&sc->sc_dev, "unable to create control data DMA map, "
+		aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, "
 		    "error = %d\n", error);
 		sipcom_do_detach(self, SIP_ATTACH_MAP_MEM);
 	}
@@ -1149,7 +1150,7 @@
 	if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap,
 	    sc->sc_control_data, sizeof(struct sip_control_data), NULL,
 	    0)) != 0) {
-		aprint_error_dev(&sc->sc_dev, "unable to load control data DMA map, error = %d\n",
+		aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n",
 		    error);
 		sipcom_do_detach(self, SIP_ATTACH_CREATE_MAP);
 	}
@@ -1161,7 +1162,7 @@
 		if ((error = bus_dmamap_create(sc->sc_dmat, tx_dmamap_size,
 		    sc->sc_parm->p_ntxsegs, MCLBYTES, 0, 0,
 		    &sc->sc_txsoft[i].txs_dmamap)) != 0) {
-			aprint_error_dev(&sc->sc_dev, "unable to create tx DMA map %d, "
+			aprint_error_dev(sc->sc_dev, "unable to create tx DMA map %d, "
 			    "error = %d\n", i, error);
 			sipcom_do_detach(self, SIP_ATTACH_CREATE_TXMAP);
 		}
@@ -1173,7 +1174,7 @@
 	for (i = 0; i < sc->sc_parm->p_nrxdesc; i++) {
 		if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
 		    MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
-			aprint_error_dev(&sc->sc_dev, "unable to create rx DMA map %d, "
+			aprint_error_dev(sc->sc_dev, "unable to create rx DMA map %d, "
 			    "error = %d\n", i, error);
 			sipcom_do_detach(self, SIP_ATTACH_CREATE_RXMAP);
 		}
@@ -1206,7 +1207,7 @@
 
 	(*sip->sip_variant->sipv_read_macaddr)(sc, pa, enaddr);
 
-	printf("%s: Ethernet address %s\n", device_xname(&sc->sc_dev),
+	printf("%s: Ethernet address %s\n", device_xname(sc->sc_dev),
 	    ether_sprintf(enaddr));
 
 	/*
@@ -1235,10 +1236,10 @@
 	 * XXX We cannot handle flow control on the DP83815.
 	 */
 	if (SIP_CHIP_MODEL(sc, PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83815))
-		mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
+		mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
 			   MII_OFFSET_ANY, 0);
 	else
-		mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
+		mii_attach(sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
 			   MII_OFFSET_ANY, MIIF_DOPAUSE);
 	if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
 		ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
@@ -1247,7 +1248,7 @@
 		ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
 
 	ifp = &sc->sc_ethercom.ec_if;
-	strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	sc->sc_if_flags = ifp->if_flags;
@@ -1291,7 +1292,7 @@
 	sc->sc_prev.is_vlan = VLAN_ATTACHED(&(sc)->sc_ethercom);
 	sc->sc_prev.if_capenable = ifp->if_capenable;
 #if NRND > 0
-	rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev),
+	rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
 	    RND_TYPE_NET, 0);
 #endif
 
@@ -1332,39 +1333,39 @@
 	 * Attach event counters.
 	 */
 	evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC,
-	    NULL, device_xname(&sc->sc_dev), "txsstall");
+	    NULL, device_xname(sc->sc_dev), "txsstall");
 	evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC,
-	    NULL, device_xname(&sc->sc_dev), "txdstall");
+	    NULL, device_xname(sc->sc_dev), "txdstall");
 	evcnt_attach_dynamic(&sc->sc_ev_txforceintr, EVCNT_TYPE_INTR,
-	    NULL, device_xname(&sc->sc_dev), "txforceintr");
+	    NULL, device_xname(sc->sc_dev), "txforceintr");
 	evcnt_attach_dynamic(&sc->sc_ev_txdintr, EVCNT_TYPE_INTR,
-	    NULL, device_xname(&sc->sc_dev), "txdintr");
+	    NULL, device_xname(sc->sc_dev), "txdintr");
 	evcnt_attach_dynamic(&sc->sc_ev_txiintr, EVCNT_TYPE_INTR,
-	    NULL, device_xname(&sc->sc_dev), "txiintr");
+	    NULL, device_xname(sc->sc_dev), "txiintr");
 	evcnt_attach_dynamic(&sc->sc_ev_rxintr, EVCNT_TYPE_INTR,
-	    NULL, device_xname(&sc->sc_dev), "rxintr");
+	    NULL, device_xname(sc->sc_dev), "rxintr");
 	evcnt_attach_dynamic(&sc->sc_ev_hiberr, EVCNT_TYPE_INTR,
-	    NULL, device_xname(&sc->sc_dev), "hiberr");
+	    NULL, device_xname(sc->sc_dev), "hiberr");
 	if (!sc->sc_gigabit) {
 		evcnt_attach_dynamic(&sc->sc_ev_rxpause, EVCNT_TYPE_INTR,
-		    NULL, device_xname(&sc->sc_dev), "rxpause");
+		    NULL, device_xname(sc->sc_dev), "rxpause");
 	} else {
 		evcnt_attach_dynamic(&sc->sc_ev_rxpause, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "rxpause");
+		    NULL, device_xname(sc->sc_dev), "rxpause");
 		evcnt_attach_dynamic(&sc->sc_ev_txpause, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "txpause");
+		    NULL, device_xname(sc->sc_dev), "txpause");
 		evcnt_attach_dynamic(&sc->sc_ev_rxipsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "rxipsum");
+		    NULL, device_xname(sc->sc_dev), "rxipsum");
 		evcnt_attach_dynamic(&sc->sc_ev_rxtcpsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "rxtcpsum");
+		    NULL, device_xname(sc->sc_dev), "rxtcpsum");
 		evcnt_attach_dynamic(&sc->sc_ev_rxudpsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "rxudpsum");
+		    NULL, device_xname(sc->sc_dev), "rxudpsum");
 		evcnt_attach_dynamic(&sc->sc_ev_txipsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "txipsum");
+		    NULL, device_xname(sc->sc_dev), "txipsum");
 		evcnt_attach_dynamic(&sc->sc_ev_txtcpsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "txtcpsum");
+		    NULL, device_xname(sc->sc_dev), "txtcpsum");
 		evcnt_attach_dynamic(&sc->sc_ev_txudpsum, EVCNT_TYPE_MISC,
-		    NULL, device_xname(&sc->sc_dev), "txudpsum");
+		    NULL, device_xname(sc->sc_dev), "txudpsum");
 	}
 #endif /* SIP_EVENT_COUNTERS */
 
@@ -1496,7 +1497,7 @@
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
 			if (m == NULL) {
 				printf("%s: unable to allocate Tx mbuf\n",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 				break;
 			}
 			MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
@@ -1504,7 +1505,7 @@
 				MCLGET(m, M_DONTWAIT);
 				if ((m->m_flags & M_EXT) == 0) {
 					printf("%s: unable to allocate Tx "
-					    "cluster\n", device_xname(&sc->sc_dev));
+					    "cluster\n", device_xname(sc->sc_dev));
 					m_freem(m);
 					break;
 				}
@@ -1515,7 +1516,7 @@
 			    m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
 			if (error) {
 				printf("%s: unable to load Tx buffer, "
-				    "error = %d\n", device_xname(&sc->sc_dev), error);
+				    "error = %d\n", device_xname(sc->sc_dev), error);
 				break;
 			}
 		} else if (error == EFBIG) {
@@ -1526,7 +1527,7 @@
 			 * to a single buffer.
 			 */
 			printf("%s: Tx packet consumes too many "
-			    "DMA segments, dropping...\n", device_xname(&sc->sc_dev));
+			    "DMA segments, dropping...\n", device_xname(sc->sc_dev));
 			IFQ_DEQUEUE(&ifp->if_snd, m0);
 			m_freem(m0);
 			continue;
@@ -1710,14 +1711,14 @@
 	sipcom_txintr(sc);
 
 	if (sc->sc_txfree != sc->sc_ntxdesc) {
-		printf("%s: device timeout\n", device_xname(&sc->sc_dev));
+		printf("%s: device timeout\n", device_xname(sc->sc_dev));
 		ifp->if_oerrors++;
 
 		/* Reset the interface. */
 		(void) sipcom_init(ifp);
 	} else if (ifp->if_flags & IFF_DEBUG)
 		printf("%s: recovered from device timeout\n",
-		    device_xname(&sc->sc_dev));
+		    device_xname(sc->sc_dev));
 
 	/* Try to get more packets going. */
 	sipcom_start(ifp);
@@ -1832,7 +1833,7 @@
 	u_int32_t isr;
 	int handled = 0;
 
-	if (!device_is_active(&sc->sc_dev))
+	if (!device_is_active(sc->sc_dev))
 		return 0;
 
 	/* Disable interrupts. */
@@ -1859,14 +1860,14 @@
 
 			if (isr & ISR_RXORN) {
 				printf("%s: receive FIFO overrun\n",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 
 				/* XXX adjust rx_drain_thresh? */
 			}
 
 			if (isr & ISR_RXIDLE) {
 				printf("%s: receive ring overrun\n",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 
 				/* Get the receive process going again. */
 				bus_space_write_4(sc->sc_st, sc->sc_sh,
@@ -1894,7 +1895,7 @@
 				    : OTHER_SIP_TXFIFO_SIZE;
 
 				printf("%s: transmit FIFO underrun",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 				thresh = sc->sc_tx_drain_thresh + 1;
 				if (thresh <= __SHIFTOUT_MASK(sc->sc_bits.b_txcfg_drth_mask)
 				&& (thresh * 32) <= (txfifo_size -
@@ -1933,7 +1934,7 @@
 				if ((isr & (bit)) != 0) {		\
 					if ((ifp->if_flags & IFF_DEBUG) != 0) \
 						printf("%s: %s\n",	\
-						    device_xname(&sc->sc_dev), str); \
+						    device_xname(sc->sc_dev), str); \
 					want_init = 1;			\
 				}					\
 			} while (/*CONSTCOND*/0)
@@ -2013,10 +2014,10 @@
 			if (ifp->if_flags & IFF_DEBUG) {
 				if (cmdsts & CMDSTS_Tx_ED)
 					printf("%s: excessive deferral\n",
-					    device_xname(&sc->sc_dev));
+					    device_xname(sc->sc_dev));
 				if (cmdsts & CMDSTS_Tx_EC)
 					printf("%s: excessive collisions\n",
-					    device_xname(&sc->sc_dev));
+					    device_xname(sc->sc_dev));
 			}
 		} else {
 			/* Packet was transmitted successfully. */
@@ -2139,12 +2140,12 @@
 			    (cmdsts & CMDSTS_Rx_RXO) == 0) {
 				/* Receive overrun handled elsewhere. */
 				printf("%s: receive descriptor error\n",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 			}
 #define	PRINTERR(bit, str)						\
 			if ((ifp->if_flags & IFF_DEBUG) != 0 &&		\
 			    (cmdsts & (bit)) != 0)			\
-				printf("%s: %s\n", device_xname(&sc->sc_dev), str)
+				printf("%s: %s\n", device_xname(sc->sc_dev), str)
 			PRINTERR(CMDSTS_Rx_RUNT, "runt packet");
 			PRINTERR(CMDSTS_Rx_ISE, "invalid symbol error");
 			PRINTERR(CMDSTS_Rx_CRCE, "CRC error");
@@ -2309,12 +2310,12 @@
 			    (cmdsts & CMDSTS_Rx_RXO) == 0) {
 				/* Receive overrun handled elsewhere. */
 				printf("%s: receive descriptor error\n",
-				    device_xname(&sc->sc_dev));
+				    device_xname(sc->sc_dev));
 			}
 #define	PRINTERR(bit, str)						\
 			if ((ifp->if_flags & IFF_DEBUG) != 0 &&		\
 			    (cmdsts & (bit)) != 0)			\
-				printf("%s: %s\n", device_xname(&sc->sc_dev), str)
+				printf("%s: %s\n", device_xname(sc->sc_dev), str)
 			PRINTERR(CMDSTS_Rx_RUNT, "runt packet");
 			PRINTERR(CMDSTS_Rx_ISE, "invalid symbol error");
 			PRINTERR(CMDSTS_Rx_CRCE, "CRC error");
@@ -2482,7 +2483,7 @@
 	}
 
 	if (i == SIP_TIMEOUT) {
-		printf("%s: reset failed to complete\n", device_xname(&sc->sc_dev));
+		printf("%s: reset failed to complete\n", device_xname(sc->sc_dev));
 		return false;
 	}
 
@@ -2556,12 +2557,12 @@
 	struct sip_desc *sipd;
 	int i, error = 0;
 
-	if (device_is_active(&sc->sc_dev)) {
+	if (device_is_active(sc->sc_dev)) {
 		/*
 		 * Cancel any pending I/O.
 		 */
 		sipcom_stop(ifp, 0);
-	} else if (!pmf_device_resume_self(&sc->sc_dev))
+	} else if (!pmf_device_resume_self(sc->sc_dev))
 		return 0;
 
 	/*
@@ -2634,7 +2635,7 @@
 			if ((error = sipcom_add_rxbuf(sc, i)) != 0) {
 				printf("%s: unable to allocate or map rx "
 				    "buffer %d, error = %d\n",
-				    device_xname(&sc->sc_dev), i, error);
+				    device_xname(sc->sc_dev), i, error);
 				/*
 				 * XXX Should attempt to run with fewer receive
 				 * XXX buffers instead of just failing.
@@ -2716,7 +2717,7 @@
 	      IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
 	      IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx))) {
 		printf("%s: Checksum offloading does not work if MTU > 8109 - "
-		       "disabled.\n", device_xname(&sc->sc_dev));
+		       "disabled.\n", device_xname(sc->sc_dev));
 		ifp->if_capenable &=
 		    ~(IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
 		     IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
@@ -2799,7 +2800,7 @@
 
  out:
 	if (error)
-		printf("%s: interface not running\n", device_xname(&sc->sc_dev));
+		printf("%s: interface not running\n", device_xname(sc->sc_dev));
 	return (error);
 }
 
@@ -2846,7 +2847,7 @@
 	/* Down the MII. */
 	mii_down(&sc->sc_mii);
 
-	if (device_is_active(&sc->sc_dev)) {
+	if (device_is_active(sc->sc_dev)) {
 		/*
 		 * Disable interrupts.
 		 */
@@ -2867,12 +2868,12 @@
 		    (le32toh(*sipd_cmdsts(sc, &sc->sc_txdescs[txs->txs_lastdesc])) &
 		     CMDSTS_INTR) == 0)
 			printf("%s: sip_stop: last descriptor does not "
-			    "have INTR bit set\n", device_xname(&sc->sc_dev));
+			    "have INTR bit set\n", device_xname(sc->sc_dev));
 		SIMPLEQ_REMOVE_HEAD(&sc->sc_txdirtyq, txs_q);
 #ifdef DIAGNOSTIC
 		if (txs->txs_mbuf == NULL) {
 			printf("%s: dirty txsoft with no mbuf chain\n",
-			    device_xname(&sc->sc_dev));
+			    device_xname(sc->sc_dev));
 			panic("sip_stop");
 		}
 #endif
@@ -2891,12 +2892,12 @@
 	ifp->if_timer = 0;
 
 	if (disable)
-		pmf_device_suspend_self(&sc->sc_dev);
+		pmf_device_suspend_self(sc->sc_dev);
 
 	if ((ifp->if_flags & IFF_DEBUG) != 0 &&
 	    (cmdsts & CMDSTS_INTR) == 0 && sc->sc_txfree != sc->sc_ntxdesc)
 		printf("%s: sip_stop: no INTR bits set in dirty tx "
-		    "descriptors\n", device_xname(&sc->sc_dev));
+		    "descriptors\n", device_xname(sc->sc_dev));
 }
 
 /*
@@ -3002,7 +3003,7 @@
 	    BUS_DMA_READ|BUS_DMA_NOWAIT);
 	if (error) {
 		printf("%s: can't load rx DMA map %d, error = %d\n",
-		    device_xname(&sc->sc_dev), idx, error);
+		    device_xname(sc->sc_dev), idx, error);
 		panic("%s", __func__);		/* XXX */
 	}
 
@@ -3747,7 +3748,7 @@
 
 	if (cksum != match)
 		printf("%s: Checksum (%x) mismatch (%x)",
-		    device_xname(&sc->sc_dev), cksum, match);
+		    device_xname(sc->sc_dev), cksum, match);
 
 	enaddr[0] = eeprom_data[SIP_DP83820_EEPROM_PMATCH2 / 2] & 0xff;
 	enaddr[1] = eeprom_data[SIP_DP83820_EEPROM_PMATCH2 / 2] >> 8;
@@ -3896,7 +3897,7 @@
 	}
 	if (cksum != match) {
 		printf("%s: Checksum (%x) mismatch (%x)",
-		    device_xname(&sc->sc_dev), cksum, match);
+		    device_xname(sc->sc_dev), cksum, match);
 	}
 
 	/*
@@ -3939,7 +3940,7 @@
 {
 	struct sip_softc *sc = ifp->if_softc;
 
-	if (!device_is_active(&sc->sc_dev)) {
+	if (!device_is_active(sc->sc_dev)) {
 		ifmr->ifm_active = IFM_ETHER | IFM_NONE;
 		ifmr->ifm_status = 0;
 		return;

Reply via email to