Bluetooth: Reuse hci_stop_discovery function when cleaning up HCI state
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 10 Jun 2014 11:05:59 +0000 (14:05 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 13 Jun 2014 11:32:23 +0000 (13:32 +0200)
When cleaning up the HCI state as part of the power-off procedure we can
reuse the hci_stop_discovery() function instead of explicitly sending
HCI command related to discovery. The added benefit of this is that it
takes care of canceling name resolving and inquiry which were not
previously covered by the code.

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

index be6f03219121226b13971c0aeadc0ff5b3e5095b..6107e037cd8e19a0af7ea3d7c7dbc6bdda5bd1c4 100644 (file)
@@ -1100,9 +1100,7 @@ static int clean_up_hci_state(struct hci_dev *hdev)
        if (test_bit(HCI_ADVERTISING, &hdev->dev_flags))
                disable_advertising(&req);
 
-       if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) {
-               hci_req_add_le_scan_disable(&req);
-       }
+       hci_stop_discovery(&req);
 
        list_for_each_entry(conn, &hdev->conn_hash.list, list) {
                struct hci_cp_disconnect dc;