Module Name:    src
Committed By:   skrll
Date:           Sat Oct 17 10:24:59 UTC 2015

Modified Files:
        src/sys/dev/usb [nick-nhusb]: TODO.usbmp if_athn_usb.c if_athn_usb.h

Log Message:
Remove a tsleep


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.2 -r1.8.4.3 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.6.8.6 -r1.6.8.7 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.2.16.2 -r1.2.16.3 src/sys/dev/usb/if_athn_usb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.2 src/sys/dev/usb/TODO.usbmp:1.8.4.3
--- src/sys/dev/usb/TODO.usbmp:1.8.4.2	Mon Apr  6 15:18:13 2015
+++ src/sys/dev/usb/TODO.usbmp	Sat Oct 17 10:24:58 2015
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.2 2015/04/06 15:18:13 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.3 2015/10/17 10:24:58 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -90,7 +90,6 @@ splusb drivers:
   - udsir.c
 
 wakeup/tsleep drivers:
-  - if_athn_usb.c
   - if_otus.c
   - if_run.c
   - if_upgt.c

Index: src/sys/dev/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.8.6 src/sys/dev/usb/if_athn_usb.c:1.6.8.7
--- src/sys/dev/usb/if_athn_usb.c:1.6.8.6	Tue Oct  6 21:32:15 2015
+++ src/sys/dev/usb/if_athn_usb.c	Sat Oct 17 10:24:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.8.6 2015/10/06 21:32:15 skrll Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.8.7 2015/10/17 10:24:59 skrll Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.8.6 2015/10/06 21:32:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.8.7 2015/10/17 10:24:59 skrll Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -267,6 +267,7 @@ athn_usb_attach(device_t parent, device_
 	sc->sc_ops.write = athn_usb_write;
 	sc->sc_ops.write_barrier = athn_usb_write_barrier;
 
+	cv_init(&usc->usc_task_cv, "athntsk");
 	mutex_init(&usc->usc_task_mtx, MUTEX_DEFAULT, IPL_NET);
 	mutex_init(&usc->usc_tx_mtx, MUTEX_DEFAULT, IPL_NONE);
 
@@ -466,6 +467,7 @@ athn_usb_detach(device_t self, int flags
 
 	mutex_destroy(&usc->usc_tx_mtx);
 	mutex_destroy(&usc->usc_task_mtx);
+	cv_destroy(&usc->usc_task_cv);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, usc->usc_udev, sc->sc_dev);
 	return 0;
@@ -781,8 +783,10 @@ athn_usb_wait_async(struct athn_usb_soft
 	DPRINTFN(DBG_FN, usc, "\n");
 
 	/* Wait for all queued asynchronous commands to complete. */
+	mutex_spin_enter(&usc->usc_task_mtx);
 	while (usc->usc_cmdq.queued > 0)
-		tsleep(&usc->usc_cmdq, 0, "cmdq", 0);
+		cv_wait(&usc->usc_task_cv, &usc->usc_task_mtx);
+	mutex_spin_exit(&usc->usc_task_mtx);
 }
 
 Static int

Index: src/sys/dev/usb/if_athn_usb.h
diff -u src/sys/dev/usb/if_athn_usb.h:1.2.16.2 src/sys/dev/usb/if_athn_usb.h:1.2.16.3
--- src/sys/dev/usb/if_athn_usb.h:1.2.16.2	Thu Mar 19 17:26:42 2015
+++ src/sys/dev/usb/if_athn_usb.h	Sat Oct 17 10:24:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.h,v 1.2.16.2 2015/03/19 17:26:42 skrll Exp $	*/
+/*	$NetBSD: if_athn_usb.h,v 1.2.16.3 2015/10/17 10:24:59 skrll Exp $	*/
 /*	$OpenBSD: if_athn_usb.h,v 1.3 2012/11/10 14:35:06 mikeb Exp $	*/
 
 /*-
@@ -443,6 +443,7 @@ struct athn_usb_softc {
 
 	int				usc_athn_attached;
 
+	kcondvar_t			usc_task_cv;
 	kmutex_t			usc_task_mtx;
 	kmutex_t			usc_tx_mtx;
 

Reply via email to