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:
Bhasker Neti
2011-12-21 17:24:01 -08:00
parent 0705a5f7ea
commit ffdff571cb

View File

@@ -639,6 +639,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
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)
hdev->flush(hdev);
@@ -671,12 +677,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
* and no tasks are scheduled. */
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 */
if (test_bit(HCI_MGMT, &hdev->flags))
set_bit(HCI_MGMT, &keepflags);