Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Make sure the HC deactivation is propagated.
details: https://anonhg.NetBSD.org/src/rev/a21837f870ff
branches: trunk
changeset: 476509:a21837f870ff
user: augustss <augustss%NetBSD.org@localhost>
date: Sat Sep 18 11:25:50 1999 +0000
description:
Make sure the HC deactivation is propagated.
diffstat:
sys/dev/usb/TODO | 2 ++
sys/dev/usb/ohci.c | 6 ++++--
sys/dev/usb/uhci.c | 6 ++++--
sys/dev/usb/usb.c | 43 ++++++++++++++++++-------------------------
4 files changed, 28 insertions(+), 29 deletions(-)
diffs (167 lines):
diff -r bf432787ea76 -r a21837f870ff sys/dev/usb/TODO
--- a/sys/dev/usb/TODO Sat Sep 18 09:45:05 1999 +0000
+++ b/sys/dev/usb/TODO Sat Sep 18 11:25:50 1999 +0000
@@ -30,6 +30,8 @@
Add isoc to OHCI driver.
+Do memory deallocation when HC driver is deactivated.
+
uaudio problems:
mixer names are awful, use some heuristics.
implement selector units
diff -r bf432787ea76 -r a21837f870ff sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Sat Sep 18 09:45:05 1999 +0000
+++ b/sys/dev/usb/ohci.c Sat Sep 18 11:25:50 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.48 1999/09/15 21:14:03 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.49 1999/09/18 11:25:50 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -295,7 +295,7 @@
device_ptr_t self;
enum devact act;
{
- /*struct ohci_softc *sc = (struct ohci_softc *)self;*/
+ struct ohci_softc *sc = (struct ohci_softc *)self;
int rv = 0;
switch (act) {
@@ -304,6 +304,8 @@
break;
case DVACT_DEACTIVATE:
+ if (sc->sc_child != NULL)
+ rv = config_deactivate(sc->sc_child);
break;
}
return (rv);
diff -r bf432787ea76 -r a21837f870ff sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Sat Sep 18 09:45:05 1999 +0000
+++ b/sys/dev/usb/uhci.c Sat Sep 18 11:25:50 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.55 1999/09/15 21:12:29 augustss Exp $ */
+/* $NetBSD: uhci.c,v 1.56 1999/09/18 11:25:51 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -421,7 +421,7 @@
device_ptr_t self;
enum devact act;
{
- /*struct uhci_softc *sc = (struct uhci_softc *)self;*/
+ struct uhci_softc *sc = (struct uhci_softc *)self;
int rv = 0;
switch (act) {
@@ -430,6 +430,8 @@
break;
case DVACT_DEACTIVATE:
+ if (sc->sc_child != NULL)
+ rv = config_deactivate(sc->sc_child);
break;
}
return (rv);
diff -r bf432787ea76 -r a21837f870ff sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Sat Sep 18 09:45:05 1999 +0000
+++ b/sys/dev/usb/usb.c Sat Sep 18 11:25:50 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.24 1999/09/15 21:10:11 augustss Exp $ */
+/* $NetBSD: usb.c,v 1.25 1999/09/18 11:25:51 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -99,10 +99,11 @@
USBBASEDEVICE sc_dev; /* base device */
usbd_bus_handle sc_bus; /* USB controller */
struct usbd_port sc_port; /* dummy port for root hub */
- char sc_exploring;
- char sc_dying;
+
struct selinfo sc_consel; /* waiting for connect change */
struct proc *sc_event_thread;
+
+ char sc_dying;
};
#if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -289,11 +290,6 @@
usbdebug = uhcidebug = ohcidebug = *(int *)data;
break;
#endif
-#if 0
- case USB_DISCOVER:
- usb_discover(sc);
- break;
-#endif
case USB_REQUEST:
{
struct usb_ctl_request *ur = (void *)data;
@@ -404,28 +400,19 @@
return (revents);
}
+/* Explore device tree from the root. */
usbd_status
usb_discover(sc)
struct usb_softc *sc;
{
- int s;
-
- /* Explore device tree from the root */
- /* We need mutual exclusion while traversing the device tree. */
+ /*
+ * We need mutual exclusion while traversing the device tree,
+ * but this is guaranteed since this function is only called
+ * from the event thread for the controller.
+ */
do {
- s = splusb();
- while (sc->sc_exploring)
- tsleep(&sc->sc_exploring, PRIBIO, "usbdis", 0);
- sc->sc_exploring = 1;
sc->sc_bus->needs_explore = 0;
- splx(s);
-
sc->sc_bus->root_hub->hub->explore(sc->sc_bus->root_hub);
-
- s = splusb();
- sc->sc_exploring = 0;
- wakeup(&sc->sc_exploring);
- splx(s);
} while (sc->sc_bus->needs_explore && !sc->sc_dying);
return (USBD_NORMAL_COMPLETION);
}
@@ -445,7 +432,8 @@
enum devact act;
{
struct usb_softc *sc = (struct usb_softc *)self;
- int rv = 0;
+ usbd_device_handle dev = sc->sc_port.device;
+ int i, rv = 0;
switch (act) {
case DVACT_ACTIVATE:
@@ -454,6 +442,10 @@
case DVACT_DEACTIVATE:
sc->sc_dying = 1;
+ if (dev && dev->cdesc && dev->subdevs) {
+ for (i = 0; dev->subdevs[i]; i++)
+ rv |= config_deactivate(dev->subdevs[i]);
+ }
break;
}
return (rv);
@@ -469,7 +461,8 @@
sc->sc_dying = 1;
/* Make all devices disconnect. */
- usb_disconnect_port(&sc->sc_port);
+ if (sc->sc_port.device)
+ usb_disconnect_port(&sc->sc_port);
/* Kill off event thread. */
if (sc->sc_event_thread) {
Home |
Main Index |
Thread Index |
Old Index