diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-12 07:11:18 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-07-12 07:11:18 +0000 |
commit | a563b89707bd4603209e441732baeb5b3aff355e (patch) | |
tree | 5ea046aa88477d2b471b04f59e19f8088758c62c /sys | |
parent | ec264db841a7e813b194abfee7a33b5724d81b2a (diff) |
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.
Diffstat (limited to 'sys')
-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); |