summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-07-12 07:18:16 +0000
committermpi <mpi@openbsd.org>2014-07-12 07:18:16 +0000
commitf3b163f75308d52388fca08f9bd28f0347dfcdf1 (patch)
tree09435071724a3d95b37ff92434ab81ff4948c678
parentOnly detach the USB device you disconnected, fix a regression reported (diff)
downloadwireguard-openbsd-f3b163f75308d52388fca08f9bd28f0347dfcdf1.tar.xz
wireguard-openbsd-f3b163f75308d52388fca08f9bd28f0347dfcdf1.zip
Remove incorrect comment about how autoconf(9) works and document
that usbd_detach() should only be called by the thread doing USB bus exploration to prevent attach/detach races.
-rw-r--r--sys/dev/usb/usb_subr.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index cde1e55c8eb..3e8cf514b92 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.104 2014/07/12 07:11:17 mpi Exp $ */
+/* $OpenBSD: usb_subr.c,v 1.105 2014/07/12 07:18:16 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 $ */
@@ -1456,21 +1456,8 @@ usb_free_device(struct usbd_device *dev)
}
/*
- * The general mechanism for detaching drivers works as follows: Each
- * driver is responsible for maintaining a reference count on the
- * number of outstanding references to its softc (e.g. from
- * processing hanging in a read or write). The detach method of the
- * driver decrements this counter and flags in the softc that the
- * driver is dying and then wakes any sleepers. It then sleeps on the
- * softc. Each place that can sleep must maintain the reference
- * count. When the reference count drops to -1 (0 is the normal value
- * of the reference count) the a wakeup on the softc is performed
- * signaling to the detach waiter that all references are gone.
- */
-
-/*
- * Called from process context when we discover that a port has
- * been disconnected.
+ * Should only be called by the USB thread doing bus exploration to
+ * avoid connect/disconnect races.
*/
int
usbd_detach(struct usbd_device *dev, struct device *parent)