Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix some bugs in USB controller detach code.
details: https://anonhg.NetBSD.org/src/rev/386855c9d85e
branches: trunk
changeset: 477150:386855c9d85e
user: augustss <augustss%NetBSD.org@localhost>
date: Tue Oct 12 20:02:47 1999 +0000
description:
Fix some bugs in USB controller detach code.
diffstat:
sys/dev/usb/ohci.c | 9 +++++++--
sys/dev/usb/uhci.c | 9 ++++++++-
sys/dev/usb/uhub.c | 9 ++++-----
sys/dev/usb/usb.c | 10 ++++++++--
sys/dev/usb/usb_subr.c | 16 +++++++++-------
sys/dev/usb/usbdivar.h | 4 ++--
6 files changed, 38 insertions(+), 19 deletions(-)
diffs (184 lines):
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/ohci.c Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.50 1999/10/12 11:21:25 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.51 1999/10/12 20:02:47 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2052,7 +2052,12 @@
ohci_root_intr_abort(reqh)
usbd_request_handle reqh;
{
- /* No need to abort. */
+ if (reqh->pipe->intrreqh == reqh) {
+ DPRINTF(("ohci_root_intr_abort: remove\n"));
+ reqh->pipe->intrreqh = 0;
+ }
+ reqh->status = USBD_CANCELLED;
+ usb_transfer_complete(reqh);
}
/* Close the root pipe. */
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/uhci.c Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.57 1999/10/12 11:21:26 augustss Exp $ */
+/* $NetBSD: uhci.c,v 1.58 1999/10/12 20:02:47 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2853,6 +2853,13 @@
usb_untimeout(uhci_timo, reqh, reqh->timo_handle);
sc->sc_has_timo = 0;
+
+ if (reqh->pipe->intrreqh == reqh) {
+ DPRINTF(("uhci_root_intr_abort: remove\n"));
+ reqh->pipe->intrreqh = 0;
+ }
+ reqh->status = USBD_CANCELLED;
+ usb_transfer_complete(reqh);
}
usbd_status
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/uhub.c Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.30 1999/10/11 09:15:34 augustss Exp $ */
+/* $NetBSD: uhub.c,v 1.31 1999/10/12 20:02:47 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -374,9 +374,8 @@
if (up->device) {
/* Disconnected */
DPRINTF(("uhub_explore: device %d disappeared "
- "on port %d\n",
- up->device->address, port));
- usb_disconnect_port(up);
+ "on port %d\n", up->device->address, port));
+ usb_disconnect_port(up, USBDEV(sc->sc_dev));
usbd_clear_port_feature(dev, port,
UHF_C_PORT_CONNECTION);
}
@@ -479,7 +478,7 @@
for(p = 0; p < nports; p++) {
rup = &dev->hub->ports[p];
if (rup->device)
- usb_disconnect_port(rup);
+ usb_disconnect_port(rup, self);
}
free(dev->hub, M_USBDEV);
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/usb.c Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.26 1999/10/12 11:54:56 augustss Exp $ */
+/* $NetBSD: usb.c,v 1.27 1999/10/12 20:02:48 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -226,6 +226,8 @@
{
struct usb_softc *sc = arg;
+ DPRINTF(("usb_event_thread: start\n"));
+
while (!sc->sc_dying) {
#ifdef USB_DEBUG
if (!usb_noexplore)
@@ -240,6 +242,7 @@
/* In case parent is waiting for us to exit. */
wakeup(sc);
+ DPRINTF(("usb_event_thread: exit\n"));
kthread_exit(0);
}
@@ -594,11 +597,13 @@
{
struct usb_softc *sc = (struct usb_softc *)self;
+ DPRINTF(("usb_detach: start\n"));
+
sc->sc_dying = 1;
/* Make all devices disconnect. */
if (sc->sc_port.device)
- usb_disconnect_port(&sc->sc_port);
+ usb_disconnect_port(&sc->sc_port, self);
/* Kill off event thread. */
if (sc->sc_event_thread) {
@@ -606,6 +611,7 @@
if (tsleep(sc, PWAIT, "usbdet", hz * 60))
printf("%s: event thread didn't die\n",
USBDEVNAME(sc->sc_dev));
+ DPRINTF(("usb_detach: event thread dead\n"));
}
usbd_finish();
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/usb_subr.c Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.50 1999/10/12 11:54:56 augustss Exp $ */
+/* $NetBSD: usb_subr.c,v 1.51 1999/10/12 20:02:48 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1191,11 +1191,12 @@
* been disconnected.
*/
void
-usb_disconnect_port(up)
+usb_disconnect_port(up, parent)
struct usbd_port *up;
+ device_ptr_t parent;
{
usbd_device_handle dev = up->device;
- char *hubname;
+ char *hubname = USBDEVPTRNAME(parent);
int i;
DPRINTFN(3,("uhub_disconnect: up=%p dev=%p port=%d\n",
@@ -1216,11 +1217,12 @@
}
if (dev->subdevs) {
- hubname = USBDEVPTRNAME(up->parent->subdevs[0]);
for (i = 0; dev->subdevs[i]; i++) {
- printf("%s: at %s port %d (addr %d) disconnected\n",
- USBDEVPTRNAME(dev->subdevs[i]), hubname,
- up->portno, dev->address);
+ printf("%s: at %s", USBDEVPTRNAME(dev->subdevs[i]),
+ hubname);
+ if (up->portno != 0)
+ printf(" port %d", up->portno);
+ printf(" (addr %d) disconnected\n", dev->address);
config_detach(dev->subdevs[i], DETACH_FORCE);
}
}
diff -r 7d4081c01cb9 -r 386855c9d85e sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Tue Oct 12 19:40:51 1999 +0000
+++ b/sys/dev/usb/usbdivar.h Tue Oct 12 20:02:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.36 1999/10/12 11:54:57 augustss Exp $ */
+/* $NetBSD: usbdivar.h,v 1.37 1999/10/12 20:02:48 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -218,7 +218,7 @@
usbd_status usb_insert_transfer __P((usbd_request_handle reqh));
void usb_transfer_complete __P((usbd_request_handle reqh));
-void usb_disconnect_port __P((struct usbd_port *up));
+void usb_disconnect_port __P((struct usbd_port *up, device_ptr_t));
/* Routines from usb.c */
int usb_bus_count __P((void));
Home |
Main Index |
Thread Index |
Old Index