Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/dev - use device_t and cfdriver_t



details:   https://anonhg.NetBSD.org/src/rev/7317e94021a3
branches:  trunk
changeset: 747556:7317e94021a3
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Sep 20 16:18:21 2009 +0000

description:
- use device_t and cfdriver_t
- use device_private() and device_xname()
- use proper types or variables for device_t/softc

diffstat:

 sys/arch/sparc/dev/bootbus.c     |  21 ++++++-------
 sys/arch/sparc/dev/ebus.c        |  22 +++++++-------
 sys/arch/sparc/dev/if_ie_obio.c  |  24 +++++++-------
 sys/arch/sparc/dev/rtc.c         |  15 ++++-----
 sys/arch/sparc/dev/vme_machdep.c |  62 ++++++++++++++++++++--------------------
 5 files changed, 71 insertions(+), 73 deletions(-)

diffs (truncated from 556 to 300 lines):

diff -r 666ef66f6154 -r 7317e94021a3 sys/arch/sparc/dev/bootbus.c
--- a/sys/arch/sparc/dev/bootbus.c      Sun Sep 20 14:00:24 2009 +0000
+++ b/sys/arch/sparc/dev/bootbus.c      Sun Sep 20 16:18:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $      */
+/*     $NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $     */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.16 2008/04/28 20:23:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.17 2009/09/20 16:18:21 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -57,8 +57,8 @@
        bus_space_tag_t sc_bustag;              /* passed on to children */
 };
 
-static int bootbus_match(struct device *, struct cfdata *, void *);
-static void bootbus_attach(struct device *, struct device *, void *);
+static int bootbus_match(device_t, cfdata_t, void *);
+static void bootbus_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc),
     bootbus_match, bootbus_attach, NULL, NULL);
@@ -72,7 +72,7 @@
 static void bootbus_destroy_attach_args(struct bootbus_attach_args *);
 
 static int
-bootbus_match(struct device *parent, struct cfdata *cf, void *aux)
+bootbus_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct cpuunit_attach_args *cpua = aux;
 
@@ -83,9 +83,9 @@
 }
 
 static void
-bootbus_attach(struct device *parent, struct device *self, void *aux)
+bootbus_attach(device_t parent, device_t self, void *aux)
 {
-       struct bootbus_softc *sc = (void *) self;
+       struct bootbus_softc *sc = device_private(self);
        struct cpuunit_attach_args *cpua = aux;
        int node, error;
 
@@ -112,7 +112,7 @@
            &sc->sc_bustag->ranges);
        if (error) {
                printf("%s: error %d getting \"ranges\" property\n",
-                   sc->sc_dev.dv_xname, error);
+                   device_xname(self), error);
                panic("bootbus_attach");
        }
 
@@ -124,7 +124,7 @@
                if (bootbus_setup_attach_args(sc, sc->sc_bustag, node, &baa))
                        panic("bootbus_attach: failed to set up attach args");
 
-               (void) config_found_sm_loc(&sc->sc_dev, "bootbus", NULL, &baa,
+               (void) config_found_sm_loc(self, "bootbus", NULL, &baa,
                                           bootbus_print, bootbus_submatch);
 
                bootbus_destroy_attach_args(&baa);
@@ -132,8 +132,7 @@
 }
 
 static int
-bootbus_submatch(struct device *parent, struct cfdata *cf,
-                const int *ldesc, void *aux)
+bootbus_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
        struct bootbus_attach_args *baa = aux;
 
diff -r 666ef66f6154 -r 7317e94021a3 sys/arch/sparc/dev/ebus.c
--- a/sys/arch/sparc/dev/ebus.c Sun Sep 20 14:00:24 2009 +0000
+++ b/sys/arch/sparc/dev/ebus.c Sun Sep 20 16:18:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $ */
+/*     $NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.30 2008/05/29 14:51:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.31 2009/09/20 16:18:21 tsutsui Exp $");
 
 #if defined(DEBUG) && !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -83,7 +83,7 @@
 
 struct ebus_softc {
        struct device                   sc_dev;
-       struct device                   *sc_parent;     /* PCI bus */
+       device_t                        sc_parent;      /* PCI bus */
 
        int                             sc_node;        /* PROM node */
 
