Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Split device_t/softc. Tested on GXemul.
details: https://anonhg.NetBSD.org/src/rev/670656aa90ad
branches: trunk
changeset: 765726:670656aa90ad
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Jun 04 01:43:56 2011 +0000
description:
Split device_t/softc. Tested on GXemul.
diffstat:
sys/arch/pmax/ibus/mcclock_ibus.c | 7 ++++---
sys/arch/pmax/pmax/clock.c | 10 +++++-----
sys/arch/pmax/tc/mcclock_ioasic.c | 19 +++++++++----------
sys/dev/dec/mcclock.c | 22 +++++++++++-----------
sys/dev/dec/mcclockvar.h | 4 ++--
5 files changed, 31 insertions(+), 31 deletions(-)
diffs (230 lines):
diff -r 4c8d1ebd092d -r 670656aa90ad sys/arch/pmax/ibus/mcclock_ibus.c
--- a/sys/arch/pmax/ibus/mcclock_ibus.c Sat Jun 04 01:37:36 2011 +0000
+++ b/sys/arch/pmax/ibus/mcclock_ibus.c Sat Jun 04 01:43:56 2011 +0000
@@ -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 @@
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 @@
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 -r 4c8d1ebd092d -r 670656aa90ad sys/arch/pmax/pmax/clock.c
--- a/sys/arch/pmax/pmax/clock.c Sat Jun 04 01:37:36 2011 +0000
+++ b/sys/arch/pmax/pmax/clock.c Sat Jun 04 01:43:56 2011 +0000
@@ -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 @@
#include "opt_ntp.h"
-struct device *clockdev;
+device_t clockdev;
const struct clockfns *clockfns;
int clockinitted;
@@ -61,7 +61,7 @@
#endif
void
-clockattach(struct device *dev, const struct clockfns *fns)
+clockattach(device_t dev, const struct clockfns *fns)
{
/*
@@ -75,7 +75,7 @@
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 -r 4c8d1ebd092d -r 670656aa90ad sys/arch/pmax/tc/mcclock_ioasic.c
--- a/sys/arch/pmax/tc/mcclock_ioasic.c Sat Jun 04 01:37:36 2011 +0000
+++ b/sys/arch/pmax/tc/mcclock_ioasic.c Sat Jun 04 01:43:56 2011 +0000
@@ -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 @@
#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 @@
}
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 -r 4c8d1ebd092d -r 670656aa90ad sys/dev/dec/mcclock.c
--- a/sys/dev/dec/mcclock.c Sat Jun 04 01:37:36 2011 +0000
+++ b/sys/dev/dec/mcclock.c Sat Jun 04 01:43:56 2011 +0000
@@ -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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 -r 4c8d1ebd092d -r 670656aa90ad sys/dev/dec/mcclockvar.h
--- a/sys/dev/dec/mcclockvar.h Sat Jun 04 01:37:36 2011 +0000
+++ b/sys/dev/dec/mcclockvar.h Sat Jun 04 01:43:56 2011 +0000
@@ -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;
};
Home |
Main Index |
Thread Index |
Old Index