Source-Changes-HG archive

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

[src/jmcneill-usbmp]: src/sys/dev/usb take the thread lock earlier in uhci_de...



details:   https://anonhg.NetBSD.org/src/rev/d618e12ad118
branches:  jmcneill-usbmp
changeset: 771841:d618e12ad118
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Apr 06 08:11:41 2012 +0000

description:
take the thread lock earlier in uhci_device_intr_start().
avoids failed mutex owned asserts, and now bt* work.

diffstat:

 sys/dev/usb/uhci.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 9122db75a2de -r d618e12ad118 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Thu Apr 05 22:32:08 2012 +0000
+++ b/sys/dev/usb/uhci.c        Fri Apr 06 08:11:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.240.6.19 2012/04/05 22:32:09 mrg Exp $      */
+/*     $NetBSD: uhci.c,v 1.240.6.20 2012/04/06 08:11:41 mrg Exp $      */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.19 2012/04/05 22:32:09 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.20 2012/04/06 08:11:41 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -2320,6 +2320,8 @@
                panic("uhci_device_intr_transfer: a request");
 #endif
 
+       mutex_enter(&sc->sc_lock);
+
        endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
        isread = UE_GET_DIR(endpt) == UE_DIR_IN;
 
@@ -2328,8 +2330,11 @@
        err = uhci_alloc_std_chain(upipe, sc, xfer->length, isread,
                                   xfer->flags, &xfer->dmabuf, &data,
                                   &dataend);
-       if (err)
+       if (err) {
+               mutex_exit(&sc->sc_lock);
                return (err);
+       }
+
        dataend->td.td_status |= htole32(UHCI_TD_IOC);
        usb_syncmem(&dataend->dma,
            dataend->offs + offsetof(uhci_td_t, td_status),
@@ -2344,7 +2349,6 @@
        }
 #endif
 
-       mutex_enter(&sc->sc_lock);
        /* Set up interrupt info. */
        ii->xfer = xfer;
        ii->stdstart = data;



Home | Main Index | Thread Index | Old Index