summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uvideo.c
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2016-06-17 07:59:17 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2016-06-17 07:59:17 +0000
commit771b1ec768f93665464b623faa90530a595e6851 (patch)
tree9acdbe3330b1b1c2282618fb9c63ec1fbe72be71 /sys/dev/usb/uvideo.c
parentfa9ae5df14e6da25616834fa53c1c234b7b8248f (diff)
Replace tsleep/wakeup by usbd_ref_incr/decr/wait to wait for the kthread
to finish on close. Tested and ok Patrick Keshishian ok mpi
Diffstat (limited to 'sys/dev/usb/uvideo.c')
-rw-r--r--sys/dev/usb/uvideo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index be21bc2dcf7..83a48ae1100 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.191 2016/06/15 11:40:56 mpi Exp $ */
+/* $OpenBSD: uvideo.c,v 1.192 2016/06/17 07:59:16 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -1835,7 +1835,7 @@ uvideo_vs_close(struct uvideo_softc *sc)
{
if (sc->sc_vs_cur->bulk_running == 1) {
sc->sc_vs_cur->bulk_running = 0;
- (void)tsleep(&sc->sc_vs_cur->bulk_running, 0, "vid_close", 0);
+ usbd_ref_wait(sc->sc_udev);
}
if (sc->sc_vs_cur->pipeh) {
@@ -1910,6 +1910,7 @@ uvideo_vs_start_bulk_thread(void *arg)
usbd_status error;
int size;
+ usbd_ref_incr(sc->sc_udev);
while (sc->sc_vs_cur->bulk_running) {
size = UGETDW(sc->sc_desc_probe.dwMaxPayloadTransferSize);
@@ -1934,7 +1935,7 @@ uvideo_vs_start_bulk_thread(void *arg)
(void)sc->sc_decode_stream_header(sc,
sc->sc_vs_cur->bxfer.buf, size);
}
- wakeup(&sc->sc_vs_cur->bulk_running);
+ usbd_ref_decr(sc->sc_udev);
kthread_exit(0);
}