@@ -97,8 +97,8 @@
        int                             sc_nreg;
 };
 
-static int     ebus_match(struct device *, struct cfdata *, void *);
-static void    ebus_attach(struct device *, struct device *, void *);
+static int     ebus_match(device_t, cfdata_t, void *);
+static void    ebus_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ebus, sizeof(struct ebus_softc),
     ebus_match, ebus_attach, NULL, NULL);
@@ -181,7 +181,7 @@
 
 
 static int
-ebus_match(struct device *parent, struct cfdata *match, void *aux)
+ebus_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct pci_attach_args *pa = aux;
        char name[10];
@@ -212,7 +212,7 @@
 
        if (wiring_map != NULL) {
                printf("%s: global ebus wiring map already initalized\n",
-                      sc->sc_dev.dv_xname);
+                   device_xname(&sc->sc_dev));
                return (0);
        }
 
@@ -238,9 +238,9 @@
  * after the sbus code which does similar things.
  */
 static void
-ebus_attach(struct device *parent, struct device *self, void *aux)
+ebus_attach(device_t parent, device_t self, void *aux)
 {
-       struct ebus_softc *sc = (struct ebus_softc *)self;
+       struct ebus_softc *sc = device_private(self);
        struct pci_attach_args *pa = aux;
        struct ebus_attach_args ea;
        bus_space_tag_t sbt;
@@ -260,7 +260,7 @@
 
        node = PCITAG_NODE(pa->pa_tag);
        if (node == -1)
-               panic("%s: unable to find ebus node", self->dv_xname);
+               panic("%s: unable to find ebus node", device_xname(self));
 
        if (ebus_init_wiring_table(sc) == 0)
                return;
@@ -298,7 +298,7 @@
                             &sc->sc_nreg, &sc->sc_reg);
        if (error)
                panic("%s: unable to read ebus registers (error %d)",
-                     self->dv_xname, error);
+                   device_xname(self), error);
 
        /*
         * now attach all our children
diff -r 666ef66f6154 -r 7317e94021a3 sys/arch/sparc/dev/if_ie_obio.c
--- a/sys/arch/sparc/dev/if_ie_obio.c   Sun Sep 20 14:00:24 2009 +0000
+++ b/sys/arch/sparc/dev/if_ie_obio.c   Sun Sep 20 16:18:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ie_obio.c,v 1.36 2008/04/28 20:23:35 martin Exp $   */
+/*     $NetBSD: if_ie_obio.c,v 1.37 2009/09/20 16:18:21 tsutsui Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.36 2008/04/28 20:23:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.37 2009/09/20 16:18:21 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -125,8 +125,8 @@
 static void ie_obattend(struct ie_softc *, int);
 static void ie_obrun(struct ie_softc *);
 
-int ie_obio_match(struct device *, struct cfdata *, void *);
-void ie_obio_attach(struct device *, struct device *, void *);
+int ie_obio_match(device_t, cfdata_t, void *);
+void ie_obio_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ie_obio, sizeof(struct ie_softc),
     ie_obio_match, ie_obio_attach, NULL, NULL);
@@ -231,7 +231,7 @@
 }
 
 int
-ie_obio_match(struct device *parent, struct cfdata *cf, void *aux)
+ie_obio_match(device_t parent, cfdata_t cf, void *aux)
 {
        union obio_attach_args *uoba = aux;
        struct obio4_attach_args *oba;
@@ -248,11 +248,11 @@
 }
 
 void
-ie_obio_attach(struct device *parent, struct device *self, void *aux)
+ie_obio_attach(device_t parent, device_t self, void *aux)
 {
        union obio_attach_args *uoba = aux;
        struct obio4_attach_args *oba = &uoba->uoba_oba4;
-       struct ie_softc *sc = (void *) self;
+       struct ie_softc *sc = device_private(self);
        bus_dma_tag_t dmatag = oba->oba_dmatag;
        bus_space_handle_t bh;
        bus_dma_segment_t seg;
@@ -282,7 +282,7 @@
                          sizeof(struct ieob),
                          BUS_SPACE_MAP_LINEAR,
                          &bh) != 0) {
-               printf("%s: cannot map registers\n", self->dv_xname);
+               printf("%s: cannot map registers\n", device_xname(self));
                return;
        }
        sc->sc_reg = (void *)bh;
@@ -294,14 +294,14 @@
                                        BUS_DMA_NOWAIT|BUS_DMA_24BIT,
                                        &sc->sc_dmamap)) != 0) {
                printf("%s: DMA map create error %d\n",
-                       sc->sc_dev.dv_xname, error);
+                   device_xname(self), error);
                return;
        }
        if ((error = bus_dmamem_alloc(dmatag, memsize, 64*1024, 0,
                             &seg, 1, &rseg,
                             BUS_DMA_NOWAIT | BUS_DMA_24BIT)) != 0) {
                printf("%s: DMA memory allocation error %d\n",
-                       self->dv_xname, error);
+                   device_xname(self), error);
                return;
        }
 
@@ -310,7 +310,7 @@
                                    (void **)&sc->sc_maddr,
                                    BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
                printf("%s: DMA buffer map error %d\n",
-                       sc->sc_dev.dv_xname, error);
+                   device_xname(self), error);
                bus_dmamem_free(dmatag, &seg, rseg);
                return;
        }
@@ -320,7 +320,7 @@
                                     sc->sc_maddr, memsize, NULL,
                                     BUS_DMA_NOWAIT)) != 0) {
                printf("%s: DMA buffer map load error %d\n",
-                       sc->sc_dev.dv_xname, error);
+                   device_xname(self), error);
                bus_dmamem_unmap(dmatag, sc->sc_maddr, memsize);
                bus_dmamem_free(dmatag, &seg, rseg);
                return;
diff -r 666ef66f6154 -r 7317e94021a3 sys/arch/sparc/dev/rtc.c
--- a/sys/arch/sparc/dev/rtc.c  Sun Sep 20 14:00:24 2009 +0000
+++ b/sys/arch/sparc/dev/rtc.c  Sun Sep 20 16:18:21 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtc.c,v 1.14 2006/09/04 23:45:30 gdamore Exp $ */
+/*     $NetBSD: rtc.c,v 1.15 2009/09/20 16:18:21 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2001 Valeriy E. Ushakov
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.14 2006/09/04 23:45:30 gdamore Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.15 2009/09/20 16:18:21 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -61,8 +61,8 @@
        bus_space_handle_t      sc_bh;  /* handle for registers */
 };
 
-static int     rtcmatch_ebus(struct device *, struct cfdata *, void *);
-static void    rtcattach_ebus(struct device *, struct device *, void *);
+static int     rtcmatch_ebus(device_t, cfdata_t, void *);
+static void    rtcattach_ebus(device_t, device_t, void *);
 
 CFATTACH_DECL(rtc_ebus, sizeof(struct rtc_ebus_softc),
     rtcmatch_ebus, rtcattach_ebus, NULL, NULL);
@@ -103,7 +103,7 @@
 
 
 static int
-rtcmatch_ebus(struct device *parent, struct cfdata *cf, void *aux)
+rtcmatch_ebus(device_t parent, cfdata_t cf, void *aux)
 {
        struct ebus_attach_args *ea = aux;
 
@@ -111,11 +111,10 @@
 }



Home | Main Index | Thread Index | Old Index