Module Name:    src
Committed By:   bsh
Date:           Sat Mar 13 11:26:42 UTC 2010

Modified Files:
        src/sys/arch/evbarm/g42xxeb: g42xxeb_kmkbd.c g42xxeb_var.h gb225.c
            gb225_pcic.c gb225var.h obio.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/g42xxeb/gb225.c \
    src/sys/arch/evbarm/g42xxeb/obio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/g42xxeb/gb225_pcic.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/g42xxeb/gb225var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c
diff -u src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c:1.10 src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c:1.11
--- src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c:1.10	Sat Mar 14 15:36:05 2009
+++ src/sys/arch/evbarm/g42xxeb/g42xxeb_kmkbd.c	Sat Mar 13 11:26:42 2010
@@ -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:

Index: src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h
diff -u src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h:1.3 src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h:1.4
--- src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h:1.3	Sat May 10 15:31:04 2008
+++ src/sys/arch/evbarm/g42xxeb/g42xxeb_var.h	Sat Mar 13 11:26:42 2010
@@ -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;
 

Index: src/sys/arch/evbarm/g42xxeb/gb225.c
diff -u src/sys/arch/evbarm/g42xxeb/gb225.c:1.7 src/sys/arch/evbarm/g42xxeb/gb225.c:1.8
--- src/sys/arch/evbarm/g42xxeb/gb225.c:1.7	Wed Oct 17 19:54:12 2007
+++ src/sys/arch/evbarm/g42xxeb/gb225.c	Sat Mar 13 11:26:42 2010
@@ -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;
Index: src/sys/arch/evbarm/g42xxeb/obio.c
diff -u src/sys/arch/evbarm/g42xxeb/obio.c:1.7 src/sys/arch/evbarm/g42xxeb/obio.c:1.8
--- src/sys/arch/evbarm/g42xxeb/obio.c:1.7	Sun Apr 27 18:58:46 2008
+++ src/sys/arch/evbarm/g42xxeb/obio.c	Sat Mar 13 11:26:42 2010
@@ -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;
 
+	sc->sc_dev = self;
+
 	/* tweak memory access timing for CS3. 
 	   the value set by redboot is too slow */
 	if (bus_space_map(iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, 
@@ -264,14 +265,13 @@
 	return;
 
  fail:
-	printf( "%s: can't map FPGA registers\n", self->dv_xname );
+	aprint_error( "%s: can't map FPGA registers\n", self->dv_xname );
 }
 
 int
-obio_search(struct device *parent, struct cfdata *cf,
-	    const int *ldesc, void *aux)
+obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct obio_softc *sc = (struct obio_softc *)parent;
+	struct obio_softc *sc = device_private(parent);
 	struct obio_attach_args oba;
 
 	oba.oba_sc = sc;
@@ -370,7 +370,7 @@
 
 	if (error)
 		aprint_error("%s: bad intr_disestablish\n", 
-		    sc->sc_dev.dv_xname);
+		    device_xname(sc->sc_dev));
 }
 
 void

Index: src/sys/arch/evbarm/g42xxeb/gb225_pcic.c
diff -u src/sys/arch/evbarm/g42xxeb/gb225_pcic.c:1.8 src/sys/arch/evbarm/g42xxeb/gb225_pcic.c:1.9
--- src/sys/arch/evbarm/g42xxeb/gb225_pcic.c:1.8	Sun May 31 17:47:26 2009
+++ src/sys/arch/evbarm/g42xxeb/gb225_pcic.c	Sat Mar 13 11:26:42 2010
@@ -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;

Index: src/sys/arch/evbarm/g42xxeb/gb225var.h
diff -u src/sys/arch/evbarm/g42xxeb/gb225var.h:1.2 src/sys/arch/evbarm/g42xxeb/gb225var.h:1.3
--- src/sys/arch/evbarm/g42xxeb/gb225var.h:1.2	Sun Dec 11 12:17:08 2005
+++ src/sys/arch/evbarm/g42xxeb/gb225var.h	Sat Mar 13 11:26:42 2010
@@ -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;

Reply via email to