diff options
| author | tsutsui <tsutsui@NetBSD.org> | 2011-06-04 01:43:56 +0000 |
|---|---|---|
| committer | tsutsui <tsutsui@NetBSD.org> | 2011-06-04 01:43:56 +0000 |
| commit | 206daba1fa8d0af70c1e29966876c9d0c44fbbbc (patch) | |
| tree | f7fc115985555469a2b58735e4fd4dc726c5f028 /sys | |
| parent | fec91cc5e4a071e414711d4ab3d6f1c364b58090 (diff) | |
Split device_t/softc. Tested on GXemul.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/pmax/ibus/mcclock_ibus.c | 7 | ||||
| -rw-r--r-- | sys/arch/pmax/pmax/clock.c | 10 | ||||
| -rw-r--r-- | sys/arch/pmax/tc/mcclock_ioasic.c | 19 | ||||
| -rw-r--r-- | sys/dev/dec/mcclock.c | 22 | ||||
| -rw-r--r-- | sys/dev/dec/mcclockvar.h | 4 |
5 files changed, 31 insertions, 31 deletions
diff --git a/sys/arch/pmax/ibus/mcclock_ibus.c b/sys/arch/pmax/ibus/mcclock_ibus.c index 120c59a0763..492ec6a5144 100644 --- a/sys/arch/pmax/ibus/mcclock_ibus.c +++ b/sys/arch/pmax/ibus/mcclock_ibus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_ibus.c,v 1.17 2011/02/20 07:50:24 matt Exp $ */ +/* $NetBSD: mcclock_ibus.c,v 1.18 2011/06/04 01:43:56 tsutsui Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock_ibus.c,v 1.17 2011/02/20 07:50:24 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock_ibus.c,v 1.18 2011/06/04 01:43:56 tsutsui Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_ibus.c,v 1.17 2011/02/20 07:50:24 matt Exp $ static int mcclock_ibus_match(device_t, cfdata_t, void *); static void mcclock_ibus_attach(device_t, device_t, void *); -CFATTACH_DECL(mcclock_ibus, sizeof (struct mcclock_pad32_softc), +CFATTACH_DECL_NEW(mcclock_ibus, sizeof (struct mcclock_pad32_softc), mcclock_ibus_match, mcclock_ibus_attach, NULL, NULL); static int @@ -67,6 +67,7 @@ mcclock_ibus_attach(device_t parent, device_t self, void *aux) struct ibus_attach_args *ia = aux; struct mcclock_pad32_softc *sc = device_private(self); + sc->sc_mcclock.sc_dev = self; sc->sc_dp = (struct mcclock_pad32_clockdatum*)ia->ia_addr; /* Attach MI driver, using busfns with TC-style register padding */ diff --git a/sys/arch/pmax/pmax/clock.c b/sys/arch/pmax/pmax/clock.c index 95f01b23f0c..02aa8c0b3ba 100644 --- a/sys/arch/pmax/pmax/clock.c +++ b/sys/arch/pmax/pmax/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.38 2011/02/08 20:20:22 rmind Exp $ */ +/* $NetBSD: clock.c,v 1.39 2011/06/04 01:43:56 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.38 2011/02/08 20:20:22 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.39 2011/06/04 01:43:56 tsutsui Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.38 2011/02/08 20:20:22 rmind Exp $"); #include "opt_ntp.h" -struct device *clockdev; +device_t clockdev; const struct clockfns *clockfns; int clockinitted; @@ -61,7 +61,7 @@ extern int fixtick; /* XXX */ #endif void -clockattach(struct device *dev, const struct clockfns *fns) +clockattach(device_t dev, const struct clockfns *fns) { /* @@ -75,7 +75,7 @@ clockattach(struct device *dev, const struct clockfns *fns) clockfns = fns; #ifdef EVCNT_COUNTERS evcnt_attach_dynamic(&clock_intr_evcnt, EVCNT_TYPE_INTR, NULL, - dev->dv_xname, "intr"); + device_xname(dev), "intr"); #endif } diff --git a/sys/arch/pmax/tc/mcclock_ioasic.c b/sys/arch/pmax/tc/mcclock_ioasic.c index 42a8da13de5..81dbc052a77 100644 --- a/sys/arch/pmax/tc/mcclock_ioasic.c +++ b/sys/arch/pmax/tc/mcclock_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_ioasic.c,v 1.22 2009/03/14 21:04:14 dsl Exp $ */ +/* $NetBSD: mcclock_ioasic.c,v 1.23 2011/06/04 01:43:56 tsutsui Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mcclock_ioasic.c,v 1.22 2009/03/14 21:04:14 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock_ioasic.c,v 1.23 2011/06/04 01:43:56 tsutsui Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -41,16 +41,14 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_ioasic.c,v 1.22 2009/03/14 21:04:14 dsl Exp #include <dev/tc/tcvar.h> #include <dev/tc/ioasicvar.h> -static int mcclock_ioasic_match(struct device *, struct cfdata *, - void *); -static void mcclock_ioasic_attach(struct device *, struct device *, - void *); +static int mcclock_ioasic_match(device_t, cfdata_t, void *); +static void mcclock_ioasic_attach(device_t, device_t, void *); -CFATTACH_DECL(mcclock_ioasic, sizeof (struct mcclock_pad32_softc), +CFATTACH_DECL_NEW(mcclock_ioasic, sizeof (struct mcclock_pad32_softc), mcclock_ioasic_match, mcclock_ioasic_attach, NULL, NULL); static int -mcclock_ioasic_match(struct device *parent, struct cfdata *match, void *aux) +mcclock_ioasic_match(device_t parent, cfdata_t cf, void *aux) { struct ioasicdev_attach_args *d = aux; @@ -64,11 +62,12 @@ mcclock_ioasic_match(struct device *parent, struct cfdata *match, void *aux) } static void -mcclock_ioasic_attach(struct device *parent, struct device *self, void *aux) +mcclock_ioasic_attach(device_t parent, device_t self, void *aux) { struct ioasicdev_attach_args *ioasicdev = aux; - struct mcclock_pad32_softc *sc = (struct mcclock_pad32_softc *)self; + struct mcclock_pad32_softc *sc = device_private(self); + sc->sc_mcclock.sc_dev = self; sc->sc_dp = (struct mcclock_pad32_clockdatum *)ioasicdev->iada_addr; /* Attach MI driver, using busfns with TC-style register padding */ diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c index de2b19e97e8..8a23f83d126 100644 --- a/sys/dev/dec/mcclock.c +++ b/sys/dev/dec/mcclock.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock.c,v 1.26 2011/04/06 14:51:12 tsutsui Exp $ */ +/* $NetBSD: mcclock.c,v 1.27 2011/06/04 01:43:56 tsutsui Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.26 2011/04/06 14:51:12 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.27 2011/06/04 01:43:56 tsutsui Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -59,10 +59,10 @@ const struct clockfns mcclock_clockfns = { mcclock_init, }; -#define mc146818_write(dev, reg, datum) \ - (*(dev)->sc_busfns->mc_bf_write)(dev, reg, datum) -#define mc146818_read(dev, reg) \ - (*(dev)->sc_busfns->mc_bf_read)(dev, reg) +#define mc146818_write(sc, reg, datum) \ + (*(sc)->sc_busfns->mc_bf_write)(sc, reg, datum) +#define mc146818_read(sc, reg) \ + (*(sc)->sc_busfns->mc_bf_read)(sc, reg) void mcclock_attach(struct mcclock_softc *sc, const struct mcclock_busfns *busfns) @@ -75,7 +75,7 @@ mcclock_attach(struct mcclock_softc *sc, const struct mcclock_busfns *busfns) /* Turn interrupts off, just in case. */ mc146818_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR); - clockattach(&sc->sc_dev, &mcclock_clockfns); + clockattach(sc->sc_dev, &mcclock_clockfns); sc->sc_todr.todr_gettime = mcclock_get; sc->sc_todr.todr_settime = mcclock_set; @@ -86,7 +86,7 @@ mcclock_attach(struct mcclock_softc *sc, const struct mcclock_busfns *busfns) void mcclock_init(device_t dev) { - struct mcclock_softc *sc = (struct mcclock_softc *)dev; + struct mcclock_softc *sc = device_private(dev); int rate; again: @@ -126,7 +126,7 @@ again: break; default: printf("%s: Cannot get %d Hz clock; using %d Hz\n", - device_xname(&sc->sc_dev), hz, MC_DEFAULTHZ); + device_xname(dev), hz, MC_DEFAULTHZ); hz = MC_DEFAULTHZ; goto again; } @@ -151,7 +151,7 @@ again: int mcclock_get(todr_chip_handle_t tch, struct timeval *tvp) { - struct mcclock_softc *sc = (struct mcclock_softc *)tch->cookie; + struct mcclock_softc *sc = tch->cookie; uint32_t yearsecs; mc_todregs regs; int s; @@ -197,7 +197,7 @@ mcclock_get(todr_chip_handle_t tch, struct timeval *tvp) int mcclock_set(todr_chip_handle_t tch, struct timeval *tvp) { - struct mcclock_softc *sc = (struct mcclock_softc *)tch->cookie; + struct mcclock_softc *sc = tch->cookie; struct clock_ymdhms dt; uint32_t yearsecs; mc_todregs regs; diff --git a/sys/dev/dec/mcclockvar.h b/sys/dev/dec/mcclockvar.h index f7e3f63107a..701b2676955 100644 --- a/sys/dev/dec/mcclockvar.h +++ b/sys/dev/dec/mcclockvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: mcclockvar.h,v 1.7 2008/01/03 23:02:25 joerg Exp $ */ +/* $NetBSD: mcclockvar.h,v 1.8 2011/06/04 01:43:56 tsutsui Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ struct mcclock_softc { - struct device sc_dev; + device_t sc_dev; const struct mcclock_busfns *sc_busfns; struct todr_chip_handle sc_todr; }; |
