Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nick-nhusb]: src/sys/dev/usb Remove tsleep(9) and wakeup(9) from urtwn(4)



details:   https://anonhg.NetBSD.org/src/rev/14d3f198ecb9
branches:  nick-nhusb
changeset: 334613:14d3f198ecb9
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jan 28 12:04:17 2017 +0000

description:
Remove tsleep(9) and wakeup(9) from urtwn(4)

diffstat:

 sys/dev/usb/TODO.usbmp    |   3 +--
 sys/dev/usb/if_urtwn.c    |  12 ++++++++----
 sys/dev/usb/if_urtwnvar.h |   3 ++-
 3 files changed, 11 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r e363d440d044 -r 14d3f198ecb9 sys/dev/usb/TODO.usbmp
--- a/sys/dev/usb/TODO.usbmp    Sat Jan 28 10:15:01 2017 +0000
+++ b/sys/dev/usb/TODO.usbmp    Sat Jan 28 12:04:17 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.9 2017/01/28 10:15:01 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.10 2017/01/28 12:04:17 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -97,7 +97,6 @@
 
 wakeup/tsleep drivers:
   - if_run.c
-  - if_urtwn.c
   - if_zyd.c
   - ucycom.c
   - udsir.c
diff -r e363d440d044 -r 14d3f198ecb9 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Sat Jan 28 10:15:01 2017 +0000
+++ b/sys/dev/usb/if_urtwn.c    Sat Jan 28 12:04:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.34.4.15 2016/12/05 10:55:18 skrll Exp $ */
+/*     $NetBSD: if_urtwn.c,v 1.34.4.16 2017/01/28 12:04:17 skrll Exp $ */
 /*     $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $       */
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.4.15 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.4.16 2017/01/28 12:04:17 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -372,6 +372,7 @@
 
        (void) usbd_do_request(sc->sc_udev, &req, 0);
 
+       cv_init(&sc->sc_task_cv, "urtwntsk");
        mutex_init(&sc->sc_task_mtx, MUTEX_DEFAULT, IPL_NET);
        mutex_init(&sc->sc_tx_mtx, MUTEX_DEFAULT, IPL_NONE);
        mutex_init(&sc->sc_rx_mtx, MUTEX_DEFAULT, IPL_NONE);
@@ -559,6 +560,7 @@
        callout_destroy(&sc->sc_scan_to);
        callout_destroy(&sc->sc_calib_to);
 
+       cv_destroy(&sc->sc_task_cv);
        mutex_destroy(&sc->sc_write_mtx);
        mutex_destroy(&sc->sc_fwcmd_mtx);
        mutex_destroy(&sc->sc_tx_mtx);
@@ -823,8 +825,8 @@
                ring->queued--;
                ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
        }
+       cv_broadcast(&sc->sc_task_cv);
        mutex_spin_exit(&sc->sc_task_mtx);
-       wakeup(&sc->cmdq);
        splx(s);
 }
 
@@ -863,8 +865,10 @@
        DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
 
        /* Wait for all queued asynchronous commands to complete. */
+       mutex_spin_enter(&sc->sc_task_mtx);
        while (sc->cmdq.queued > 0)
-               tsleep(&sc->cmdq, 0, "endtask", 0);
+               cv_wait(&sc->sc_task_cv, &sc->sc_task_mtx);
+       mutex_spin_exit(&sc->sc_task_mtx);
 }
 
 static int
diff -r e363d440d044 -r 14d3f198ecb9 sys/dev/usb/if_urtwnvar.h
--- a/sys/dev/usb/if_urtwnvar.h Sat Jan 28 10:15:01 2017 +0000
+++ b/sys/dev/usb/if_urtwnvar.h Sat Jan 28 12:04:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwnvar.h,v 1.8.4.4 2016/12/05 10:55:18 skrll Exp $        */
+/*     $NetBSD: if_urtwnvar.h,v 1.8.4.5 2017/01/28 12:04:17 skrll Exp $        */
 /*     $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $  */
 
 /*-
@@ -128,6 +128,7 @@
        callout_t                       sc_scan_to;
        callout_t                       sc_calib_to;
 
+       kcondvar_t                      sc_task_cv;
        kmutex_t                        sc_task_mtx;
        kmutex_t                        sc_fwcmd_mtx;
        kmutex_t                        sc_tx_mtx;



Home | Main Index | Thread Index | Old Index