Source-Changes-HG archive

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

[src/trunk]: src/sys/arch struct device * -> device_t



details:   https://anonhg.NetBSD.org/src/rev/4955bf24eee2
branches:  trunk
changeset: 766189:4955bf24eee2
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Jun 18 08:08:27 2011 +0000

description:
struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more

diffstat:

 sys/arch/amigappc/amigappc/autoconf.c    |  20 ++++----
 sys/arch/bebox/bebox/autoconf.c          |   6 +-
 sys/arch/evbppc/ev64260/autoconf.c       |  10 ++--
 sys/arch/evbppc/pmppc/mainbus.c          |  11 ++--
 sys/arch/ibmnws/ibmnws/autoconf.c        |   4 +-
 sys/arch/macppc/dev/abtn.c               |  14 +++---
 sys/arch/macppc/dev/adb.c                |  14 +++---
 sys/arch/macppc/dev/aed.c                |  14 +++---
 sys/arch/macppc/dev/akbd.c               |  14 +++---
 sys/arch/macppc/dev/ams.c                |  14 +++---
 sys/arch/macppc/dev/apm.c                |  12 ++--
 sys/arch/macppc/dev/battery.c            |  31 ++++++-------
 sys/arch/macppc/dev/cuda.c               |  22 ++++----
 sys/arch/macppc/dev/gpio.c               |  20 ++++----
 sys/arch/macppc/dev/if_bm.c              |  72 ++++++++++++++++---------------
 sys/arch/macppc/dev/if_gm.c              |  62 ++++++++++++++-------------
 sys/arch/macppc/dev/if_mc.c              |  14 +++---
 sys/arch/macppc/dev/if_wi_obio.c         |  10 ++--
 sys/arch/macppc/dev/ki2c.c               |  12 ++--
 sys/arch/macppc/dev/mediabay.c           |  18 ++++----
 sys/arch/macppc/dev/nvram.c              |  14 +++---
 sys/arch/macppc/dev/obio.c               |  14 +++---
 sys/arch/macppc/dev/ofb.c                |  14 +++---
 sys/arch/macppc/dev/ofcons.c             |  12 ++--
 sys/arch/macppc/dev/pmu.c                |  60 ++++++++++++--------------
 sys/arch/macppc/dev/smartbat.c           |  14 +++---
 sys/arch/macppc/dev/uni-n.c              |  14 +++---
 sys/arch/macppc/include/autoconf.h       |   4 +-
 sys/arch/macppc/include/pci_machdep.h    |   4 +-
 sys/arch/macppc/macppc/machdep.c         |   6 +-
 sys/arch/macppc/macppc/memory.c          |  14 +++---
 sys/arch/macppc/pci/bandit.c             |  14 +++---
 sys/arch/macppc/pci/grackle.c            |  14 +++---
 sys/arch/macppc/pci/pci_machdep.c        |   6 +-
 sys/arch/macppc/pci/u3.c                 |  10 ++--
 sys/arch/macppc/pci/uninorth.c           |  14 +++---
 sys/arch/mvmeppc/include/platform.h      |   4 +-
 sys/arch/mvmeppc/mvmeppc/autoconf.c      |   8 +-
 sys/arch/mvmeppc/mvmeppc/platform_160x.c |   8 +-
 sys/arch/ofppc/include/autoconf.h        |   4 +-
 sys/arch/ofppc/ofppc/machdep.c           |   6 +-
 sys/arch/ofppc/pci/ofwpci.c              |  20 ++++----
 sys/arch/prep/eisa/eisa_machdep.c        |   6 +-
 sys/arch/prep/include/eisa_machdep.h     |   4 +-
 sys/arch/prep/include/gtenvar.h          |   4 +-
 sys/arch/prep/include/platform.h         |   6 +-
 sys/arch/prep/pci/gten.c                 |  21 ++++----
 sys/arch/prep/pci/pceb.c                 |   6 +-
 sys/arch/prep/pci/prep_pciconf_direct.c  |   8 +-
 sys/arch/prep/pnpbus/if_we_pnpbus.c      |  14 +++---
 sys/arch/prep/pnpbus/nvram_pnpbus.c      |  14 +++---
 sys/arch/prep/pnpbus/pnpbus.c            |  23 ++++-----
 sys/arch/prep/pnpbus/pnpbusvar.h         |   4 +-
 sys/arch/prep/prep/autoconf.c            |  16 +++---
 sys/arch/prep/prep/platform.c            |   6 +-
 sys/arch/rs6000/include/mca_machdep.h    |   5 +-
 sys/arch/rs6000/ioplanar/ioplanarvar.h   |   2 +-
 sys/arch/rs6000/mca/ioplanar.c           |  23 ++++-----
 sys/arch/rs6000/mca/mca_machdep.c        |   7 +-
 sys/arch/rs6000/rs6000/autoconf.c        |   8 +-
 sys/arch/sandpoint/include/pci_machdep.h |   4 +-
 sys/arch/sandpoint/pci/pci_machdep.c     |   7 +-
 sys/arch/sandpoint/pci/pciide_machdep.c  |   8 +-
 sys/arch/sandpoint/sandpoint/autoconf.c  |  16 +++---
 sys/arch/sandpoint/sandpoint/iic_eumb.c  |   8 +-
 65 files changed, 443 insertions(+), 449 deletions(-)

