Commit 8ee56540 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Don't send New Settings event during setup power down

When the controller gets brought up for initial setup, it will be brought
back down after a timeout. In that case, don't send a New Settings event.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent f0d4b78a
...@@ -739,9 +739,6 @@ static int hci_dev_do_close(struct hci_dev *hdev) ...@@ -739,9 +739,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
hdev->discov_timeout = 0; hdev->discov_timeout = 0;
} }
if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags))
cancel_delayed_work(&hdev->power_off);
if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
cancel_delayed_work(&hdev->service_cache); cancel_delayed_work(&hdev->service_cache);
...@@ -787,9 +784,11 @@ static int hci_dev_do_close(struct hci_dev *hdev) ...@@ -787,9 +784,11 @@ 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);
hci_dev_lock(hdev); if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
mgmt_powered(hdev, 0); hci_dev_lock(hdev);
hci_dev_unlock(hdev); mgmt_powered(hdev, 0);
hci_dev_unlock(hdev);
}
/* Clear flags */ /* Clear flags */
hdev->flags = 0; hdev->flags = 0;
...@@ -808,7 +807,12 @@ int hci_dev_close(__u16 dev) ...@@ -808,7 +807,12 @@ int hci_dev_close(__u16 dev)
hdev = hci_dev_get(dev); hdev = hci_dev_get(dev);
if (!hdev) if (!hdev)
return -ENODEV; return -ENODEV;
if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags))
cancel_delayed_work(&hdev->power_off);
err = hci_dev_do_close(hdev); err = hci_dev_do_close(hdev);
hci_dev_put(hdev); hci_dev_put(hdev);
return err; return err;
} }
...@@ -1102,9 +1106,7 @@ static void hci_power_off(struct work_struct *work) ...@@ -1102,9 +1106,7 @@ static void hci_power_off(struct work_struct *work)
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
clear_bit(HCI_AUTO_OFF, &hdev->dev_flags); hci_dev_do_close(hdev);
hci_dev_close(hdev->id);
} }
static void hci_discov_off(struct work_struct *work) static void hci_discov_off(struct work_struct *work)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment