summaryrefslogtreecommitdiff
path: root/sys/dev/usb/ohci.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-03-25 20:27:38 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-03-25 20:27:38 +0000
commit3392fd3119db5e6a9c63c934fed6faa4a1970f69 (patch)
tree331c9e0cad371dd7b79eb5d5920f8c497729a959 /sys/dev/usb/ohci.c
parenta3554f2ddd62572187d3fc11b3418c6377b332c4 (diff)
Instead of matching root hubs with a custom address, that only works
because USB_START_ADDR is defined to 0 and the softc is M_ZERO'd, assume that root hubs are the only devices with a depth of 0. Root hubs can now happily be detached and reattached.
Diffstat (limited to 'sys/dev/usb/ohci.c')
-rw-r--r--sys/dev/usb/ohci.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index ef46ab4518c..9134bffbc1c 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.123 2014/03/15 09:49:28 mpi Exp $ */
+/* $OpenBSD: ohci.c,v 1.124 2014/03/25 20:27:37 mpi Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -1950,8 +1950,8 @@ ohci_open(struct usbd_pipe *pipe)
int s;
int ival;
- DPRINTFN(1, ("ohci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
- pipe, addr, ed->bEndpointAddress, sc->sc_addr));
+ DPRINTFN(1, ("ohci_open: pipe=%p, addr=%d, endpt=%d\n",
+ pipe, addr, ed->bEndpointAddress));
if (sc->sc_bus.dying)
return (USBD_IOERROR);
@@ -1959,7 +1959,8 @@ ohci_open(struct usbd_pipe *pipe)
std = NULL;
sed = NULL;
- if (addr == sc->sc_addr) {
+ /* Root Hub */
+ if (pipe->device->depth == 0) {
switch (ed->bEndpointAddress) {
case USB_CONTROL_ENDPOINT:
pipe->methods = &ohci_root_ctrl_methods;
@@ -2408,7 +2409,6 @@ ohci_root_ctrl_start(struct usbd_xfer *xfer)
err = USBD_IOERROR;
goto ret;
}
- sc->sc_addr = value;
break;
case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
if (value != 0 && value != 1) {