Make sure the HC deactivation is propagated.

This commit is contained in:
augustss 1999-09-18 11:25:50 +00:00
parent d1c5384e9a
commit fb7795c908
4 changed files with 28 additions and 29 deletions

View File

@ -30,6 +30,8 @@ Add generic ucom layer for serial adapters.
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

View File

@ -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 @@ ohci_activate(self, act)
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 @@ ohci_activate(self, act)
break;
case DVACT_DEACTIVATE:
if (sc->sc_child != NULL)
rv = config_deactivate(sc->sc_child);
break;
}
return (rv);

View File

@ -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 @@ uhci_activate(self, act)
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 @@ uhci_activate(self, act)
break;
case DVACT_DEACTIVATE:
if (sc->sc_child != NULL)
rv = config_deactivate(sc->sc_child);
break;
}
return (rv);

View File

@ -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 @@ struct usb_softc {
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__)
@ -288,11 +289,6 @@ usbioctl(dev, cmd, data, flag, p)
case USB_SETDEBUG:
usbdebug = uhcidebug = ohcidebug = *(int *)data;
break;
#endif
#if 0
case USB_DISCOVER:
usb_discover(sc);
break;
#endif
case USB_REQUEST:
{
@ -404,28 +400,19 @@ usbpoll(dev, events, p)
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 @@ usb_activate(self, act)
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 @@ usb_activate(self, act)
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 @@ usb_detach(self, flags)
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) {