summaryrefslogtreecommitdiff
path: root/sys/dev/usb/usbdi.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-11 18:30:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-11 18:30:51 +0000
commitcb538c3cbe26e67bac2b85c75da7259a005d264e (patch)
tree694f7d46090bea822baee9de257c2e4b36c48a69 /sys/dev/usb/usbdi.c
parent34c122070511a878f53978ec92c6f596fa88cc4d (diff)
serialize usbd_probe_and_attach(); only let one usb device be match'd and
attached at a time; ok kettenis
Diffstat (limited to 'sys/dev/usb/usbdi.c')
-rw-r--r--sys/dev/usb/usbdi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 4a8e0e2f1df..eed4a617f61 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi.c,v 1.33 2007/06/18 11:37:04 mbalmer Exp $ */
+/* $OpenBSD: usbdi.c,v 1.34 2007/10/11 18:30:50 deraadt Exp $ */
/* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
@@ -45,6 +45,7 @@
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/proc.h>
+#include <sys/rwlock.h>
#include <machine/bus.h>
@@ -72,9 +73,13 @@ usbd_status usbd_open_pipe_ival(usbd_interface_handle, u_int8_t, u_int8_t,
int usbd_nbuses = 0;
+struct rwlock usbpalock;
+
void
usbd_init(void)
{
+ if (usbd_nbuses == 0)
+ rw_init(&usbpalock, "usbpalock");
usbd_nbuses++;
}