Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Split softc/device_t
details: https://anonhg.NetBSD.org/src/rev/8f47902a23c0
branches: trunk
changeset: 781975:8f47902a23c0
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Oct 10 22:17:44 2012 +0000
description:
Split softc/device_t
Use device_xname
>From chuq
diffstat:
sys/dev/ic/seeq8005.c | 40 ++++++++++++++++++++--------------------
sys/dev/ic/seeq8005var.h | 4 ++--
sys/dev/podulebus/if_ea.c | 10 ++++++----
sys/dev/podulebus/if_eb.c | 10 ++++++----
4 files changed, 34 insertions(+), 30 deletions(-)
diffs (260 lines):
diff -r 44b0edd3a0f6 -r 8f47902a23c0 sys/dev/ic/seeq8005.c
--- a/sys/dev/ic/seeq8005.c Wed Oct 10 22:11:31 2012 +0000
+++ b/sys/dev/ic/seeq8005.c Wed Oct 10 22:17:44 2012 +0000
@@ -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 @@
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 @@
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 @@
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 @@
/* 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 @@
} 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 @@
} 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 @@
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 @@
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 @@
#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 @@
#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 @@
++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 @@
++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 @@
++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 @@
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++;
diff -r 44b0edd3a0f6 -r 8f47902a23c0 sys/dev/ic/seeq8005var.h
--- a/sys/dev/ic/seeq8005var.h Wed Oct 10 22:11:31 2012 +0000
+++ b/sys/dev/ic/seeq8005var.h Wed Oct 10 22:17:44 2012 +0000
@@ -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 @@
*/
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 */
diff -r 44b0edd3a0f6 -r 8f47902a23c0 sys/dev/podulebus/if_ea.c
--- a/sys/dev/podulebus/if_ea.c Wed Oct 10 22:11:31 2012 +0000
+++ b/sys/dev/podulebus/if_ea.c Wed Oct 10 22:17:44 2012 +0000
@@ -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 @@
/* 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 @@
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);
diff -r 44b0edd3a0f6 -r 8f47902a23c0 sys/dev/podulebus/if_eb.c
--- a/sys/dev/podulebus/if_eb.c Wed Oct 10 22:11:31 2012 +0000
+++ b/sys/dev/podulebus/if_eb.c Wed Oct 10 22:17:44 2012 +0000
@@ -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 @@
/* 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 @@
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);
Home |
Main Index |
Thread Index |
Old Index