Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc struct device * -> device_t
details: https://anonhg.NetBSD.org/src/rev/0c534ac1a431
branches: trunk
changeset: 766172:0c534ac1a431
user: matt <matt%NetBSD.org@localhost>
date: Fri Jun 17 19:03:00 2011 +0000
description:
struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
diffstat:
sys/arch/powerpc/booke/booke_autoconf.c | 6 +-
sys/arch/powerpc/booke/dev/pq3etsec.c | 11 +-
sys/arch/powerpc/ibm4xx/dev/comopbvar.h | 4 +-
sys/arch/powerpc/ibm4xx/dev/ecc_plb.c | 35 +++--
sys/arch/powerpc/ibm4xx/dev/exb.c | 10 +-
sys/arch/powerpc/ibm4xx/dev/gpiic_opb.c | 43 +++---
sys/arch/powerpc/ibm4xx/dev/gpio_opb.c | 154 ++++++++++++-------------
sys/arch/powerpc/ibm4xx/dev/if_emac.c | 27 ++--
sys/arch/powerpc/ibm4xx/dev/wdog.c | 39 +++---
sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c | 10 +-
sys/arch/powerpc/ibm4xx/pci/pchb.c | 8 +-
sys/arch/powerpc/ibm4xx/pci/pci_machdep.c | 6 +-
sys/arch/powerpc/include/ibm4xx/cpu.h | 6 +-
sys/arch/powerpc/include/ibm4xx/pci_machdep.h | 4 +-
sys/arch/powerpc/include/isa_machdep.h | 7 +-
sys/arch/powerpc/oea/cpu_subr.c | 63 +++++-----
sys/arch/powerpc/oea/ofw_autoconf.c | 10 +-
sys/arch/powerpc/pci/pchb.c | 26 ++--
sys/arch/powerpc/pci/pci_machdep_common.c | 10 +-
sys/arch/powerpc/pci/pcib.c | 9 +-
sys/arch/powerpc/pci/pciconf_indirect.c | 6 +-
sys/arch/powerpc/pci/pciconf_ofmethod.c | 6 +-
sys/arch/powerpc/powerpc/powerpc_machdep.c | 10 +-
sys/arch/powerpc/powerpc/rtas.c | 20 +-
24 files changed, 262 insertions(+), 268 deletions(-)
diffs (truncated from 1476 to 300 lines):
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/booke/booke_autoconf.c
--- a/sys/arch/powerpc/booke/booke_autoconf.c Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/booke/booke_autoconf.c Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: booke_autoconf.c,v 1.2 2011/01/18 01:02:52 matt Exp $ */
+/* $NetBSD: booke_autoconf.c,v 1.3 2011/06/17 19:03:03 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: booke_autoconf.c,v 1.2 2011/01/18 01:02:52 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_autoconf.c,v 1.3 2011/06/17 19:03:03 matt Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -73,7 +73,7 @@
if (prop_dictionary_set(device_properties(dev),
"mac-address", pd) == false) {
printf("WARNING: unable to set mac-addr "
- "property for %s\n", dev->dv_xname);
+ "property for %s\n", device_xname(dev));
}
}
return;
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/booke/dev/pq3etsec.c
--- a/sys/arch/powerpc/booke/dev/pq3etsec.c Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3etsec.c Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3etsec.c,v 1.4 2011/06/12 05:37:54 matt Exp $ */
+/* $NetBSD: pq3etsec.c,v 1.5 2011/06/17 19:03:03 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -458,6 +458,7 @@
struct pq3etsec_softc * const sc = device_private(self);
struct cpunode_attach_args * const cna = aux;
struct cpunode_locators * const cnl = &cna->cna_locs;
+ cfdata_t cf = device_cfdata(self);
int error;
psc->sc_children |= cna->cna_childmask;
@@ -468,15 +469,13 @@
/*
* If we have a common MDIO bus, if all off instance 1.
*/
- device_t miiself = (self->dv_cfdata->cf_flags & 0x100)
- ? tsec_cd.cd_devs[0]
- : self;
+ device_t miiself = (cf->cf_flags & 0x100) ? tsec_cd.cd_devs[0] : self;
/*
* See if the phy is in the config file...
*/
- if (self->dv_cfdata->cf_flags & 0x3f) {
- sc->sc_phy_addr = (self->dv_cfdata->cf_flags & 0x3f) - 1;
+ if (cf->cf_flags & 0x3f) {
+ sc->sc_phy_addr = (cf->cf_flags & 0x3f) - 1;
} else {
unsigned char prop_name[20];
snprintf(prop_name, sizeof(prop_name), "tsec%u-phy-addr",
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/ibm4xx/dev/comopbvar.h
--- a/sys/arch/powerpc/ibm4xx/dev/comopbvar.h Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/comopbvar.h Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: comopbvar.h,v 1.2 2005/12/11 12:18:42 christos Exp $ */
+/* $NetBSD: comopbvar.h,v 1.3 2011/06/17 19:03:01 matt Exp $ */
/*
* Copyright (c) 2004 Shigeyuki Fukushima.
@@ -37,6 +37,6 @@
#include <sys/device.h>
extern void com_opb_cnattach(int, int, int, int);
-extern void com_opb_device_register(struct device *, int);
+extern void com_opb_device_register(device_t, int);
#endif /* __IBM4XX_COMOPBVAR_H__ */
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/ibm4xx/dev/ecc_plb.c
--- a/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ecc_plb.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $ */
+/* $NetBSD: ecc_plb.c,v 1.13 2011/06/17 19:03:01 matt Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.13 2011/06/17 19:03:01 matt Exp $");
#include "locators.h"
@@ -52,26 +52,26 @@
struct ecc_plb_softc {
- struct device sc_dev;
- u_quad_t sc_ecc_tb;
- u_quad_t sc_ecc_iv; /* Interval */
- u_int32_t sc_ecc_cnt;
+ device_t sc_dev;
+ uint64_t sc_ecc_tb;
+ uint64_t sc_ecc_iv; /* Interval */
+ uint32_t sc_ecc_cnt;
u_int sc_memsize;
int sc_irq;
};
-static int ecc_plbmatch(struct device *, struct cfdata *, void *);
-static void ecc_plbattach(struct device *, struct device *, void *);
-static void ecc_plb_deferred(struct device *);
+static int ecc_plbmatch(device_t, cfdata_t, void *);
+static void ecc_plbattach(device_t, device_t, void *);
+static void ecc_plb_deferred(device_t);
static int ecc_plb_intr(void *);
-CFATTACH_DECL(ecc_plb, sizeof(struct ecc_plb_softc),
+CFATTACH_DECL_NEW(ecc_plb, sizeof(struct ecc_plb_softc),
ecc_plbmatch, ecc_plbattach, NULL, NULL);
static int ecc_plb_found;
static int
-ecc_plbmatch(struct device *parent, struct cfdata *cf, void *aux)
+ecc_plbmatch(device_t parent, cfdata_t cf, void *aux)
{
struct plb_attach_args *paa = aux;
@@ -87,9 +87,9 @@
}
static void
-ecc_plbattach(struct device *parent, struct device *self, void *aux)
+ecc_plbattach(device_t parent, device_t self, void *aux)
{
- struct ecc_plb_softc *sc = (struct ecc_plb_softc *)self;
+ struct ecc_plb_softc *sc = device_private(self);
struct plb_attach_args *paa = aux;
unsigned int processor_freq;
unsigned int memsiz;
@@ -105,8 +105,9 @@
KASSERT(pn != NULL);
memsiz = (unsigned int) prop_number_integer_value(pn);
- printf(": ECC controller\n");
+ aprint_normal(": ECC controller\n");
+ sc->sc_dev = self;
sc->sc_ecc_tb = 0;
sc->sc_ecc_cnt = 0;
sc->sc_ecc_iv = processor_freq; /* Set interval */
@@ -121,11 +122,11 @@
}
static void
-ecc_plb_deferred(struct device *self)
+ecc_plb_deferred(device_t self)
{
- struct ecc_plb_softc *sc = (struct ecc_plb_softc *)self;
+ struct ecc_plb_softc *sc = device_private(self);
- intr_establish(sc->sc_irq, IST_LEVEL, IPL_SERIAL, ecc_plb_intr, NULL);
+ intr_establish(sc->sc_irq, IST_LEVEL, IPL_SERIAL, ecc_plb_intr, sc);
}
/*
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/ibm4xx/dev/exb.c
--- a/sys/arch/powerpc/ibm4xx/dev/exb.c Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/exb.c Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $Id: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $ */
+/* $Id: exb.c,v 1.3 2011/06/17 19:03:02 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exb.c,v 1.2 2010/11/06 16:30:15 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exb.c,v 1.3 2011/06/17 19:03:02 matt Exp $");
#include "locators.h"
@@ -48,8 +48,8 @@
extern const struct exb_conf exb_confs[];
-static int exb_match(device_t, struct cfdata *, void *);
-static void exb_attach(device_t, struct device *, void *);
+static int exb_match(device_t, cfdata_t, void *);
+static void exb_attach(device_t, device_t, void *);
static int exb_print(void *, const char *);
CFATTACH_DECL_NEW(exb, sizeof(struct exb_softc), exb_match, exb_attach,
@@ -59,7 +59,7 @@
{ _BUS_SPACE_BIG_ENDIAN | _BUS_SPACE_MEM_TYPE, 0 };
static int
-exb_match(device_t parent, struct cfdata *cf, void *aux)
+exb_match(device_t parent, cfdata_t cf, void *aux)
{
return 1;
diff -r 31c691b742cc -r 0c534ac1a431 sys/arch/powerpc/ibm4xx/dev/gpiic_opb.c
--- a/sys/arch/powerpc/ibm4xx/dev/gpiic_opb.c Fri Jun 17 18:59:33 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/gpiic_opb.c Fri Jun 17 19:03:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiic_opb.c,v 1.7 2011/06/12 07:19:49 kiyohara Exp $ */
+/* $NetBSD: gpiic_opb.c,v 1.8 2011/06/17 19:03:02 matt Exp $ */
/*
* Copyright 2002, 2003 Wasabi Systems, Inc.
@@ -51,7 +51,7 @@
#include <powerpc/ibm4xx/dev/gpiicreg.h>
struct gpiic_softc {
- struct device sc_dev;
+ device_t sc_dev;
bus_space_tag_t sc_bust;
bus_space_handle_t sc_bush;
uint8_t sc_txen;
@@ -61,10 +61,10 @@
kmutex_t sc_buslock;
};
-static int gpiic_match(struct device *, struct cfdata *, void *);
-static void gpiic_attach(struct device *, struct device *, void *);
+static int gpiic_match(device_t, cfdata_t, void *);
+static void gpiic_attach(device_t, device_t, void *);
-CFATTACH_DECL(gpiic, sizeof(struct gpiic_softc),
+CFATTACH_DECL_NEW(gpiic, sizeof(struct gpiic_softc),
gpiic_match, gpiic_attach, NULL, NULL);
static int gpiic_acquire_bus(void *, int);
@@ -79,9 +79,9 @@
static uint32_t gpiic_read_bits(void *);
static int
-gpiic_match(struct device *parent, struct cfdata *cf, void *args)
+gpiic_match(device_t parent, cfdata_t cf, void *args)
{
- struct opb_attach_args *oaa = args;
+ struct opb_attach_args * const oaa = args;
if (strcmp(oaa->opb_name, cf->cf_name) != 0)
return 0;
@@ -90,15 +90,16 @@
}
static void
-gpiic_attach(struct device *parent, struct device *self, void *args)
+gpiic_attach(device_t parent, device_t self, void *args)
{
- struct gpiic_softc *sc = (struct gpiic_softc *)self;
- struct opb_attach_args *oaa = args;
+ struct gpiic_softc * const sc = device_private(self);
+ struct opb_attach_args * const oaa = args;
struct i2cbus_attach_args iba;
aprint_naive(": IIC controller\n");
aprint_normal(": On-Chip IIC controller\n");
+ sc->sc_dev = self;
sc->sc_bust = oaa->opb_bt;
bus_space_map(sc->sc_bust, oaa->opb_addr, IIC_NREG, 0, &sc->sc_bush);
@@ -137,13 +138,13 @@
memset(&iba, 0, sizeof(iba));
iba.iba_tag = &sc->sc_i2c;
- (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print);
+ (void) config_found_ia(self, "i2cbus", &iba, iicbus_print);
}
static int
gpiic_acquire_bus(void *arg, int flags)
{
- struct gpiic_softc *sc = arg;
+ struct gpiic_softc * const sc = arg;
if (flags & I2C_F_POLL)
return (0);
@@ -155,7 +156,7 @@
static void
gpiic_release_bus(void *arg, int flags)
{
- struct gpiic_softc *sc = arg;
+ struct gpiic_softc * const sc = arg;
if (flags & I2C_F_POLL)
return;
@@ -166,7 +167,7 @@
Home |
Main Index |
Thread Index |
Old Index