Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/at91 . fix attach code



details:   https://anonhg.NetBSD.org/src/rev/e4f9714c727a
branches:  trunk
changeset: 770965:e4f9714c727a
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Fri Nov 04 17:13:15 2011 +0000

description:
. fix attach code
. use CFATTACH_DECL_NEW

diffstat:

 sys/arch/arm/at91/at91ohci.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (70 lines):

diff -r e05357f3ad96 -r e4f9714c727a sys/arch/arm/at91/at91ohci.c
--- a/sys/arch/arm/at91/at91ohci.c      Fri Nov 04 17:11:19 2011 +0000
+++ b/sys/arch/arm/at91/at91ohci.c      Fri Nov 04 17:13:15 2011 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $  */
-/*     $NetBSD: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $      */
+/*     $Id: at91ohci.c,v 1.5 2011/11/04 17:13:15 aymeric Exp $ */
+/*     $NetBSD: at91ohci.c,v 1.5 2011/11/04 17:13:15 aymeric Exp $     */
 
 /*-
  * Copyright (c) 2007 Embedtronics Oy.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91ohci.c,v 1.5 2011/11/04 17:13:15 aymeric Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -75,7 +75,7 @@
        int     sc_pid;
 };
 
-CFATTACH_DECL(at91ohci, sizeof(struct at91ohci_softc),
+CFATTACH_DECL_NEW(at91ohci, sizeof(struct at91ohci_softc),
     at91ohci_match, at91ohci_attach, NULL, NULL);
 
 int
@@ -90,11 +90,13 @@
 void
 at91ohci_attach(device_t parent, device_t self, void *aux)
 {
-       struct at91ohci_softc *sc = (struct at91ohci_softc *)self;
+       struct at91ohci_softc *sc = device_private(self);
        struct at91bus_attach_args *sa = aux;
 
+       sc->sc.sc_dev = self;
+       sc->sc.sc_bus.hci_private = sc;
+       sc->sc.sc_bus.dmatag = sa->sa_dmat;
        sc->sc.iot = sa->sa_iot;
-       sc->sc.sc_bus.dmatag = sa->sa_dmat;
        sc->sc_pid = sa->sa_pid;
 
        /* Map I/O space */
@@ -104,6 +106,8 @@
                return;
        }
 
+       sc->sc.sc_size = sa->sa_size;
+
        /* enable peripheral clock */
        at91_peripheral_clock(sc->sc_pid, 1);
 
@@ -116,7 +120,7 @@
 void
 at91ohci_callback(device_t self)
 {
-       struct at91ohci_softc *sc = (struct at91ohci_softc *)self;
+       struct at91ohci_softc *sc = device_private(self);
        usbd_status r;
 
        /* Disable interrupts, so we don't get any spurious ones. */
@@ -136,5 +140,5 @@
        }
 
        /* Attach usb device. */
-       sc->sc.sc_child = config_found((void *) sc, &sc->sc.sc_bus, usbctlprint);
+       sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint);
 }



Home | Main Index | Thread Index | Old Index