mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
Bluetooth: Fix timeout on scanning for the second time
The checks for HCI_INQUIRY and HCI_MGMT were in the wrong order, so that second scans always failed. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
parent
687beaa0d1
commit
2d20a26a92
1 changed files with 8 additions and 9 deletions
|
@ -58,8 +58,8 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
if (status)
|
if (status)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (test_bit(HCI_MGMT, &hdev->flags) &&
|
if (test_and_clear_bit(HCI_INQUIRY, &hdev->flags) &&
|
||||||
test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
|
test_bit(HCI_MGMT, &hdev->flags))
|
||||||
mgmt_discovering(hdev->id, 0);
|
mgmt_discovering(hdev->id, 0);
|
||||||
|
|
||||||
hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status);
|
hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status);
|
||||||
|
@ -76,8 +76,8 @@ static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
if (status)
|
if (status)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (test_bit(HCI_MGMT, &hdev->flags) &&
|
if (test_and_clear_bit(HCI_INQUIRY, &hdev->flags) &&
|
||||||
test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
|
test_bit(HCI_MGMT, &hdev->flags))
|
||||||
mgmt_discovering(hdev->id, 0);
|
mgmt_discovering(hdev->id, 0);
|
||||||
|
|
||||||
hci_conn_check_pending(hdev);
|
hci_conn_check_pending(hdev);
|
||||||
|
@ -959,9 +959,8 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(HCI_MGMT, &hdev->flags) &&
|
if (!test_and_set_bit(HCI_INQUIRY, &hdev->flags) &&
|
||||||
!test_and_set_bit(HCI_INQUIRY,
|
test_bit(HCI_MGMT, &hdev->flags))
|
||||||
&hdev->flags))
|
|
||||||
mgmt_discovering(hdev->id, 1);
|
mgmt_discovering(hdev->id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,8 +1339,8 @@ static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff
|
||||||
|
|
||||||
BT_DBG("%s status %d", hdev->name, status);
|
BT_DBG("%s status %d", hdev->name, status);
|
||||||
|
|
||||||
if (test_bit(HCI_MGMT, &hdev->flags) &&
|
if (test_and_clear_bit(HCI_INQUIRY, &hdev->flags) &&
|
||||||
test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
|
test_bit(HCI_MGMT, &hdev->flags))
|
||||||
mgmt_discovering(hdev->id, 0);
|
mgmt_discovering(hdev->id, 0);
|
||||||
|
|
||||||
hci_req_complete(hdev, HCI_OP_INQUIRY, status);
|
hci_req_complete(hdev, HCI_OP_INQUIRY, status);
|
||||||
|
|
Loading…
Reference in a new issue