Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb avoid taking the thread lock when the kernel loc...



details:   https://anonhg.NetBSD.org/src/rev/aa5e78c88fd8
branches:  trunk
changeset: 771613:aa5e78c88fd8
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Nov 26 13:31:52 2011 +0000

description:
avoid taking the thread lock when the kernel lock is needed.
now umidi detaches successfully.

diffstat:

 sys/dev/usb/umidi.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r 34037a7b15a8 -r aa5e78c88fd8 sys/dev/usb/umidi.c
--- a/sys/dev/usb/umidi.c       Sat Nov 26 13:22:09 2011 +0000
+++ b/sys/dev/usb/umidi.c       Sat Nov 26 13:31:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umidi.c,v 1.52 2011/11/26 13:22:09 mrg Exp $   */
+/*     $NetBSD: umidi.c,v 1.53 2011/11/26 13:31:52 mrg Exp $   */
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.52 2011/11/26 13:22:09 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.53 2011/11/26 13:31:52 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -298,15 +298,13 @@
 
        DPRINTFN(1,("umidi_detach\n"));
 
-       mutex_enter(&sc->sc_lock);
        sc->sc_dying = 1;
+       KERNEL_LOCK(1, curlwp);
        detach_all_mididevs(sc, flags);
        free_all_mididevs(sc);
        free_all_jacks(sc);
        free_all_endpoints(sc);
-       mutex_exit(&sc->sc_lock);
 
-       KERNEL_LOCK(1, curlwp);
        usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
                           sc->sc_dev);
        KERNEL_UNLOCK_ONE(curlwp);



Home | Main Index | Thread Index | Old Index