Bluetooth: Fix notifying discovery state when powering off
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 28 Jan 2015 17:56:02 +0000 (19:56 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 28 Jan 2015 20:26:23 +0000 (21:26 +0100)
The discovery state should be set to stopped when the HCI device is
powered off. This patch adds the appropriate call to the
hci_discovery_set_state() function from hci_dev_do_close() which is
responsible for the power-off procedure.

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

index bb831d678868a3e1cc5193110f6bbf5fe425818a..46aa702c189dc671de4c8dd9f7101389993fb7be 100644 (file)
@@ -1628,6 +1628,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 
        hci_dev_lock(hdev);
 
+       hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+
        if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
                if (hdev->dev_type == HCI_BREDR)
                        mgmt_powered(hdev, 0);