From owner-svn-src-user@FreeBSD.ORG Fri Sep 10 23:55:28 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 405EA106564A; Fri, 10 Sep 2010 23:55:28 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E0E68FC0A; Fri, 10 Sep 2010 23:55:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ANtSl6002339; Fri, 10 Sep 2010 23:55:28 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ANtSnL002337; Fri, 10 Sep 2010 23:55:28 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201009102355.o8ANtSnL002337@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 10 Sep 2010 23:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212444 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 23:55:28 -0000 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); } /*------------------------------------------------------------------------*