Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 237316
b: refs/heads/master
c: a5040ef
h: refs/heads/master
v: v3
  • Loading branch information
Johan Hedberg authored and Gustavo F. Padovan committed Feb 8, 2011
1 parent 6d2c34e commit 3935205
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03b555e119de8288a16e086e1fbd223d9b429d3d
refs/heads/master: a5040efa2017f3e4f1b4d5f40fd989567f3994c1
3 changes: 2 additions & 1 deletion trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ struct hci_dev {
wait_queue_head_t req_wait_q;
__u32 req_status;
__u32 req_result;
__u16 req_last_cmd;

__u16 init_last_cmd;

struct inquiry_cache inq_cache;
struct hci_conn_hash conn_hash;
Expand Down
17 changes: 9 additions & 8 deletions trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result)
{
BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);

/* If the request has set req_last_cmd (typical for multi-HCI
* command requests) check if the completed command matches
* this, and if not just return. Single HCI command requests
* typically leave req_last_cmd as 0 */
if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
/* If this is the init phase check if the completed command matches
* the last init command, and if not just return.
*/
if (test_bit(HCI_INIT, &hdev->flags) && hdev->init_last_cmd != cmd)
return;

if (hdev->req_status == HCI_REQ_PEND) {
Expand Down Expand Up @@ -158,7 +157,7 @@ static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev,
break;
}

hdev->req_last_cmd = hdev->req_status = hdev->req_result = 0;
hdev->req_status = hdev->req_result = 0;

BT_DBG("%s end: err %d", hdev->name, err);

Expand Down Expand Up @@ -261,8 +260,6 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
/* Connection accept timeout ~20 secs */
param = cpu_to_le16(0x7d00);
hci_send_cmd(hdev, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);

hdev->req_last_cmd = HCI_OP_WRITE_CA_TIMEOUT;
}

static void hci_scan_req(struct hci_dev *hdev, unsigned long opt)
Expand Down Expand Up @@ -523,6 +520,7 @@ int hci_dev_open(__u16 dev)
if (!test_bit(HCI_RAW, &hdev->flags)) {
atomic_set(&hdev->cmd_cnt, 1);
set_bit(HCI_INIT, &hdev->flags);
hdev->init_last_cmd = 0;

//__hci_request(hdev, hci_reset_req, 0, HZ);
ret = __hci_request(hdev, hci_init_req, 0,
Expand Down Expand Up @@ -1442,6 +1440,9 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param)
bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
skb->dev = (void *) hdev;

if (test_bit(HCI_INIT, &hdev->flags))
hdev->init_last_cmd = opcode;

skb_queue_tail(&hdev->cmd_q, skb);
tasklet_schedule(&hdev->cmd_task);

Expand Down

0 comments on commit 3935205

Please sign in to comment.