diff options
-rw-r--r-- | sys/dev/usb/utvfu.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/uvideo.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c index e0952bae1b2..102774056b2 100644 --- a/sys/dev/usb/utvfu.c +++ b/sys/dev/usb/utvfu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utvfu.c,v 1.6 2016/06/13 19:52:21 mglocker Exp $ */ +/* $OpenBSD: utvfu.c,v 1.7 2016/06/17 07:59:16 mglocker Exp $ */ /* * Copyright (c) 2013 Lubomir Rintel * Copyright (c) 2013 Federico Simoncelli @@ -1169,7 +1169,7 @@ utvfu_as_close(struct utvfu_softc *sc) if (sc->sc_audio.iface.pipeh != NULL) { usbd_abort_pipe(sc->sc_audio.iface.pipeh); - tsleep(&sc->sc_flags, 0, "audioclose", hz/2+1); + usbd_ref_wait(sc->sc_udev); usbd_close_pipe(sc->sc_audio.iface.pipeh); sc->sc_audio.iface.pipeh = NULL; @@ -1239,6 +1239,7 @@ utvfu_as_bulk_thread(void *arg) DPRINTF(1, "%s %s\n", DEVNAME(sc), __func__); iface = &sc->sc_audio.iface; + usbd_ref_incr(sc->sc_udev); while (ISSET(sc->sc_flags, UTVFU_FLAG_AS_RUNNING)) { usbd_setup_xfer( iface->xfer, @@ -1267,7 +1268,7 @@ utvfu_as_bulk_thread(void *arg) } CLR(sc->sc_flags, UTVFU_FLAG_AS_RUNNING); - wakeup(&sc->sc_flags); + usbd_ref_decr(sc->sc_udev); DPRINTF(1, "%s %s: exiting\n", DEVNAME(sc), __func__); 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); } |