[PATCH 02/12] Bluetooth: Change SCO conn lock to mutex

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

 



From: "Gustavo F. Padovan" <padovan@xxxxxxxxxxxxxx>

As part of the moving to process context, we will need to change
bh_lock_sock() to lock_sock() in the SCO code, but first the SCO
connection lock need to be moved to mutex otherwise we can not use
lock_sock() in a region locked by it. (i.e., we can't sleep inside a
spinlock critical session)

Signed-off-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>
---
 include/net/bluetooth/sco.h |    6 +++---
 net/bluetooth/sco.c         |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index fc1cf9d..1bd0d62 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -58,14 +58,14 @@ struct sco_conn {
 	bdaddr_t	*dst;
 	bdaddr_t	*src;
 
-	spinlock_t	lock;
+	struct mutex	lock;
 	struct sock	*sk;
 
 	unsigned int    mtu;
 };
 
-#define sco_conn_lock(c)	spin_lock(&c->lock);
-#define sco_conn_unlock(c)	spin_unlock(&c->lock);
+#define sco_conn_lock(c)	mutex_lock(&c->lock);
+#define sco_conn_unlock(c)	mutex_unlock(&c->lock);
 
 /* ----- SCO socket info ----- */
 #define sco_pi(sk) ((struct sco_pinfo *) sk)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 8057a4b..36fe9eb 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -114,7 +114,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
 	if (!conn)
 		return NULL;
 
-	spin_lock_init(&conn->lock);
+	mutex_init(&conn->lock);
 
 	hcon->sco_data = conn;
 	conn->hcon = hcon;
-- 
1.7.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux