Module Name: src
Committed By: skrll
Date: Wed Oct 10 22:17:44 UTC 2012
Modified Files:
src/sys/dev/ic: seeq8005.c seeq8005var.h
src/sys/dev/podulebus: if_ea.c if_eb.c
Log Message:
Split softc/device_t
Use device_xname
>From chuq
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/seeq8005var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/podulebus/if_ea.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/podulebus/if_eb.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/ic/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.49 src/sys/dev/ic/seeq8005.c:1.50
--- src/sys/dev/ic/seeq8005.c:1.49 Wed Oct 10 22:11:31 2012
+++ src/sys/dev/ic/seeq8005.c Wed Oct 10 22:17:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $ */
+/* $NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.49 2012/10/10 22:11:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.50 2012/10/10 22:17:44 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -184,7 +184,7 @@ seeq8005_attach(struct seeq8005_softc *s
SEEQ_WRITE16(sc, iot, ioh, SEEQ_RX_PTR, 0x1234);
if (SEEQ_READ16(sc, iot, ioh, SEEQ_RX_PTR) != 0x1234) {
aprint_normal("\n");
- aprint_error_dev(&sc->sc_dev, "Cannot determine data bus width\n");
+ aprint_error_dev(sc->sc_dev, "Cannot determine data bus width\n");
return;
}
}
@@ -238,21 +238,21 @@ seeq8005_attach(struct seeq8005_softc *s
ea_ramtest(sc);
printf("%s: %dKB packet memory, txbuf=%dKB (%d buffers), rxbuf=%dKB",
- device_xname(&sc->sc_dev), sc->sc_buffersize >> 10,
+ device_xname(sc->sc_dev), sc->sc_buffersize >> 10,
sc->sc_tx_bufsize >> 10, sc->sc_tx_bufs, sc->sc_rx_bufsize >> 10);
if (padbuf == NULL) {
padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF,
M_ZERO | M_NOWAIT);
if (padbuf == NULL) {
- aprint_error_dev(&sc->sc_dev, "can't allocate pad buffer\n");
+ aprint_error_dev(sc->sc_dev, "can't allocate pad buffer\n");
return;
}
}
/* Initialise ifnet structure. */
- 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_start = ea_start;
ifp->if_ioctl = ea_ioctl;
@@ -288,7 +288,7 @@ seeq8005_attach(struct seeq8005_softc *s
printf("\n");
/* After \n because it can print a line of its own. */
- 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);
}
@@ -369,7 +369,7 @@ do { \
/* Report */
if (sum > 0)
- aprint_error_dev(&sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum);
+ aprint_error_dev(sc->sc_dev, "buffer RAM failed self test, %d faults\n", sum);
}
@@ -406,7 +406,7 @@ ea_stoptx(struct seeq8005_softc *sc)
} while ((status & SEEQ_STATUS_TX_ON) && --timeout > 0);
if (timeout == 0)
log(LOG_ERR, "%s: timeout waiting for tx termination\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
/* Clear any pending tx interrupt */
SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
@@ -446,7 +446,7 @@ ea_stoprx(struct seeq8005_softc *sc)
} while ((status & SEEQ_STATUS_RX_ON) && --timeout > 0);
if (timeout == 0)
log(LOG_ERR, "%s: timeout waiting for rx termination\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
/* Clear any pending rx interrupt */
@@ -551,7 +551,7 @@ ea_await_fifo_empty(struct seeq8005_soft
if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) &
SEEQ_STATUS_FIFO_EMPTY)
return;
- log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(&sc->sc_dev));
+ log(LOG_ERR, "%s: DMA FIFO failed to empty\n", device_xname(sc->sc_dev));
}
/*
@@ -569,7 +569,7 @@ ea_await_fifo_full(struct seeq8005_softc
if (SEEQ_READ16(sc, iot, ioh, SEEQ_STATUS) &
SEEQ_STATUS_FIFO_FULL)
return;
- log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(&sc->sc_dev));
+ log(LOG_ERR, "%s: DMA FIFO failed to fill\n", device_xname(sc->sc_dev));
}
/*
@@ -593,9 +593,9 @@ ea_writebuf(struct seeq8005_softc *sc, u
#ifdef DIAGNOSTIC
if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t)))
- panic("%s: unaligned writebuf", device_xname(&sc->sc_dev));
+ panic("%s: unaligned writebuf", device_xname(sc->sc_dev));
if (__predict_false(addr >= SEEQ_MAX_BUFFER_SIZE))
- panic("%s: writebuf out of range", device_xname(&sc->sc_dev));
+ panic("%s: writebuf out of range", device_xname(sc->sc_dev));
#endif
if (addr != -1) {
@@ -646,9 +646,9 @@ ea_readbuf(struct seeq8005_softc *sc, u_
#ifdef DIAGNOSTIC
if (__predict_false(!ALIGNED_POINTER(buf, u_int16_t)))
- panic("%s: unaligned readbuf", device_xname(&sc->sc_dev));
+ panic("%s: unaligned readbuf", device_xname(sc->sc_dev));
if (__predict_false(addr >= SEEQ_MAX_BUFFER_SIZE))
- panic("%s: readbuf out of range", device_xname(&sc->sc_dev));
+ panic("%s: readbuf out of range", device_xname(sc->sc_dev));
#endif
if (addr != -1) {
@@ -1154,7 +1154,7 @@ ea_rxint(struct seeq8005_softc *sc)
++ifp->if_ierrors;
log(LOG_ERR,
"%s: Rx chain corrupt at %04x (ptr = %04x)\n",
- device_xname(&sc->sc_dev), addr, ptr);
+ device_xname(sc->sc_dev), addr, ptr);
ea_init(ifp);
return;
}
@@ -1180,7 +1180,7 @@ ea_rxint(struct seeq8005_softc *sc)
++ifp->if_ierrors;
log(LOG_WARNING,
"%s: rx packet error at %04x (err=%02x)\n",
- device_xname(&sc->sc_dev), addr, status & 0x0f);
+ device_xname(sc->sc_dev), addr, status & 0x0f);
/* XXX shouldn't need to reset if it's genuine. */
ea_init(ifp);
return;
@@ -1194,7 +1194,7 @@ ea_rxint(struct seeq8005_softc *sc)
++ifp->if_ierrors;
log(LOG_ERR,
"%s: rx packet size error at %04x (len=%d)\n",
- device_xname(&sc->sc_dev), addr, len);
+ device_xname(sc->sc_dev), addr, len);
sc->sc_config2 |= SEEQ_CFG2_OUTPUT;
SEEQ_WRITE16(sc, iot, ioh, SEEQ_CONFIG2,
sc->sc_config2);
@@ -1474,7 +1474,7 @@ ea_watchdog(struct ifnet *ifp)
struct seeq8005_softc *sc = ifp->if_softc;
log(LOG_ERR, "%s: lost Tx interrupt (status = 0x%04x)\n",
- device_xname(&sc->sc_dev),
+ device_xname(sc->sc_dev),
SEEQ_READ16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_STATUS));
ifp->if_oerrors++;
Index: src/sys/dev/ic/seeq8005var.h
diff -u src/sys/dev/ic/seeq8005var.h:1.7 src/sys/dev/ic/seeq8005var.h:1.8
--- src/sys/dev/ic/seeq8005var.h:1.7 Thu Feb 2 19:43:03 2012
+++ src/sys/dev/ic/seeq8005var.h Wed Oct 10 22:17:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005var.h,v 1.7 2012/02/02 19:43:03 tls Exp $ */
+/* $NetBSD: seeq8005var.h,v 1.8 2012/10/10 22:17:44 skrll Exp $ */
/*
* Copyright (c) 2000 Ben Harris
@@ -50,7 +50,7 @@ enum seeq_variant {
*/
struct seeq8005_softc {
- struct device sc_dev;
+ device_t sc_dev;
/* These fields should be initialised by the board driver. */
bus_space_tag_t sc_iot; /* I/O base addr */
Index: src/sys/dev/podulebus/if_ea.c
diff -u src/sys/dev/podulebus/if_ea.c:1.16 src/sys/dev/podulebus/if_ea.c:1.17
--- src/sys/dev/podulebus/if_ea.c:1.16 Tue May 12 14:42:58 2009
+++ src/sys/dev/podulebus/if_ea.c Wed Oct 10 22:17:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ea.c,v 1.16 2009/05/12 14:42:58 cegger Exp $ */
+/* $NetBSD: if_ea.c,v 1.17 2012/10/10 22:17:44 skrll Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ea.c,v 1.16 2009/05/12 14:42:58 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ea.c,v 1.17 2012/10/10 22:17:44 skrll Exp $");
#include <sys/param.h>
@@ -76,7 +76,7 @@ void eaattach(device_t, device_t, void *
/* driver structure for autoconf */
-CFATTACH_DECL(ea, sizeof(struct ea_softc),
+CFATTACH_DECL_NEW(ea, sizeof(struct ea_softc),
eaprobe, eaattach, NULL, NULL);
/*
@@ -109,7 +109,9 @@ eaattach(device_t parent, device_t self,
char *ptr;
int i;
-/* dprintf(("Attaching %s...\n", device_xname(&sc->sc_dev)));*/
+ sc->sc_8005.sc_dev = self;
+
+/* dprintf(("Attaching %s...\n", device_xname(self)));*/
/* Set the address of the controller for easy access */
podulebus_shift_tag(pa->pa_mod_t, EA_8005_SHIFT, &sc->sc_8005.sc_iot);
Index: src/sys/dev/podulebus/if_eb.c
diff -u src/sys/dev/podulebus/if_eb.c:1.14 src/sys/dev/podulebus/if_eb.c:1.15
--- src/sys/dev/podulebus/if_eb.c:1.14 Tue May 12 14:42:58 2009
+++ src/sys/dev/podulebus/if_eb.c Wed Oct 10 22:17:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eb.c,v 1.14 2009/05/12 14:42:58 cegger Exp $ */
+/* $NetBSD: if_eb.c,v 1.15 2012/10/10 22:17:44 skrll Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eb.c,v 1.14 2009/05/12 14:42:58 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eb.c,v 1.15 2012/10/10 22:17:44 skrll Exp $");
#include <sys/param.h>
@@ -76,7 +76,7 @@ void ebattach(device_t, device_t, void *
/* driver structure for autoconf */
-CFATTACH_DECL(eb, sizeof(struct eb_softc),
+CFATTACH_DECL_NEW(eb, sizeof(struct eb_softc),
ebprobe, ebattach, NULL, NULL);
/*
@@ -107,7 +107,9 @@ ebattach(device_t parent, device_t self,
struct podulebus_attach_args *pa = aux;
u_int8_t myaddr[ETHER_ADDR_LEN];
-/* dprintf(("Attaching %s...\n", device_xname(&sc->sc_dev)));*/
+ sc->sc_8005.sc_dev = self;
+
+/* dprintf(("Attaching %s...\n", device_xname(self)));*/
/* Set the address of the controller for easy access */
podulebus_shift_tag(pa->pa_mod_t, EB_8004_SHIFT, &sc->sc_8005.sc_iot);