Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/bluetooth no need to acquire thread lock in btsco_op...



details:   https://anonhg.NetBSD.org/src/rev/843d06b44101
branches:  trunk
changeset: 771944:843d06b44101
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Dec 10 16:16:11 2011 +0000

description:
no need to acquire thread lock in btsco_open / btsco_close, as they are
already held by MI audio when these methods are called

diffstat:

 sys/dev/bluetooth/btsco.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r 2f092c1685ba -r 843d06b44101 sys/dev/bluetooth/btsco.c
--- a/sys/dev/bluetooth/btsco.c Sat Dec 10 05:53:58 2011 +0000
+++ b/sys/dev/bluetooth/btsco.c Sat Dec 10 16:16:11 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btsco.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $      */
+/*     $NetBSD: btsco.c,v 1.26 2011/12/10 16:16:11 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.26 2011/12/10 16:16:11 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -576,7 +576,7 @@
        if (sc->sc_sco != NULL || sc->sc_sco_l != NULL)
                return EIO;
 
-       mutex_enter(bt_lock);
+       KASSERT(mutex_owned(bt_lock));
 
        memset(&sa, 0, sizeof(sa));
        sa.bt_len = sizeof(sa);
@@ -653,8 +653,6 @@
        }
 
 done:
-       mutex_exit(bt_lock);
-
        DPRINTF("done err=%d, sc_state=%d, sc_mtu=%d\n",
                        err, sc->sc_state, sc->sc_mtu);
        return err;
@@ -667,7 +665,8 @@
 
        DPRINTF("%s\n", sc->sc_name);
 
-       mutex_enter(bt_lock);
+       KASSERT(mutex_owned(bt_lock));
+
        if (sc->sc_sco != NULL) {
                sco_disconnect(sc->sc_sco, 0);
                sco_detach(&sc->sc_sco);
@@ -676,7 +675,6 @@
        if (sc->sc_sco_l != NULL) {
                sco_detach(&sc->sc_sco_l);
        }
-       mutex_exit(bt_lock);
 
        if (sc->sc_rx_mbuf != NULL) {
                m_freem(sc->sc_rx_mbuf);



Home | Main Index | Thread Index | Old Index