summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-11 16:33:22 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-11 16:33:22 +0000
commitcccbd940537ba838440e5c7b60d015db472eec4a (patch)
treea97ea9f299e5602673a331f74ceb3f022c19306c /sys/dev/usb
parent2b8a0abce3e4bb449e920faece472fcc44e7e6a3 (diff)
The relation between uhci(4), ohci(4) and their root hub device is
delicate. HC drivers do not always accept to be left alone. I don't know if it is a love crisis, but apparently receiving a root hub status change interrupt before having an uhub(4) attached breaks resume. So make sure the root hub is re-attached before interrupt get enabled. It is safe to do it during DVACT_RESUME since attaching root hubs do not require any USB transfer. Based on a diff from yasuoka@, fix a regression introduced in last commit an reported by Abel Abraham Camarillo Ojeda on tech@ and Nils R on bugs@.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usb.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 15a43b62bcd..ff5c3b3d2a5 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.95 2014/03/31 16:18:06 mpi Exp $ */
+/* $OpenBSD: usb.c,v 1.96 2014/05/11 16:33:21 mpi Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -900,10 +900,19 @@ usb_activate(struct device *self, int act)
if (sc->sc_bus->root_hub != NULL)
usb_detach_roothub(sc);
break;
- case DVACT_WAKEUP:
+ case DVACT_RESUME:
sc->sc_bus->dying = 0;
+
+ /*
+ * Make sure the root hub is present before interrupts
+ * get enabled. As long as the bus is in polling mode
+ * it is safe to call usbd_new_device() now since root
+ * hub transfers do not need to sleep.
+ */
+ sc->sc_bus->use_polling++;
if (!usb_attach_roothub(sc))
usb_needs_explore(sc->sc_bus->root_hub, 0);
+ sc->sc_bus->use_polling--;
break;
case DVACT_DEACTIVATE:
rv = config_activate_children(self, act);