Skip to content

Commit f2d64f6

Browse files
Ulisses FurquimGustavo F. Padovan
authored andcommitted
Bluetooth: Remove global mutex hci_task_lock
The hci_task_lock mutex (previously a lock) was supposed to protect the register/unregister of HCI protocols against RX/TX tasks. This will not be needed anymore because SCO and L2CAP will always be compiled. Moreover, with the recent move of RX/TX to workqueues per device the global hci_task_lock was causing starvation between different HCI devices. Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
1 parent fa0fb93 commit f2d64f6

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ static void hci_rx_work(struct work_struct *work);
6161
static void hci_cmd_work(struct work_struct *work);
6262
static void hci_tx_work(struct work_struct *work);
6363

64-
static DEFINE_MUTEX(hci_task_lock);
65-
6664
/* HCI device list */
6765
LIST_HEAD(hci_dev_list);
6866
DEFINE_RWLOCK(hci_dev_list_lock);
@@ -1832,8 +1830,7 @@ EXPORT_SYMBOL(hci_recv_stream_fragment);
18321830

18331831
/* ---- Interface to upper protocols ---- */
18341832

1835-
/* Register/Unregister protocols.
1836-
* hci_task_lock is used to ensure that no tasks are running. */
1833+
/* Register/Unregister protocols. */
18371834
int hci_register_proto(struct hci_proto *hp)
18381835
{
18391836
int err = 0;
@@ -1843,15 +1840,11 @@ int hci_register_proto(struct hci_proto *hp)
18431840
if (hp->id >= HCI_MAX_PROTO)
18441841
return -EINVAL;
18451842

1846-
mutex_lock(&hci_task_lock);
1847-
18481843
if (!hci_proto[hp->id])
18491844
hci_proto[hp->id] = hp;
18501845
else
18511846
err = -EEXIST;
18521847

1853-
mutex_unlock(&hci_task_lock);
1854-
18551848
return err;
18561849
}
18571850
EXPORT_SYMBOL(hci_register_proto);
@@ -1865,15 +1858,11 @@ int hci_unregister_proto(struct hci_proto *hp)
18651858
if (hp->id >= HCI_MAX_PROTO)
18661859
return -EINVAL;
18671860

1868-
mutex_lock(&hci_task_lock);
1869-
18701861
if (hci_proto[hp->id])
18711862
hci_proto[hp->id] = NULL;
18721863
else
18731864
err = -ENOENT;
18741865

1875-
mutex_unlock(&hci_task_lock);
1876-
18771866
return err;
18781867
}
18791868
EXPORT_SYMBOL(hci_unregister_proto);
@@ -2439,8 +2428,6 @@ static void hci_tx_work(struct work_struct *work)
24392428
struct hci_dev *hdev = container_of(work, struct hci_dev, tx_work);
24402429
struct sk_buff *skb;
24412430

2442-
mutex_lock(&hci_task_lock);
2443-
24442431
BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt,
24452432
hdev->sco_cnt, hdev->le_cnt);
24462433

@@ -2457,8 +2444,6 @@ static void hci_tx_work(struct work_struct *work)
24572444
/* Send next queued raw (unknown type) packet */
24582445
while ((skb = skb_dequeue(&hdev->raw_q)))
24592446
hci_send_frame(skb);
2460-
2461-
mutex_unlock(&hci_task_lock);
24622447
}
24632448

24642449
/* ----- HCI RX task (incoming data processing) ----- */
@@ -2546,8 +2531,6 @@ static void hci_rx_work(struct work_struct *work)
25462531

25472532
BT_DBG("%s", hdev->name);
25482533

2549-
mutex_lock(&hci_task_lock);
2550-
25512534
while ((skb = skb_dequeue(&hdev->rx_q))) {
25522535
if (atomic_read(&hdev->promisc)) {
25532536
/* Send copy to the sockets */
@@ -2591,8 +2574,6 @@ static void hci_rx_work(struct work_struct *work)
25912574
break;
25922575
}
25932576
}
2594-
2595-
mutex_unlock(&hci_task_lock);
25962577
}
25972578

25982579
static void hci_cmd_work(struct work_struct *work)

0 commit comments

Comments
 (0)