Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips/hpc Split device_t/softc. Tested on Indy.



details:   https://anonhg.NetBSD.org/src/rev/68fc95ad906a
branches:  trunk
changeset: 761366:68fc95ad906a
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Jan 25 13:22:05 2011 +0000

description:
Split device_t/softc. Tested on Indy.

diffstat:

 sys/arch/sgimips/hpc/haltwo.c    |  19 ++++++++++---------
 sys/arch/sgimips/hpc/haltwovar.h |   4 ++--
 sys/arch/sgimips/hpc/hpc.c       |  34 ++++++++++++++++++----------------
 3 files changed, 30 insertions(+), 27 deletions(-)

diffs (203 lines):

diff -r 24fcbe102105 -r 68fc95ad906a sys/arch/sgimips/hpc/haltwo.c
--- a/sys/arch/sgimips/hpc/haltwo.c     Tue Jan 25 13:12:39 2011 +0000
+++ b/sys/arch/sgimips/hpc/haltwo.c     Tue Jan 25 13:22:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwo.c,v 1.18 2011/01/25 12:21:04 tsutsui Exp $ */
+/* $NetBSD: haltwo.c,v 1.19 2011/01/25 13:31:41 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.18 2011/01/25 12:21:04 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.19 2011/01/25 13:31:41 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -113,11 +113,11 @@
        "haltwo"
 };
 
-static int  haltwo_match(struct device *, struct cfdata *, void *);
-static void haltwo_attach(struct device *, struct device *, void *);
+static int  haltwo_match(device_t, cfdata_t, void *);
+static void haltwo_attach(device_t, device_t, void *);
 static int  haltwo_intr(void *);
 
-CFATTACH_DECL(haltwo, sizeof(struct haltwo_softc),
+CFATTACH_DECL_NEW(haltwo, sizeof(struct haltwo_softc),
     haltwo_match, haltwo_attach, NULL, NULL);
 
 #define haltwo_write(sc,type,off,val) \
@@ -259,7 +259,7 @@
 }
 
 static int
-haltwo_match(struct device *parent, struct cfdata *cf, void *aux)
+haltwo_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct hpc_attach_args *haa;
        uint32_t rev;
@@ -288,14 +288,15 @@
 }
 
 static void
-haltwo_attach(struct device *parent, struct device *self, void *aux)
+haltwo_attach(device_t parent, device_t self, void *aux)
 {
        struct haltwo_softc *sc;
        struct hpc_attach_args *haa;
        uint32_t rev;
 
-       sc = (void *)self;
+       sc = device_private(self);
        haa = aux;
+       sc->sc_dev = self;
        sc->sc_st = haa->ha_st;
        sc->sc_dma_tag = haa->ha_dmat;
 
@@ -356,7 +357,7 @@
        haltwo_write(sc, vol, HAL2_REG_VOL_LEFT, sc->sc_vol_left);
        haltwo_write(sc, vol, HAL2_REG_VOL_RIGHT, sc->sc_vol_right);
 
-       audio_attach_mi(&haltwo_hw_if, sc, &sc->sc_dev);
+       audio_attach_mi(&haltwo_hw_if, sc, self);
 
        if (!pmf_device_register1(self, NULL, NULL, haltwo_shutdown))
                aprint_error_dev(self,
diff -r 24fcbe102105 -r 68fc95ad906a sys/arch/sgimips/hpc/haltwovar.h
--- a/sys/arch/sgimips/hpc/haltwovar.h  Tue Jan 25 13:12:39 2011 +0000
+++ b/sys/arch/sgimips/hpc/haltwovar.h  Tue Jan 25 13:22:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwovar.h,v 1.6 2009/09/24 14:09:18 tsutsui Exp $ */
+/* $NetBSD: haltwovar.h,v 1.7 2011/01/25 13:31:41 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -60,7 +60,7 @@
 };
 
 struct haltwo_softc {
-       struct device sc_dev;
+       device_t sc_dev;
 
        bus_space_tag_t sc_st;
 
diff -r 24fcbe102105 -r 68fc95ad906a sys/arch/sgimips/hpc/hpc.c
--- a/sys/arch/sgimips/hpc/hpc.c        Tue Jan 25 13:12:39 2011 +0000
+++ b/sys/arch/sgimips/hpc/hpc.c        Tue Jan 25 13:22:05 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $ */
+/*     $NetBSD: hpc.c,v 1.65 2011/01/25 13:22:05 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.64 2011/01/25 12:21:04 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.65 2011/01/25 13:22:05 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -217,7 +217,7 @@
 };
 
 struct hpc_softc {
-       struct device           sc_dev;
+       device_t                sc_dev;
 
        bus_addr_t              sc_base;
 
@@ -351,14 +351,13 @@
 
 static int powerintr_established;
 
-static int     hpc_match(struct device *, struct cfdata *, void *);
-static void    hpc_attach(struct device *, struct device *, void *);
+static int     hpc_match(device_t, cfdata_t, void *);
+static void    hpc_attach(device_t, device_t, void *);
 static int     hpc_print(void *, const char *);
 
 static int     hpc_revision(struct hpc_softc *, struct gio_attach_args *);
 
-static int     hpc_submatch(struct device *, struct cfdata *,
-                    const int *, void *);
+static int     hpc_submatch(device_t, cfdata_t, const int *, void *);
 
 //static int   hpc_power_intr(void *);
 
@@ -370,11 +369,11 @@
 static int     hpc_read_eeprom(int, bus_space_tag_t, bus_space_handle_t,
                    uint8_t *, size_t);
 
-CFATTACH_DECL(hpc, sizeof(struct hpc_softc),
+CFATTACH_DECL_NEW(hpc, sizeof(struct hpc_softc),
     hpc_match, hpc_attach, NULL, NULL);
 
 static int
-hpc_match(struct device *parent, struct cfdata *cf, void *aux)
+hpc_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct gio_attach_args* ga = aux;
 
@@ -390,9 +389,9 @@
 }
 
 static void
-hpc_attach(struct device *parent, struct device *self, void *aux)
+hpc_attach(device_t parent, device_t self, void *aux)
 {
-       struct hpc_softc *sc = (struct hpc_softc *)self;
+       struct hpc_softc *sc = device_private(self);
        struct gio_attach_args* ga = aux;
        struct hpc_attach_args ha;
        const struct hpc_device *hd;
@@ -401,6 +400,8 @@
        int isioplus;
        int sysmask;
 
+       sc->sc_dev = self;
+
 #ifdef BLINK
        callout_init(&hpc_blink_ch, 0);
 #endif
@@ -467,11 +468,12 @@
                if (gio_arb_config(arb_slot, GIO_ARB_LB | GIO_ARB_MST |
                    GIO_ARB_64BIT | GIO_ARB_HPC2_64BIT)) {
                        printf("%s: failed to configure GIO bus arbiter\n",
-                           sc->sc_dev.dv_xname);
+                           device_xname(sc->sc_dev));
                        return;
                }
 
-               printf("%s: using EXP%d's DMA channel\n", sc->sc_dev.dv_xname,
+               printf("%s: using EXP%d's DMA channel\n",
+                   device_xname(sc->sc_dev),
                    (arb_slot == GIO_SLOT_EXP0) ? 0 : 1);
 
                bus_space_write_4(ga->ga_iot, ga->ga_ioh,
@@ -491,7 +493,7 @@
 
                if (gio_arb_config(arb_slot, GIO_ARB_RT | GIO_ARB_MST)) {
                        printf("%s: failed to configure GIO bus arbiter\n",
-                           sc->sc_dev.dv_xname);
+                           device_xname(sc->sc_dev));
                        return;
                }
        }
@@ -681,9 +683,9 @@
 
 #if defined(BLINK)
 static void
-hpc_blink(void *self)
+hpc_blink(void *arg)
 {
-       struct hpc_softc *sc = (struct hpc_softc *) self;
+       struct hpc_softc *sc = arg;
        register int    s;
        int     value;
 



Home | Main Index | Thread Index | Old Index