diffs (truncated from 3210 to 300 lines):

diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/amigappc/amigappc/autoconf.c
--- a/sys/arch/amigappc/amigappc/autoconf.c     Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/amigappc/amigappc/autoconf.c     Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.3 2010/05/21 12:52:14 phx Exp $ */
+/*     $NetBSD: autoconf.c,v 1.4 2011/06/18 08:08:27 matt Exp $        */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2010/05/21 12:52:14 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2011/06/18 08:08:27 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -43,8 +43,7 @@
 #include <sys/disk.h>
 #include <sys/proc.h>
 #include <sys/kernel.h>
-
-#include <machine/cpu.h>
+#include <sys/cpu.h>
 
 #include <amiga/amiga/cfdev.h>
 #include <amiga/amiga/device.h>
@@ -126,11 +125,10 @@
  * by checking for NULL.
  */
 int
-amiga_config_found(struct cfdata *pcfp, struct device *pdp, void *auxp,
-    cfprint_t pfn)
+amiga_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn)
 {
        struct device temp;
-       struct cfdata *cf;
+       cfdata_t cf;
        const struct cfattach *ca;
 
        if (amiga_realconfig)
@@ -165,7 +163,7 @@
 void
 config_console(void)
 {
-       struct cfdata *cf;
+       cfdata_t cf;
 
        config_init();
 
@@ -241,7 +239,7 @@
 {
        struct disk *dkp;
        struct partition *pp;
-       struct device **devs;
+       device_t*devs;
        int i, maj, unit;
        const struct bdevsw *bdp;
 
@@ -266,7 +264,7 @@
                         * Find the disk corresponding to the current
                         * device.
                         */
-                       devs = (struct device **)sd_cd.cd_devs;
+                       devs = (device_t*)sd_cd.cd_devs;
                        if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
                                continue;
 
@@ -315,7 +313,7 @@
                         * Find the disk structure corresponding to the
                         * current device.
                         */
-                       devs = (struct device **)genericconf[i]->cd_devs;
+                       devs = (device_t*)genericconf[i]->cd_devs;
                        if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
                                continue;
 
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/bebox/bebox/autoconf.c
--- a/sys/arch/bebox/bebox/autoconf.c   Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/bebox/bebox/autoconf.c   Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.23 2010/10/27 10:42:12 kiyohara Exp $   */
+/*     $NetBSD: autoconf.c,v 1.24 2011/06/18 08:08:27 matt Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2010/10/27 10:42:12 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.24 2011/06/18 08:08:27 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,7 +98,7 @@
 {
 
        aprint_normal("boot device: %s\n",
-           booted_device ? booted_device->dv_xname : "<unknown>");
+           booted_device ? device_xname(booted_device) : "<unknown>");
 
        setroot(booted_device, booted_partition);
 }
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/evbppc/ev64260/autoconf.c
--- a/sys/arch/evbppc/ev64260/autoconf.c        Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/evbppc/ev64260/autoconf.c        Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.15 2011/06/18 06:44:25 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.16 2011/06/18 08:08:27 matt Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2011/06/18 06:44:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.16 2011/06/18 08:08:27 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -140,7 +140,7 @@
                case ETH2_BASE: enaddr[5] |= 2; break;
                default:
                        aprint_error("WARNING: unknown mac-no. for %s\n",
-                           dev->dv_xname);
+                           device_xname(dev));
                }
 
                mac = prop_data_create_data_nocopy(enaddr, ETHER_ADDR_LEN);
@@ -148,7 +148,7 @@
                if (prop_dictionary_set(dict, "mac-addr", mac) == false)
                        aprint_error(
                            "WARNING: unable to set mac-addr property for %s\n",
-                           dev->dv_xname);
+                           device_xname(dev));
                prop_object_release(mac);
        }
        if (device_is_a(dev, "gtpci")) {
@@ -219,7 +219,7 @@
                if (prop_dictionary_set(dict, "bus-tag", bstd) == false)
                        aprint_error(
                            "WARNING: unable to set bus-tag property for %s\n",
-                           dev->dv_xname);
+                           device_xname(dev));
                prop_object_release(bstd);
        }
 }
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/evbppc/pmppc/mainbus.c
--- a/sys/arch/evbppc/pmppc/mainbus.c   Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/evbppc/pmppc/mainbus.c   Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:18 matt Exp $ */
+/*     $NetBSD: mainbus.c,v 1.5 2011/06/18 08:08:27 matt Exp $ */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2011/06/18 08:08:27 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -101,11 +101,10 @@
 {
        struct mainbus_attach_args maa;
 
-       printf(": Artesyn PM/PPC\n");
-       printf("%s: %sPCI bus Monarch\n", self->dv_xname,
+       aprint_normal(": Artesyn PM/PPC\n");
+       aprint_normal_dev(self, "%sPCI bus Monarch\n",
               a_config.a_is_monarch ? "" : "not");
-       printf("%s: boot from %s, %sECC, %s L2 cache\n",
-              self->dv_xname,
+       aprint_normal_dev(self, "boot from %s, %sECC, %s L2 cache\n",
               a_config.a_boot_device == A_BOOT_ROM ? "ROM" : "flash",
               a_config.a_has_ecc ? "" : "no ",
               a_config.a_l2_cache == A_CACHE_PARITY ? "parity" :
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/ibmnws/ibmnws/autoconf.c
--- a/sys/arch/ibmnws/ibmnws/autoconf.c Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/ibmnws/ibmnws/autoconf.c Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.10 2008/11/03 15:13:16 rjs Exp $        */
+/*     $NetBSD: autoconf.c,v 1.11 2011/06/18 08:08:28 matt Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,7 +81,7 @@
        findroot();
 
        aprint_normal("boot device: %s\n",
-           booted_device ? booted_device->dv_xname : "<unknown>");
+           booted_device ? device_xname(booted_device) : "<unknown>");
 
        setroot(booted_device, booted_partition);
 }
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/macppc/dev/abtn.c
--- a/sys/arch/macppc/dev/abtn.c        Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/macppc/dev/abtn.c        Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: abtn.c,v 1.17 2009/03/14 21:04:11 dsl Exp $    */
+/*     $NetBSD: abtn.c,v 1.18 2011/06/18 08:08:28 matt Exp $   */
 
 /*-
  * Copyright (C) 1999 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: abtn.c,v 1.17 2009/03/14 21:04:11 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: abtn.c,v 1.18 2011/06/18 08:08:28 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -61,15 +61,15 @@
        int volume;             /* speaker volume (not yet) */
 };
 
-static int abtn_match(struct device *, struct cfdata *, void *);
-static void abtn_attach(struct device *, struct device *, void *);
+static int abtn_match(device_t, cfdata_t, void *);
+static void abtn_attach(device_t, device_t, void *);
 static void abtn_adbcomplete(uint8_t *, uint8_t *, int);
 
 CFATTACH_DECL(abtn, sizeof(struct abtn_softc),
     abtn_match, abtn_attach, NULL, NULL);
 
 int
-abtn_match(struct device *parent, struct cfdata *cf, void *aux)
+abtn_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct adb_attach_args *aa = aux;
 
@@ -81,9 +81,9 @@
 }
 
 void
-abtn_attach(struct device *parent, struct device *self, void *aux)
+abtn_attach(device_t parent, device_t self, void *aux)
 {
-       struct abtn_softc *sc = (struct abtn_softc *)self;
+       struct abtn_softc *sc = device_private(self);
        struct adb_attach_args *aa = aux;
        ADBSetInfoBlock adbinfo;
        int bright;
diff -r 04aa833f0f16 -r 4955bf24eee2 sys/arch/macppc/dev/adb.c
--- a/sys/arch/macppc/dev/adb.c Sat Jun 18 06:44:25 2011 +0000
+++ b/sys/arch/macppc/dev/adb.c Sat Jun 18 08:08:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb.c,v 1.29 2009/12/12 14:44:09 tsutsui Exp $ */
+/*     $NetBSD: adb.c,v 1.30 2011/06/18 08:08:28 matt Exp $    */
 
 /*-
  * Copyright (C) 1994  Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.29 2009/12/12 14:44:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.30 2011/06/18 08:08:28 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -55,8 +55,8 @@
 /*
  * Function declarations.
  */
-static int     adbmatch(struct device *, struct cfdata *, void *);
-static void    adbattach(struct device *, struct device *, void *);
+static int     adbmatch(device_t, cfdata_t, void *);
+static void    adbattach(device_t, device_t, void *);
 static int     adbprint(void *, const char *);
 static void    adb_todr_init(void);
 
@@ -76,7 +76,7 @@
     adbmatch, adbattach, NULL, NULL);
 
 static int
-adbmatch(struct device *parent, struct cfdata *cf, void *aux)
+adbmatch(device_t parent, cfdata_t cf, void *aux)
 {
        struct confargs *ca = aux;
 
@@ -96,9 +96,9 @@
 }
 
 static void
-adbattach(struct device *parent, struct device *self, void *aux)
+adbattach(device_t parent, device_t self, void *aux)
 {
-       struct adb_softc *sc = (struct adb_softc *)self;
+       struct adb_softc *sc = device_private(self);
        struct confargs *ca = aux;
        int irq = ca->ca_intr[0];
        int node;



Home | Main Index | Thread Index | Old Index