Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips device_t-ify



details:   https://anonhg.NetBSD.org/src/rev/9139811a0ecf
branches:  trunk
changeset: 768519:9139811a0ecf
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Aug 18 02:56:21 2011 +0000

description:
device_t-ify

diffstat:

 sys/arch/sgimips/dev/crime.c    |  16 +++++++++-------
 sys/arch/sgimips/dev/crimevar.h |   4 ++--
 sys/arch/sgimips/mace/mace.c    |  19 ++++++++++---------
 3 files changed, 21 insertions(+), 18 deletions(-)

diffs (157 lines):

diff -r 64b298b79b91 -r 9139811a0ecf sys/arch/sgimips/dev/crime.c
--- a/sys/arch/sgimips/dev/crime.c      Thu Aug 18 02:44:45 2011 +0000
+++ b/sys/arch/sgimips/dev/crime.c      Thu Aug 18 02:56:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crime.c,v 1.35 2011/07/01 18:53:45 dyoung Exp $        */
+/*     $NetBSD: crime.c,v 1.36 2011/08/18 02:56:21 macallan Exp $      */
 
 /*
  * Copyright (c) 2004 Christopher SEKIYA
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.35 2011/07/01 18:53:45 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.36 2011/08/18 02:56:21 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -61,8 +61,8 @@
 
 #define DISABLE_CRIME_WATCHDOG
 
-static int     crime_match(struct device *, struct cfdata *, void *);
-static void    crime_attach(struct device *, struct device *, void *);
+static int     crime_match(device_t, struct cfdata *, void *);
+static void    crime_attach(device_t, device_t, void *);
 void           crime_bus_reset(void);
 void           crime_watchdog_reset(void);
 void           crime_watchdog_disable(void);
@@ -72,7 +72,7 @@
 static bus_space_tag_t crm_iot;
 static bus_space_handle_t crm_ioh;
 
-CFATTACH_DECL(crime, sizeof(struct crime_softc),
+CFATTACH_DECL_NEW(crime, sizeof(struct crime_softc),
     crime_match, crime_attach, NULL, NULL);
 
 #define CRIME_NINTR 32         /* XXX */
@@ -83,7 +83,7 @@
 } crime[CRIME_NINTR];
 
 static int
-crime_match(struct device *parent, struct cfdata *match, void *aux)
+crime_match(device_t parent, struct cfdata *match, void *aux)
 {
 
        /*
@@ -96,14 +96,16 @@
 }
 
 static void
-crime_attach(struct device *parent, struct device *self, void *aux)
+crime_attach(device_t parent, device_t self, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
        struct cpu_info * const ci = curcpu();
+       struct crime_softc *sc = device_private(self);
        uint64_t crm_id;
        uint64_t baseline, endline;
        uint32_t startctr, endctr, cps;
 
+       sc->sc_dev = self;
        crm_iot = SGIMIPS_BUS_SPACE_CRIME;
 
        if (bus_space_map(crm_iot, ma->ma_addr, 0 /* XXX */,
diff -r 64b298b79b91 -r 9139811a0ecf sys/arch/sgimips/dev/crimevar.h
--- a/sys/arch/sgimips/dev/crimevar.h   Thu Aug 18 02:44:45 2011 +0000
+++ b/sys/arch/sgimips/dev/crimevar.h   Thu Aug 18 02:56:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crimevar.h,v 1.8 2011/07/01 18:53:45 dyoung Exp $      */
+/*     $NetBSD: crimevar.h,v 1.9 2011/08/18 02:56:21 macallan Exp $    */
 
 /*
  * Copyright (c) 2003 Christopher SEKIYA
@@ -35,7 +35,7 @@
 #include <sys/bus.h>
 
 struct crime_softc {
-       struct device sc_dev;
+       device_t sc_dev;
 };
 
 void crime_intr_mask(unsigned int);
diff -r 64b298b79b91 -r 9139811a0ecf sys/arch/sgimips/mace/mace.c
--- a/sys/arch/sgimips/mace/mace.c      Thu Aug 18 02:44:45 2011 +0000
+++ b/sys/arch/sgimips/mace/mace.c      Thu Aug 18 02:56:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mace.c,v 1.17 2011/07/01 18:53:47 dyoung Exp $ */
+/*     $NetBSD: mace.c,v 1.18 2011/08/18 03:25:34 macallan Exp $       */
 
 /*
  * Copyright (c) 2003 Christopher Sekiya
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.17 2011/07/01 18:53:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mace.c,v 1.18 2011/08/18 03:25:34 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -87,7 +87,7 @@
 } maceintrtab[MACE_NINTR];
 
 struct mace_softc {
-       struct device sc_dev;
+       device_t sc_dev;
 
        bus_space_tag_t iot;
        bus_space_handle_t ioh;
@@ -105,7 +105,7 @@
 static int     mace_search(struct device *, struct cfdata *,
                            const int *, void *);
 
-CFATTACH_DECL(mace, sizeof(struct mace_softc),
+CFATTACH_DECL_NEW(mace, sizeof(struct mace_softc),
     mace_match, mace_attach, NULL, NULL);
 
 #if defined(BLINK)
@@ -114,7 +114,7 @@
 #endif
 
 static int
-mace_match(struct device *parent, struct cfdata *match, void *aux)
+mace_match(device_t parent, struct cfdata *match, void *aux)
 {
 
        /*
@@ -127,12 +127,13 @@
 }
 
 static void
-mace_attach(struct device *parent, struct device *self, void *aux)
+mace_attach(device_t parent, device_t self, void *aux)
 {
-       struct mace_softc *sc = (struct mace_softc *)self;
+       struct mace_softc *sc = device_private(self);
        struct mainbus_attach_args *ma = aux;
        uint32_t scratch;
 
+       sc->sc_dev = self;
 #ifdef BLINK
        callout_init(&mace_blink_ch, 0);
 #endif
@@ -202,10 +203,10 @@
 }
 
 static int
-mace_search(struct device *parent, struct cfdata *cf,
+mace_search(device_t parent, struct cfdata *cf,
            const int *ldesc, void *aux)
 {
-       struct mace_softc *sc = (struct mace_softc *)parent;
+       struct mace_softc *sc = device_private(parent);
        struct mace_attach_args maa;
        int tryagain;
 



Home | Main Index | Thread Index | Old Index