linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't use cmd_timer to timeout HCI reset command
@ 2011-07-26 20:46 Szymon Janc
  2011-08-01 19:30 ` Gustavo Padovan
  0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2011-07-26 20:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Peter Hurley, Szymon Janc

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>
---
 net/bluetooth/hci_core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 908fcd3..3b39198 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1209,7 +1209,6 @@ static void hci_cmd_timer(unsigned long arg)
 
 	BT_ERR("%s command tx timeout", hdev->name);
 	atomic_set(&hdev->cmd_cnt, 1);
-	clear_bit(HCI_RESET, &hdev->flags);
 	tasklet_schedule(&hdev->cmd_task);
 }
 
@@ -2408,7 +2407,10 @@ static void hci_cmd_task(unsigned long arg)
 		if (hdev->sent_cmd) {
 			atomic_dec(&hdev->cmd_cnt);
 			hci_send_frame(skb);
-			mod_timer(&hdev->cmd_timer,
+			if (test_bit(HCI_RESET, &hdev->flags))
+				del_timer(&hdev->cmd_timer);
+			else
+				mod_timer(&hdev->cmd_timer,
 				  jiffies + msecs_to_jiffies(HCI_CMD_TIMEOUT));
 		} else {
 			skb_queue_head(&hdev->cmd_q, skb);
-- 
1.7.5.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't use cmd_timer to timeout HCI reset command
  2011-07-26 20:46 [PATCH] Don't use cmd_timer to timeout HCI reset command Szymon Janc
@ 2011-08-01 19:30 ` Gustavo Padovan
  0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Padovan @ 2011-08-01 19:30 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, Peter Hurley

Hi Szymon,

* Szymon Janc <szymon@janc.net.pl> [2011-07-26 22:46:54 +0200]:

> 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>
> ---
>  net/bluetooth/hci_core.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-01 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 20:46 [PATCH] Don't use cmd_timer to timeout HCI reset command Szymon Janc
2011-08-01 19:30 ` Gustavo Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).