Skip to content

Commit 67d0dfb

Browse files
author
Gustavo F. Padovan
committed
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>
1 parent eb403a1 commit 67d0dfb

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void hci_rx_work(struct work_struct *work);
6060
static void hci_cmd_task(unsigned long arg);
6161
static void hci_tx_task(unsigned long arg);
6262

63-
static DEFINE_RWLOCK(hci_task_lock);
63+
static DEFINE_MUTEX(hci_task_lock);
6464

6565
/* HCI device list */
6666
LIST_HEAD(hci_dev_list);
@@ -1808,14 +1808,14 @@ int hci_register_proto(struct hci_proto *hp)
18081808
if (hp->id >= HCI_MAX_PROTO)
18091809
return -EINVAL;
18101810

1811-
write_lock_bh(&hci_task_lock);
1811+
mutex_lock(&hci_task_lock);
18121812

18131813
if (!hci_proto[hp->id])
18141814
hci_proto[hp->id] = hp;
18151815
else
18161816
err = -EEXIST;
18171817

1818-
write_unlock_bh(&hci_task_lock);
1818+
mutex_unlock(&hci_task_lock);
18191819

18201820
return err;
18211821
}
@@ -1830,14 +1830,14 @@ int hci_unregister_proto(struct hci_proto *hp)
18301830
if (hp->id >= HCI_MAX_PROTO)
18311831
return -EINVAL;
18321832

1833-
write_lock_bh(&hci_task_lock);
1833+
mutex_lock(&hci_task_lock);
18341834

18351835
if (hci_proto[hp->id])
18361836
hci_proto[hp->id] = NULL;
18371837
else
18381838
err = -ENOENT;
18391839

1840-
write_unlock_bh(&hci_task_lock);
1840+
mutex_unlock(&hci_task_lock);
18411841

18421842
return err;
18431843
}
@@ -2386,7 +2386,7 @@ static void hci_tx_task(unsigned long arg)
23862386
struct hci_dev *hdev = (struct hci_dev *) arg;
23872387
struct sk_buff *skb;
23882388

2389-
read_lock(&hci_task_lock);
2389+
mutex_lock(&hci_task_lock);
23902390

23912391
BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt,
23922392
hdev->sco_cnt, hdev->le_cnt);
@@ -2405,7 +2405,7 @@ static void hci_tx_task(unsigned long arg)
24052405
while ((skb = skb_dequeue(&hdev->raw_q)))
24062406
hci_send_frame(skb);
24072407

2408-
read_unlock(&hci_task_lock);
2408+
mutex_unlock(&hci_task_lock);
24092409
}
24102410

24112411
/* ----- HCI RX task (incoming data processing) ----- */
@@ -2493,7 +2493,7 @@ static void hci_rx_work(struct work_struct *work)
24932493

24942494
BT_DBG("%s", hdev->name);
24952495

2496-
read_lock(&hci_task_lock);
2496+
mutex_lock(&hci_task_lock);
24972497

24982498
while ((skb = skb_dequeue(&hdev->rx_q))) {
24992499
if (atomic_read(&hdev->promisc)) {
@@ -2539,7 +2539,7 @@ static void hci_rx_work(struct work_struct *work)
25392539
}
25402540
}
25412541

2542-
read_unlock(&hci_task_lock);
2542+
mutex_unlock(&hci_task_lock);
25432543
}
25442544

25452545
static void hci_cmd_task(unsigned long arg)

0 commit comments

Comments
 (0)