diff options
author | 2014-07-12 07:11:17 +0000 | |
---|---|---|
committer | 2014-07-12 07:11:17 +0000 | |
commit | 806fffbd7a4e408702ecfbd2300bcdddce35ac3f (patch) | |
tree | 895741950775072de985909094f31b875ffaa263 | |
parent | sync (diff) | |
download | wireguard-openbsd-806fffbd7a4e408702ecfbd2300bcdddce35ac3f.tar.xz wireguard-openbsd-806fffbd7a4e408702ecfbd2300bcdddce35ac3f.zip |
Only detach the USB device you disconnected, fix a regression reported
by guenther@.
While here set the dying flag of the disconnected device so that most of
the DVACT_ACTIVATE handlers can go.
-rw-r--r-- | sys/dev/usb/usb_subr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 2bf4124fba2..cde1e55c8eb 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.103 2014/07/10 11:47:14 mpi Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.104 2014/07/12 07:11:17 mpi Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1475,9 +1475,13 @@ usb_free_device(struct usbd_device *dev) int usbd_detach(struct usbd_device *dev, struct device *parent) { - int rv; + int i, rv = 0; + + usbd_deactivate(dev); + + for (i = 0; dev->subdevs[i] != NULL; i++) + rv |= config_detach(dev->subdevs[i], DETACH_FORCE); - rv = config_detach_children(parent, DETACH_FORCE); if (rv == 0) usb_free_device(dev); |