diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-12-11 14:45:46 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-12-11 14:57:39 -0500 |
commit | 1aeb9c651c06282e84c33eb838d1069582879af8 (patch) | |
tree | 871f1d260553221fc42dfcca5c3f1ea5ffb1a0b1 /net | |
parent | a511b35ba4f02cca526c7239723c48445a8b127d (diff) |
Bluetooth: Fix notifying mgmt power off before flushing connection list
This patch moves the mgmt_powered() notification earlier in the
hci_dev_do_close() function. This way the correct "not powered" error
gets passed to any pending mgmt commands. Without the patch the pending
commands would instead get a misleading "disconnected" response when
powering down the adapter.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cc60465ea774..5dcacf9607e4 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2634,6 +2634,12 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
2634 | drain_workqueue(hdev->workqueue); | 2634 | drain_workqueue(hdev->workqueue); |
2635 | 2635 | ||
2636 | hci_dev_lock(hdev); | 2636 | hci_dev_lock(hdev); |
2637 | |||
2638 | if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) { | ||
2639 | if (hdev->dev_type == HCI_BREDR) | ||
2640 | mgmt_powered(hdev, 0); | ||
2641 | } | ||
2642 | |||
2637 | hci_inquiry_cache_flush(hdev); | 2643 | hci_inquiry_cache_flush(hdev); |
2638 | hci_pend_le_actions_clear(hdev); | 2644 | hci_pend_le_actions_clear(hdev); |
2639 | hci_conn_hash_flush(hdev); | 2645 | hci_conn_hash_flush(hdev); |
@@ -2681,14 +2687,6 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
2681 | hdev->flags &= BIT(HCI_RAW); | 2687 | hdev->flags &= BIT(HCI_RAW); |
2682 | hdev->dev_flags &= ~HCI_PERSISTENT_MASK; | 2688 | hdev->dev_flags &= ~HCI_PERSISTENT_MASK; |
2683 | 2689 | ||
2684 | if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) { | ||
2685 | if (hdev->dev_type == HCI_BREDR) { | ||
2686 | hci_dev_lock(hdev); | ||
2687 | mgmt_powered(hdev, 0); | ||
2688 | hci_dev_unlock(hdev); | ||
2689 | } | ||
2690 | } | ||
2691 | |||
2692 | /* Controller radio is available but is currently powered down */ | 2690 | /* Controller radio is available but is currently powered down */ |
2693 | hdev->amp_status = AMP_STATUS_POWERED_DOWN; | 2691 | hdev->amp_status = AMP_STATUS_POWERED_DOWN; |
2694 | 2692 | ||