svn commit: r212444 - user/weongyo/usb/sys/dev/usb

Weongyo Jeong weongyo at FreeBSD.org
Fri Sep 10 23:55:28 UTC 2010


Author: weongyo
Date: Fri Sep 10 23:55:27 2010
New Revision: 212444
URL: http://svn.freebsd.org/changeset/base/212444

Log:
  Uses mtx_sleep(9) instead of explicitly dropping the lock that it'll do
  the samething what we want to do.

Modified:
  user/weongyo/usb/sys/dev/usb/usb_util.c

Modified: user/weongyo/usb/sys/dev/usb/usb_util.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_util.c	Fri Sep 10 23:49:33 2010	(r212443)
+++ user/weongyo/usb/sys/dev/usb/usb_util.c	Fri Sep 10 23:55:27 2010	(r212444)
@@ -146,8 +146,7 @@ device_set_usb_desc(device_t dev)
 void
 usb_pause_mtx(struct mtx *mtx, int _ticks)
 {
-	if (mtx != NULL)
-		mtx_unlock(mtx);
+	int tmpchan;
 
 	if (cold) {
 		/* convert to milliseconds */
@@ -163,13 +162,12 @@ usb_pause_mtx(struct mtx *mtx, int _tick
 		 * too early!
 		 */
 		_ticks++;
-
-		if (pause("USBWAIT", _ticks)) {
-			/* ignore */
-		}
+		if (mtx != NULL)
+			(void)mtx_sleep(&tmpchan, mtx, USB_PRI_MED, "USBWAIT",
+			    _ticks);
+		else
+			(void)pause("USBWAIT", _ticks);
 	}
-	if (mtx != NULL)
-		mtx_lock(mtx);
 }
 
 /*------------------------------------------------------------------------*


More information about the svn-src-user mailing list