Commit 7bdb8a5cf17f66614a9897645efcd4ccc27535ee

Authored by Szymon Janc
Committed by Gustavo F. Padovan
1 parent 6be6b11f00

Bluetooth: Don't use cmd_timer to timeout HCI reset command

No command should be send before Command Complete event for HCI
reset is received. This fix regression introduced by commit
6bd32326cda(Bluetooth: Use proper timer for hci command timout)
for chips whose reset command takes longer to complete (e.g. CSR)
resulting in next command being send before HCI reset completed.

Signed-off-by: Szymon Janc <szymon@janc.net.pl>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

net/bluetooth/hci_core.c
... ... @@ -1209,7 +1209,6 @@
1209 1209  
1210 1210 BT_ERR("%s command tx timeout", hdev->name);
1211 1211 atomic_set(&hdev->cmd_cnt, 1);
1212   - clear_bit(HCI_RESET, &hdev->flags);
1213 1212 tasklet_schedule(&hdev->cmd_task);
1214 1213 }
1215 1214  
... ... @@ -2408,7 +2407,10 @@
2408 2407 if (hdev->sent_cmd) {
2409 2408 atomic_dec(&hdev->cmd_cnt);
2410 2409 hci_send_frame(skb);
2411   - mod_timer(&hdev->cmd_timer,
  2410 + if (test_bit(HCI_RESET, &hdev->flags))
  2411 + del_timer(&hdev->cmd_timer);
  2412 + else
  2413 + mod_timer(&hdev->cmd_timer,
2412 2414 jiffies + msecs_to_jiffies(HCI_CMD_TIMEOUT));
2413 2415 } else {
2414 2416 skb_queue_head(&hdev->cmd_q, skb);