Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/g42xxeb apply struct device split to the res...



details:   https://anonhg.NetBSD.org/src/rev/bfe658bf7ff0
branches:  trunk
changeset: 752963:bfe658bf7ff0
user:      bsh <bsh%NetBSD.org@localhost>
date:      Sat Mar 13 11:26:42 2010 +0000

description:
apply struct device split to the rest of the drivers for Twintail.

diffstat:

 sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c |  25 +++++++++++++------------
 sys/arch/evbarm/g42xxeb/g42xxeb_var.h   |   2 +-
 sys/arch/evbarm/g42xxeb/gb225.c         |  30 +++++++++++++++---------------
 sys/arch/evbarm/g42xxeb/gb225_pcic.c    |   6 +++---
 sys/arch/evbarm/g42xxeb/gb225var.h      |   4 ++--
 sys/arch/evbarm/g42xxeb/obio.c          |  30 +++++++++++++++---------------
 6 files changed, 49 insertions(+), 48 deletions(-)

diffs (truncated from 333 to 300 lines):

diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c
--- a/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c   Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c   Sat Mar 13 11:26:42 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: g42xxeb_kmkbd.c,v 1.10 2009/03/14 15:36:05 dsl Exp $ */
+/* $NetBSD: g42xxeb_kmkbd.c,v 1.11 2010/03/13 11:26:42 bsh Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003, 2005 Genetec corp.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: g42xxeb_kmkbd.c,v 1.10 2009/03/14 15:36:05 dsl Exp $" );
+__KERNEL_RCSID(0, "$NetBSD: g42xxeb_kmkbd.c,v 1.11 2010/03/13 11:26:42 bsh Exp $" );
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,7 +65,7 @@
 #define RELEASE_WATCH_TICKS  (hz/10)   /* 100ms */
 
 struct kmkbd_softc {
-        struct  device dev;
+       device_t dev;
 
        struct device *wskbddev;
        void *ih;                       /* interrupt handler */
@@ -86,10 +86,10 @@
 };
 
 
-int kmkbd_match(struct device *, struct cfdata *, void *);
-void kmkbd_attach(struct device *, struct device *, void *);
+int kmkbd_match(device_t, cfdata_t, void *);
+void kmkbd_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(kmkbd, sizeof(struct kmkbd_softc),
+CFATTACH_DECL_NEW(kmkbd, sizeof(struct kmkbd_softc),
     kmkbd_match, kmkbd_attach, NULL, NULL);
 
 static  int    kmkbd_enable(void *, int);
@@ -189,17 +189,18 @@
 }
 
 void
