aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-02-18 07:53:55 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-02-19 02:44:28 -0500
commitfba7ecf09bc458b15f9d578e4213c8c349f9592d (patch)
treeb479fe60d7d4d2853cf3c9cd740414c9125f8364 /net/bluetooth
parent00629e0fd56d528f0da4d9606726a4e22e576ace (diff)
Bluetooth: Convert hci_cb_list_lock to a mutex
We'll soon need to be able to sleep inside the loops that iterate the hci_cb list, so neither a spinlock, rwlock or rcu are usable. This patch changes the lock to a mutex which permits sleeping while holding the lock. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 91f557b0318a..dbd26bcb9210 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -51,7 +51,7 @@ DEFINE_RWLOCK(hci_dev_list_lock);
51 51
52/* HCI callback list */ 52/* HCI callback list */
53LIST_HEAD(hci_cb_list); 53LIST_HEAD(hci_cb_list);
54DEFINE_RWLOCK(hci_cb_list_lock); 54DEFINE_MUTEX(hci_cb_list_lock);
55 55
56/* HCI ID Numbering */ 56/* HCI ID Numbering */
57static DEFINE_IDA(hci_index_ida); 57static DEFINE_IDA(hci_index_ida);
@@ -3464,9 +3464,9 @@ int hci_register_cb(struct hci_cb *cb)
3464{ 3464{
3465 BT_DBG("%p name %s", cb, cb->name); 3465 BT_DBG("%p name %s", cb, cb->name);
3466 3466
3467 write_lock(&hci_cb_list_lock); 3467 mutex_lock(&hci_cb_list_lock);
3468 list_add_tail(&cb->list, &hci_cb_list); 3468 list_add_tail(&cb->list, &hci_cb_list);
3469 write_unlock(&hci_cb_list_lock); 3469 mutex_unlock(&hci_cb_list_lock);
3470 3470
3471 return 0; 3471 return 0;
3472} 3472}
@@ -3476,9 +3476,9 @@ int hci_unregister_cb(struct hci_cb *cb)
3476{ 3476{
3477 BT_DBG("%p name %s", cb, cb->name); 3477 BT_DBG("%p name %s", cb, cb->name);
3478 3478
3479 write_lock(&hci_cb_list_lock); 3479 mutex_lock(&hci_cb_list_lock);
3480 list_del(&cb->list); 3480 list_del(&cb->list);
3481 write_unlock(&hci_cb_list_lock); 3481 mutex_unlock(&hci_cb_list_lock);
3482 3482
3483 return 0; 3483 return 0;
3484} 3484}