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 Don't supply the lock to callout_halt when ...



details:   https://anonhg.NetBSD.org/src/rev/127684a6f20d
branches:  nick-nhusb
changeset: 804711:127684a6f20d
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Dec 27 08:32:19 2016 +0000

description:
Don't supply the lock to callout_halt when polling as it won't be held

diffstat:

 sys/dev/usb/ohci.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 0383637256f2 -r 127684a6f20d sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sat Dec 17 15:30:34 2016 +0000
+++ b/sys/dev/usb/ohci.c        Tue Dec 27 08:32:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.254.2.81 2016/12/17 10:10:34 skrll Exp $    */
+/*     $NetBSD: ohci.c,v 1.254.2.82 2016/12/27 08:32:19 skrll Exp $    */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.81 2016/12/17 10:10:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.82 2016/12/27 08:32:19 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1402,8 +1402,9 @@
        int len, cc;
        int i, j, actlen, iframes, uedir;
        ohci_physaddr_t done = 0;
-
-       KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
+       bool polling = sc->sc_bus.ub_usepolling;
+
+       KASSERT(polling || mutex_owned(&sc->sc_lock));
 
        OHCIHIST_FUNC(); OHCIHIST_CALLED();
 
@@ -1491,7 +1492,7 @@
                 * Make sure the timeout handler didn't run or ran to the end
                 * and set the transfer status.
                 */
-               callout_halt(&xfer->ux_callout, &sc->sc_lock);
+               callout_halt(&xfer->ux_callout, polling ? NULL : &sc->sc_lock);
 
                if (xfer->ux_status == USBD_CANCELLED ||
                    xfer->ux_status == USBD_TIMEOUT) {



Home | Main Index | Thread Index | Old Index