diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-02-21 06:33:48 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-21 06:58:47 -0500 |
commit | 8ee5654034c85b3915d078147a9d1064cac1852e (patch) | |
tree | b2a5fc89e302b0fc9b14082e4473a2e0bcf965c5 | |
parent | f0d4b78a68c4fe3b0d45de9a50e8d29419177b83 (diff) |
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: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | net/bluetooth/hci_core.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index a7439aeb1f9b..a787c9c9d4cd 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -739,9 +739,6 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
739 | hdev->discov_timeout = 0; | 739 | hdev->discov_timeout = 0; |
740 | } | 740 | } |
741 | 741 | ||
742 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | ||
743 | cancel_delayed_work(&hdev->power_off); | ||
744 | |||
745 | if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) | 742 | if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) |
746 | cancel_delayed_work(&hdev->service_cache); | 743 | cancel_delayed_work(&hdev->service_cache); |
747 | 744 | ||
@@ -787,9 +784,11 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
787 | * and no tasks are scheduled. */ | 784 | * and no tasks are scheduled. */ |
788 | hdev->close(hdev); | 785 | hdev->close(hdev); |
789 | 786 | ||
790 | hci_dev_lock(hdev); | 787 | if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) { |
791 | mgmt_powered(hdev, 0); | 788 | hci_dev_lock(hdev); |
792 | hci_dev_unlock(hdev); | 789 | mgmt_powered(hdev, 0); |
790 | hci_dev_unlock(hdev); | ||
791 | } | ||
793 | 792 | ||
794 | /* Clear flags */ | 793 | /* Clear flags */ |
795 | hdev->flags = 0; | 794 | hdev->flags = 0; |
@@ -808,7 +807,12 @@ int hci_dev_close(__u16 dev) | |||
808 | hdev = hci_dev_get(dev); | 807 | hdev = hci_dev_get(dev); |
809 | if (!hdev) | 808 | if (!hdev) |
810 | return -ENODEV; | 809 | return -ENODEV; |
810 | |||
811 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | ||
812 | cancel_delayed_work(&hdev->power_off); | ||
813 | |||
811 | err = hci_dev_do_close(hdev); | 814 | err = hci_dev_do_close(hdev); |
815 | |||
812 | hci_dev_put(hdev); | 816 | hci_dev_put(hdev); |
813 | return err; | 817 | return err; |
814 | } | 818 | } |
@@ -1102,9 +1106,7 @@ static void hci_power_off(struct work_struct *work) | |||
1102 | 1106 | ||
1103 | BT_DBG("%s", hdev->name); | 1107 | BT_DBG("%s", hdev->name); |
1104 | 1108 | ||
1105 | clear_bit(HCI_AUTO_OFF, &hdev->dev_flags); | 1109 | hci_dev_do_close(hdev); |
1106 | |||
1107 | hci_dev_close(hdev->id); | ||
1108 | } | 1110 | } |
1109 | 1111 | ||
1110 | static void hci_discov_off(struct work_struct *work) | 1112 | static void hci_discov_off(struct work_struct *work) |