]> git.hungrycats.org Git - linux/commitdiff
Bluetooth: Fix indicating discovery state when canceling inquiry
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 10 Jun 2014 11:05:57 +0000 (14:05 +0300)
committerJiri Slaby <jslaby@suse.cz>
Thu, 17 Jul 2014 13:04:37 +0000 (15:04 +0200)
commit 50143a433b70e3145bcf8a4a4e54f0c11bdee32b upstream.

When inquiry is canceled through the HCI_Cancel_Inquiry command there is
no Inquiry Complete event generated. Instead, all we get is the command
complete for the HCI_Inquiry_Cancel command. This means that we must
call the hci_discovery_set_state() function from the respective command
complete handler in order to ensure that user space knows the correct
discovery state.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/bluetooth/hci_event.c

index b093ef858e1fa3b46a57d2458d94bdb0da4dac79..729f516ecd63c5766ac9147f11b085ac2f1e5f90 100644 (file)
@@ -47,6 +47,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
        smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */
        wake_up_bit(&hdev->flags, HCI_INQUIRY);
 
+       hci_dev_lock(hdev);
+       hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+       hci_dev_unlock(hdev);
+
        hci_conn_check_pending(hdev);
 }