aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-03-01 14:35:55 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-01 14:44:55 -0500
commit75fb0e324daa48ec458fb5c2960eb07b80cfad9d (patch)
tree78229ecbcf7b08b1aa3a47ce9e5927e8e64dd6a2 /net
parent8b90129cc5789a4c65547c91c9a7b1fd3a4d56a4 (diff)
Bluetooth: Fix init sequence for some CSR based controllers
Some CSR controllers will generate a spontaneous reset during init and just eat up any pending command without sending a command complete for it. This patch solves the issue by just resending whatever was the last sent command. hci_send_cmd is not used since we need to bypass all other commands in the send queue. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index db484a8e7364..d3ddc0ba9cd4 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -82,8 +82,28 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result)
82 /* If this is the init phase check if the completed command matches 82 /* If this is the init phase check if the completed command matches
83 * the last init command, and if not just return. 83 * the last init command, and if not just return.
84 */ 84 */
85 if (test_bit(HCI_INIT, &hdev->flags) && hdev->init_last_cmd != cmd) 85 if (test_bit(HCI_INIT, &hdev->flags) && hdev->init_last_cmd != cmd) {
86 struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data;
87 struct sk_buff *skb;
88
89 /* Some CSR based controllers generate a spontaneous
90 * reset complete event during init and any pending
91 * command will never be completed. In such a case we
92 * need to resend whatever was the last sent
93 * command.
94 */
95
96 if (cmd != HCI_OP_RESET || sent->opcode == HCI_OP_RESET)
97 return;
98
99 skb = skb_clone(hdev->sent_cmd, GFP_ATOMIC);
100 if (skb) {
101 skb_queue_head(&hdev->cmd_q, skb);
102 queue_work(hdev->workqueue, &hdev->cmd_work);
103 }
104
86 return; 105 return;
106 }
87 107
88 if (hdev->req_status == HCI_REQ_PEND) { 108 if (hdev->req_status == HCI_REQ_PEND) {
89 hdev->req_result = result; 109 hdev->req_result = result;