Bluetooth: Send power off notification earlier in the device close process
Notifying Bluez userspace of a shutdown earlier prevents new commands from being sent. The extra commands were interfering with reinitialization of the device Change-Id: I862a658585ffa69348fbb4bdfba96f3916d0e5ef Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
This commit is contained in:
@@ -639,6 +639,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
|
|||||||
|
|
||||||
hci_notify(hdev, HCI_DEV_DOWN);
|
hci_notify(hdev, HCI_DEV_DOWN);
|
||||||
|
|
||||||
|
if (hdev->dev_type == HCI_BREDR) {
|
||||||
|
hci_dev_lock_bh(hdev);
|
||||||
|
mgmt_powered(hdev->id, 0);
|
||||||
|
hci_dev_unlock_bh(hdev);
|
||||||
|
}
|
||||||
|
|
||||||
if (hdev->flush)
|
if (hdev->flush)
|
||||||
hdev->flush(hdev);
|
hdev->flush(hdev);
|
||||||
|
|
||||||
@@ -671,12 +677,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
|
|||||||
* and no tasks are scheduled. */
|
* and no tasks are scheduled. */
|
||||||
hdev->close(hdev);
|
hdev->close(hdev);
|
||||||
|
|
||||||
if (hdev->dev_type == HCI_BREDR) {
|
|
||||||
hci_dev_lock_bh(hdev);
|
|
||||||
mgmt_powered(hdev->id, 0);
|
|
||||||
hci_dev_unlock_bh(hdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear only non-persistent flags */
|
/* Clear only non-persistent flags */
|
||||||
if (test_bit(HCI_MGMT, &hdev->flags))
|
if (test_bit(HCI_MGMT, &hdev->flags))
|
||||||
set_bit(HCI_MGMT, &keepflags);
|
set_bit(HCI_MGMT, &keepflags);
|
||||||
|
|||||||
Reference in New Issue
Block a user