-kmkbd_attach(struct device *parent, struct device *self, void *aux)
+kmkbd_attach(device_t parent, device_t self, void *aux)
 {
-       struct kmkbd_softc *sc = (void *)self;
+       struct kmkbd_softc *sc = device_private(self);
        /*struct obio_attach_args *oa = aux;*/
        int state0;
        struct wskbddev_attach_args a;
-       struct obio_softc *osc = (struct obio_softc *)parent;
+       struct obio_softc *osc = device_private(parent);
        int s;
 
        printf("\n");
 
+       sc->dev = self;
        sc->state = ST_INIT;
 
        if (kmkbd_is_console()){
@@ -367,7 +368,7 @@
 {
        int i;
        u_int ret, data;
-       struct obio_softc *osc = (struct obio_softc *)device_parent(&sc->dev);
+       struct obio_softc *osc = device_private(device_parent(sc->dev));
        bus_space_tag_t iot = osc->sc_iot;
        bus_space_handle_t ioh = osc->sc_obioreg_ioh;
 
@@ -438,7 +439,7 @@
 kmkbd_intr(void *arg)
 {
        struct kmkbd_softc *sc = arg;
-       struct obio_softc *osc = (struct obio_softc *)device_parent(&sc->dev);
+       struct obio_softc *osc = device_private(device_parent(sc->dev));
 
        if ( sc->state != ST_ALL_UP ){
                printf("Spurious interrupt from key matrix\n");
@@ -499,7 +500,7 @@
 static void
 kmkbd_new_state(struct kmkbd_softc *sc, enum kmkbd_state new_state)
 {
-       struct obio_softc *osc = (struct obio_softc *)device_parent(&sc->dev);
+       struct obio_softc *osc = device_private(device_parent(sc->dev));
 
        switch(new_state){
        case ST_DISABLED:
diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/g42xxeb_var.h
--- a/sys/arch/evbarm/g42xxeb/g42xxeb_var.h     Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/g42xxeb_var.h     Sat Mar 13 11:26:42 2010 +0000
@@ -43,7 +43,7 @@
  * G42xxeb on-board IO bus
  */
 struct obio_softc {
-       struct device sc_dev;
+       device_t sc_dev;
        bus_space_tag_t sc_iot;
        bus_space_handle_t sc_obioreg_ioh;
 
diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/gb225.c
--- a/sys/arch/evbarm/g42xxeb/gb225.c   Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/gb225.c   Sat Mar 13 11:26:42 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gb225.c,v 1.7 2007/10/17 19:54:12 garbled Exp $ */
+/*     $NetBSD: gb225.c,v 1.8 2010/03/13 11:26:42 bsh Exp $ */
 
 /*
  * Copyright (c) 2002, 2003  Genetec corp.  All rights reserved.
@@ -60,10 +60,9 @@
 #define DEBOUNCE_TICKS (hz/20)                 /* 50ms */
 
 /* prototypes */
-static int     opio_match(struct device *, struct cfdata *, void *);
-static void    opio_attach(struct device *, struct device *, void *);
-static int     opio_search(struct device *, struct cfdata *,
-                           const int *, void *);
+static int     opio_match(device_t, cfdata_t, void *);
+static void    opio_attach(device_t, device_t, void *);
+static int     opio_search(device_t, cfdata_t, const int *, void *);
 static int     opio_print(void *, const char *);
 #ifdef OPIO_INTR
 static int     opio_intr( void *arg );
@@ -72,7 +71,7 @@
 
 
 /* attach structures */
-CFATTACH_DECL(opio, sizeof(struct opio_softc), opio_match, opio_attach,
+CFATTACH_DECL_NEW(opio, sizeof(struct opio_softc), opio_match, opio_attach,
     NULL, NULL);
 
 /*
@@ -91,9 +90,9 @@
 }
 
 int
-opio_match(struct device *parent, struct cfdata *match, void *aux)
+opio_match(device_t parent, cfdata_t match, void *aux)
 {
-       struct obio_softc *psc = (struct obio_softc *)parent;
+       struct obio_softc *psc = device_private(parent);
        uint16_t optid;
 
        optid = bus_space_read_2(psc->sc_iot, psc->sc_obioreg_ioh,
@@ -103,10 +102,10 @@
 }
 
 void
-opio_attach(struct device *parent, struct device *self, void *aux)
+opio_attach(device_t parent, device_t self, void *aux)
 {
-       struct opio_softc *sc = (struct opio_softc*)self;
-       struct obio_softc *bsc = (struct obio_softc *)parent;
+       struct opio_softc *sc = device_private(self);
+       struct obio_softc *bsc = device_private(parent);
        struct obio_attach_args *oba = aux;
        uint32_t reg;
        int i;
@@ -114,6 +113,7 @@
        bus_space_handle_t  memctl_ioh = bsc->sc_memctl_ioh;
 
        iot = oba->oba_iot;
+       sc->sc_dev = self;
        sc->sc_iot = iot;
        sc->sc_memctl_ioh = memctl_ioh;
 
@@ -178,10 +178,10 @@
 }
 
 int
-opio_search(struct device *parent, struct cfdata *cf,
+opio_search(device_t parent, cfdata_t cf,
            const int *ldesc, void *aux)
 {
-       struct opio_softc *sc = (struct opio_softc *)parent;
+       struct opio_softc *sc = device_private(parent);
        struct obio_attach_args oba;
 
        oba.oba_sc = sc;
@@ -220,7 +220,7 @@
 {
        struct opio_softc *sc = (struct opio_softc *)arg;
        struct obio_softc *bsc =
-           (struct obio_softc *)device_parent(&sc->sc_dev);
+           device_private(device_parent(sc->sc_dev));
 
        /* avoid further interrupts while debouncing */
        obio_intr_mask(bsc, sc->sc_ih);
@@ -273,7 +273,7 @@
 {
        struct opio_softc *sc = arg;
        struct obio_softc *osc =
-           (struct obio_softc *)device_parent(&sc->sc_dev);
+           device_private(device_parent(sc->sc_dev));
        bus_space_tag_t iot = sc->sc_iot;
        bus_space_handle_t ioh = sc->sc_ioh;
        int flag = 0;
diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/gb225_pcic.c
--- a/sys/arch/evbarm/g42xxeb/gb225_pcic.c      Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/gb225_pcic.c      Sat Mar 13 11:26:42 2010 +0000
@@ -286,7 +286,7 @@
        struct opio_softc *psc = 
             device_private(device_parent(sc->sc_pc.sc_dev));
        struct obio_softc *bsc = 
-            device_private(device_parent(&psc->sc_dev));
+            device_private(device_parent(psc->sc_dev));
 
        switch (which) {
        case SAPCIC_CONTROL_RESET:
@@ -354,7 +354,7 @@
        struct opio_softc *psc = 
            device_private(device_parent(sc->sc_pc.sc_dev));
        struct obio_softc *bsc = 
-           device_private(device_parent(&psc->sc_dev));
+           device_private(device_parent(psc->sc_dev));
        int irq;
 
        DPRINTF(("opcic_intr_establish %d\n", so->socket));
@@ -371,7 +371,7 @@
        struct opio_softc *psc = 
            device_private(device_parent(sc->sc_pc.sc_dev));
        struct obio_softc *bsc = 
-           (struct obio_softc *) device_parent(&psc->sc_dev);
+           (struct obio_softc *) device_parent(psc->sc_dev);
        int (* func)(void *) = ((struct obio_handler *)ih)->func;
 
        int irq = so->socket ? PCMCIA_INT : CF_INT;
diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/gb225var.h
--- a/sys/arch/evbarm/g42xxeb/gb225var.h        Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/gb225var.h        Sat Mar 13 11:26:42 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gb225var.h,v 1.2 2005/12/11 12:17:08 christos Exp $ */
+/*     $NetBSD: gb225var.h,v 1.3 2010/03/13 11:26:42 bsh Exp $ */
 
 /*
  * Copyright (c) 2002, 2003  Genetec corp.  All rights reserved.
@@ -48,7 +48,7 @@
 struct opio_intr_handler;
 
 struct opio_softc {
-       struct device sc_dev;
+       device_t sc_dev;
 
        bus_space_tag_t      sc_iot;
        bus_space_handle_t   sc_ioh;
diff -r 5dc2cf79081c -r bfe658bf7ff0 sys/arch/evbarm/g42xxeb/obio.c
--- a/sys/arch/evbarm/g42xxeb/obio.c    Sat Mar 13 11:15:52 2010 +0000
+++ b/sys/arch/evbarm/g42xxeb/obio.c    Sat Mar 13 11:26:42 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio.c,v 1.7 2008/04/27 18:58:46 matt Exp $ */
+/*     $NetBSD: obio.c,v 1.8 2010/03/13 11:26:42 bsh Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec corp.  All rights reserved.
@@ -53,14 +53,13 @@
 #include "locators.h"
 
 /* prototypes */
-static int     obio_match(struct device *, struct cfdata *, void *);
-static void    obio_attach(struct device *, struct device *, void *);
-static int     obio_search(struct device *, struct cfdata *,
-                           const int *, void *);
+static int     obio_match(device_t, cfdata_t, void *);
+static void    obio_attach(device_t, device_t, void *);
+static int     obio_search(device_t, cfdata_t, const int *, void *);
 static int     obio_print(void *, const char *);
 
 /* attach structures */
-CFATTACH_DECL(obio, sizeof(struct obio_softc), obio_match, obio_attach,
+CFATTACH_DECL_NEW(obio, sizeof(struct obio_softc), obio_match, obio_attach,
     NULL, NULL);
 
 static int
@@ -189,9 +188,9 @@
        struct obio_attach_args *oba = (struct obio_attach_args*)aux;
 
        if (oba->oba_addr != OBIOCF_ADDR_DEFAULT)
-                printf(" addr 0x%lx", oba->oba_addr);
+                aprint_normal(" addr 0x%lx", oba->oba_addr);
         if (oba->oba_intr > 0)
-                printf(" intr %d", oba->oba_intr);
+                aprint_normal(" intr %d", oba->oba_intr);
         return (UNCONF);
 }
 
@@ -202,14 +201,16 @@
 }
 
 void
-obio_attach(struct device *parent, struct device *self, void *aux)
+obio_attach(device_t parent, device_t self, void *aux)
 {
-       struct obio_softc *sc = (struct obio_softc*)self;
+       struct obio_softc *sc = device_private(self);
        struct sa11x0_attach_args *sa = (struct sa11x0_attach_args *)aux;
        bus_space_tag_t iot = sa->sa_iot;
        int i;
        uint16_t reg;



Home | Main Index | Thread Index | Old Index