diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-09 01:41:30 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-18 14:07:56 -0500 |
commit | 67d0dfb5ec781e9fe030e4e61359ee6eed66ff92 (patch) | |
tree | e1172afdb7a534ad8093bf79fe87a42f4c364f80 | |
parent | eb403a1b7eea9d736c55f78407dccb42b72757a4 (diff) |
Bluetooth: move hci_task_lock to mutex
Now we can sleep in any path inside Bluetooth core, so mutex can make
sense here.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | net/bluetooth/hci_core.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 6f5bb3cbf6f6..36763aa59ea1 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -60,7 +60,7 @@ static void hci_rx_work(struct work_struct *work); | |||
60 | static void hci_cmd_task(unsigned long arg); | 60 | static void hci_cmd_task(unsigned long arg); |
61 | static void hci_tx_task(unsigned long arg); | 61 | static void hci_tx_task(unsigned long arg); |
62 | 62 | ||
63 | static DEFINE_RWLOCK(hci_task_lock); | 63 | static DEFINE_MUTEX(hci_task_lock); |
64 | 64 | ||
65 | /* HCI device list */ | 65 | /* HCI device list */ |
66 | LIST_HEAD(hci_dev_list); | 66 | LIST_HEAD(hci_dev_list); |
@@ -1808,14 +1808,14 @@ int hci_register_proto(struct hci_proto *hp) | |||
1808 | if (hp->id >= HCI_MAX_PROTO) | 1808 | if (hp->id >= HCI_MAX_PROTO) |
1809 | return -EINVAL; | 1809 | return -EINVAL; |
1810 | 1810 | ||
1811 | write_lock_bh(&hci_task_lock); | 1811 | mutex_lock(&hci_task_lock); |
1812 | 1812 | ||
1813 | if (!hci_proto[hp->id]) | 1813 | if (!hci_proto[hp->id]) |
1814 | hci_proto[hp->id] = hp; | 1814 | hci_proto[hp->id] = hp; |
1815 | else | 1815 | else |
1816 | err = -EEXIST; | 1816 | err = -EEXIST; |
1817 | 1817 | ||
1818 | write_unlock_bh(&hci_task_lock); | 1818 | mutex_unlock(&hci_task_lock); |
1819 | 1819 | ||
1820 | return err; | 1820 | return err; |
1821 | } | 1821 | } |
@@ -1830,14 +1830,14 @@ int hci_unregister_proto(struct hci_proto *hp) | |||
1830 | if (hp->id >= HCI_MAX_PROTO) | 1830 | if (hp->id >= HCI_MAX_PROTO) |
1831 | return -EINVAL; | 1831 | return -EINVAL; |
1832 | 1832 | ||
1833 | write_lock_bh(&hci_task_lock); | 1833 | mutex_lock(&hci_task_lock); |
1834 | 1834 | ||
1835 | if (hci_proto[hp->id]) | 1835 | if (hci_proto[hp->id]) |
1836 | hci_proto[hp->id] = NULL; | 1836 | hci_proto[hp->id] = NULL; |
1837 | else | 1837 | else |
1838 | err = -ENOENT; | 1838 | err = -ENOENT; |
1839 | 1839 | ||
1840 | write_unlock_bh(&hci_task_lock); | 1840 | mutex_unlock(&hci_task_lock); |
1841 | 1841 | ||
1842 | return err; | 1842 | return err; |
1843 | } | 1843 | } |
@@ -2386,7 +2386,7 @@ static void hci_tx_task(unsigned long arg) | |||
2386 | struct hci_dev *hdev = (struct hci_dev *) arg; | 2386 | struct hci_dev *hdev = (struct hci_dev *) arg; |
2387 | struct sk_buff *skb; | 2387 | struct sk_buff *skb; |
2388 | 2388 | ||
2389 | read_lock(&hci_task_lock); | 2389 | mutex_lock(&hci_task_lock); |
2390 | 2390 | ||
2391 | BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt, | 2391 | BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt, |
2392 | hdev->sco_cnt, hdev->le_cnt); | 2392 | hdev->sco_cnt, hdev->le_cnt); |
@@ -2405,7 +2405,7 @@ static void hci_tx_task(unsigned long arg) | |||
2405 | while ((skb = skb_dequeue(&hdev->raw_q))) | 2405 | while ((skb = skb_dequeue(&hdev->raw_q))) |
2406 | hci_send_frame(skb); | 2406 | hci_send_frame(skb); |
2407 | 2407 | ||
2408 | read_unlock(&hci_task_lock); | 2408 | mutex_unlock(&hci_task_lock); |
2409 | } | 2409 | } |
2410 | 2410 | ||
2411 | /* ----- HCI RX task (incoming data processing) ----- */ | 2411 | /* ----- HCI RX task (incoming data processing) ----- */ |
@@ -2493,7 +2493,7 @@ static void hci_rx_work(struct work_struct *work) | |||
2493 | 2493 | ||
2494 | BT_DBG("%s", hdev->name); | 2494 | BT_DBG("%s", hdev->name); |
2495 | 2495 | ||
2496 | read_lock(&hci_task_lock); | 2496 | mutex_lock(&hci_task_lock); |
2497 | 2497 | ||
2498 | while ((skb = skb_dequeue(&hdev->rx_q))) { | 2498 | while ((skb = skb_dequeue(&hdev->rx_q))) { |
2499 | if (atomic_read(&hdev->promisc)) { | 2499 | if (atomic_read(&hdev->promisc)) { |
@@ -2539,7 +2539,7 @@ static void hci_rx_work(struct work_struct *work) | |||
2539 | } | 2539 | } |
2540 | } | 2540 | } |
2541 | 2541 | ||
2542 | read_unlock(&hci_task_lock); | 2542 | mutex_unlock(&hci_task_lock); |
2543 | } | 2543 | } |
2544 | 2544 | ||
2545 | static void hci_cmd_task(unsigned long arg) | 2545 | static void hci_cmd_task(unsigned long arg) |