Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/emips/ebus Split device_t/softc.



details:   https://anonhg.NetBSD.org/src/rev/545a71471827
branches:  trunk
changeset: 765968:545a71471827
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jun 12 04:44:27 2011 +0000

description:
Split device_t/softc.

diffstat:

 sys/arch/emips/ebus/clock_ebus.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (75 lines):

diff -r 02b097de1bd3 -r 545a71471827 sys/arch/emips/ebus/clock_ebus.c
--- a/sys/arch/emips/ebus/clock_ebus.c  Sun Jun 12 04:43:11 2011 +0000
+++ b/sys/arch/emips/ebus/clock_ebus.c  Sun Jun 12 04:44:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock_ebus.c,v 1.5 2011/06/12 04:40:44 tsutsui Exp $   */
+/*     $NetBSD: clock_ebus.c,v 1.6 2011/06/12 04:44:27 tsutsui Exp $   */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: clock_ebus.c,v 1.5 2011/06/12 04:40:44 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock_ebus.c,v 1.6 2011/06/12 04:44:27 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -49,7 +49,7 @@
  * Device softc
  */
 struct eclock_softc {
-       struct device sc_dev;
+       device_t sc_dev;
        struct _Tc *sc_dp;
        uint32_t sc_reload;
        struct timecounter sc_tc;
@@ -59,7 +59,7 @@
 static int     eclock_ebus_match(device_t, cfdata_t, void *);
 static void    eclock_ebus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(eclock_ebus, sizeof (struct eclock_softc),
+CFATTACH_DECL_NEW(eclock_ebus, sizeof (struct eclock_softc),
     eclock_ebus_match, eclock_ebus_attach, NULL, NULL);
 
 void   eclock_init(device_t);
@@ -87,7 +87,7 @@
 static void
 __eclock_init(device_t dev)
 {
-       struct eclock_softc *sc = (struct eclock_softc *)dev;
+       struct eclock_softc *sc = device_private(dev);
        struct _Tc *tc = sc->sc_dp;
        uint32_t reload = 10 * 1000000; /* 1sec in 100ns units (10MHz clock) */
 
@@ -100,7 +100,7 @@
                if ((r * hz) != reload)
                        printf("%s: %d Hz clock will cause roundoffs"
                            " with 10MHz xtal (%d)\n",
-                           sc->sc_dev.dv_xname, hz, reload - (r * hz));
+                           device_xname(sc->sc_dev), hz, reload - (r * hz));
                reload = r;
        }
 
@@ -300,9 +300,10 @@
 static void
 eclock_ebus_attach(device_t parent, device_t self, void *aux)
 {
+       struct eclock_softc *sc = device_private(self);
        struct ebus_attach_args *ia = aux;
-       struct eclock_softc *sc = (struct eclock_softc *)self;
 
+       sc->sc_dev = self;
        sc->sc_dp = (struct _Tc *)ia->ia_vaddr;
 
        /* NB: We are chopping our 64bit free-running down to 32bits */
@@ -328,7 +329,7 @@
 
 #ifdef EVCNT_COUNTERS
        evcnt_attach_dynamic(&clock_intr_evcnt, EVCNT_TYPE_INTR, NULL,
-           sc->sc_dev->dv_xname, "intr");
+           device_xname(self), "intr");
 #endif
 
        clockdev = self;



Home | Main Index | Thread Index | Old Index