]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Start background scanning only when controller is ready
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 30 Jun 2014 14:04:12 +0000 (16:04 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:51 +0000 (17:42 +0200)
When the controller is not active or in init/setup phase, do not
try to start or stop background scanning.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_core.c

index adea7de9563389252dfa395d87a21b124393184f..2312e77582b0f807039afe379bd070188a9dac14 100644 (file)
@@ -5317,7 +5317,10 @@ void hci_update_background_scan(struct hci_dev *hdev)
        struct hci_conn *conn;
        int err;
 
-       if (test_bit(HCI_UNREGISTER, &hdev->dev_flags))
+       if (!test_bit(HCI_UP, &hdev->flags) ||
+           test_bit(HCI_INIT, &hdev->flags) ||
+           test_bit(HCI_SETUP, &hdev->dev_flags) ||
+           test_bit(HCI_UNREGISTER, &hdev->dev_flags))
                return;
 
        hci_req_init(&req, hdev);