Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Simplify activation hook. (sc_dying must die!)



details:   https://anonhg.NetBSD.org/src/rev/cd9e84ee83e5
branches:  trunk
changeset: 748999:cd9e84ee83e5
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Nov 12 19:53:56 2009 +0000

description:
Simplify activation hook.  (sc_dying must die!)

unifdef -D__NetBSD__ -U__FreeBSD__ -U__OpenBSD__.

diffstat:

 sys/dev/usb/uhci.c |  56 +++++------------------------------------------------
 1 files changed, 6 insertions(+), 50 deletions(-)

diffs (152 lines):

diff -r 7df44c2c1b94 -r cd9e84ee83e5 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Thu Nov 12 19:53:14 2009 +0000
+++ b/sys/dev/usb/uhci.c        Thu Nov 12 19:53:56 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.229 2009/11/01 06:36:44 uebayasi Exp $      */
+/*     $NetBSD: uhci.c,v 1.230 2009/11/12 19:53:56 dyoung Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -42,25 +42,16 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.229 2009/11/01 06:36:44 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.230 2009/11/12 19:53:56 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>
 #include <sys/select.h>
 #include <sys/extent.h>
 #include <uvm/uvm_extern.h>
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <machine/bus_pio.h>
-#if defined(DIAGNOSTIC) && defined(__i386__)
-#include <sys/cpu.h>
-#endif
-#endif
 #include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/bus.h>
@@ -80,17 +71,7 @@
 /* Use bandwidth reclamation for control transfers. Some devices choke on it. */
 /*#define UHCI_CTL_LOOP */
 
-#if defined(__FreeBSD__)
-#include <machine/clock.h>
-
-#define delay(d)               DELAY(d)
-#endif
-
-#if defined(__OpenBSD__)
-struct cfdriver uhci_cd = {
-       NULL, "uhci", DV_DULL
-};
-#endif
+
 
 #ifdef UHCI_DEBUG
 uhci_softc_t *thesc;
@@ -98,9 +79,6 @@
 #define DPRINTFN(n,x)  if (uhcidebug>(n)) printf x
 int uhcidebug = 0;
 int uhcinoloop = 0;
-#ifndef __NetBSD__
-#define snprintb((q), (f), "%b", q,f,b,l) snprintf((b), (l))
-#endif
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n,x)
@@ -110,15 +88,6 @@
  * The UHCI controller is little endian, so on big endian machines
  * the data stored in memory needs to be swapped.
  */
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
-#if BYTE_ORDER == BIG_ENDIAN
-#define htole32(x) (bswap32(x))
-#define le32toh(x) (bswap32(x))
-#else
-#define htole32(x) (x)
-#define le32toh(x) (x)
-#endif
-#endif
 
 struct uhci_pipe {
        struct usbd_pipe pipe;
@@ -434,10 +403,8 @@
        uhci_globalreset(sc);                   /* reset the controller */
        uhci_reset(sc);
 
-#ifdef __NetBSD__
        usb_setup_reserve(sc->sc_dev, &sc->sc_dma_reserve, sc->sc_bus.dmatag,
            USB_MEM_RESERVE);
-#endif
 
        /* Allocate and initialize real frame array. */
        err = usb_allocmem(&sc->sc_bus,
@@ -570,24 +537,18 @@
        return err;
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 uhci_activate(device_t self, enum devact act)
 {
        struct uhci_softc *sc = device_private(self);
-       int rv = 0;
 
        switch (act) {
-       case DVACT_ACTIVATE:
-               return (EOPNOTSUPP);
-
        case DVACT_DEACTIVATE:
                sc->sc_dying = 1;
-               if (sc->sc_child != NULL)
-                       rv = config_deactivate(sc->sc_child);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       return (rv);
 }
 
 void
@@ -627,7 +588,6 @@
 
        return (rv);
 }
-#endif
 
 usbd_status
 uhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
@@ -660,23 +620,19 @@
 
 
        status = usb_allocmem(&sc->sc_bus, size, 0, dma);
-#ifdef __NetBSD__
        if (status == USBD_NOMEM)
                status = usb_reserve_allocm(&sc->sc_dma_reserve, dma, size);
-#endif
        return status;
 }
 
 void
 uhci_freem(struct usbd_bus *bus, usb_dma_t *dma)
 {
-#ifdef __NetBSD__
        if (dma->block->flags & USB_DMA_RESERVE) {
                usb_reserve_freem(&((struct uhci_softc *)bus)->sc_dma_reserve,
                    dma);
                return;
        }
-#endif
        usb_freemem(&((struct uhci_softc *)bus)->sc_bus, dma);
 }
 



Home | Main Index | Thread Index | Old Index