diff options
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d01bd043c231..bf7cf512df88 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2232,7 +2232,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) | |||
2232 | goto done; | 2232 | goto done; |
2233 | } | 2233 | } |
2234 | 2234 | ||
2235 | if (!test_bit(HCI_SETUP, &hdev->dev_flags)) { | 2235 | if (!test_bit(HCI_SETUP, &hdev->dev_flags) && |
2236 | !test_bit(HCI_CONFIG, &hdev->dev_flags)) { | ||
2236 | /* Check for rfkill but allow the HCI setup stage to | 2237 | /* Check for rfkill but allow the HCI setup stage to |
2237 | * proceed (which in itself doesn't cause any RF activity). | 2238 | * proceed (which in itself doesn't cause any RF activity). |
2238 | */ | 2239 | */ |
@@ -2326,6 +2327,7 @@ static int hci_dev_do_open(struct hci_dev *hdev) | |||
2326 | set_bit(HCI_UP, &hdev->flags); | 2327 | set_bit(HCI_UP, &hdev->flags); |
2327 | hci_notify(hdev, HCI_DEV_UP); | 2328 | hci_notify(hdev, HCI_DEV_UP); |
2328 | if (!test_bit(HCI_SETUP, &hdev->dev_flags) && | 2329 | if (!test_bit(HCI_SETUP, &hdev->dev_flags) && |
2330 | !test_bit(HCI_CONFIG, &hdev->dev_flags) && | ||
2329 | !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) && | 2331 | !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) && |
2330 | !test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) && | 2332 | !test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) && |
2331 | hdev->dev_type == HCI_BREDR) { | 2333 | hdev->dev_type == HCI_BREDR) { |
@@ -2824,7 +2826,8 @@ static int hci_rfkill_set_block(void *data, bool blocked) | |||
2824 | 2826 | ||
2825 | if (blocked) { | 2827 | if (blocked) { |
2826 | set_bit(HCI_RFKILLED, &hdev->dev_flags); | 2828 | set_bit(HCI_RFKILLED, &hdev->dev_flags); |
2827 | if (!test_bit(HCI_SETUP, &hdev->dev_flags)) | 2829 | if (!test_bit(HCI_SETUP, &hdev->dev_flags) && |
2830 | !test_bit(HCI_CONFIG, &hdev->dev_flags)) | ||
2828 | hci_dev_do_close(hdev); | 2831 | hci_dev_do_close(hdev); |
2829 | } else { | 2832 | } else { |
2830 | clear_bit(HCI_RFKILLED, &hdev->dev_flags); | 2833 | clear_bit(HCI_RFKILLED, &hdev->dev_flags); |
@@ -2881,6 +2884,12 @@ static void hci_power_on(struct work_struct *work) | |||
2881 | * and no event will be send. | 2884 | * and no event will be send. |
2882 | */ | 2885 | */ |
2883 | mgmt_index_added(hdev); | 2886 | mgmt_index_added(hdev); |
2887 | } else if (test_and_clear_bit(HCI_CONFIG, &hdev->dev_flags)) { | ||
2888 | /* Powering on the controller with HCI_CONFIG set only | ||
2889 | * happens with the transition from unconfigured to | ||
2890 | * configured. This will send the Index Added event. | ||
2891 | */ | ||
2892 | mgmt_index_added(hdev); | ||
2884 | } | 2893 | } |
2885 | } | 2894 | } |
2886 | 2895 | ||
@@ -4045,7 +4054,8 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
4045 | cancel_work_sync(&hdev->power_on); | 4054 | cancel_work_sync(&hdev->power_on); |
4046 | 4055 | ||
4047 | if (!test_bit(HCI_INIT, &hdev->flags) && | 4056 | if (!test_bit(HCI_INIT, &hdev->flags) && |
4048 | !test_bit(HCI_SETUP, &hdev->dev_flags)) { | 4057 | !test_bit(HCI_SETUP, &hdev->dev_flags) && |
4058 | !test_bit(HCI_CONFIG, &hdev->dev_flags)) { | ||
4049 | hci_dev_lock(hdev); | 4059 | hci_dev_lock(hdev); |
4050 | mgmt_index_removed(hdev); | 4060 | mgmt_index_removed(hdev); |
4051 | hci_dev_unlock(hdev); | 4061 | hci_dev_unlock(hdev); |
@@ -5370,6 +5380,7 @@ void hci_update_background_scan(struct hci_dev *hdev) | |||
5370 | if (!test_bit(HCI_UP, &hdev->flags) || | 5380 | if (!test_bit(HCI_UP, &hdev->flags) || |
5371 | test_bit(HCI_INIT, &hdev->flags) || | 5381 | test_bit(HCI_INIT, &hdev->flags) || |
5372 | test_bit(HCI_SETUP, &hdev->dev_flags) || | 5382 | test_bit(HCI_SETUP, &hdev->dev_flags) || |
5383 | test_bit(HCI_CONFIG, &hdev->dev_flags) || | ||
5373 | test_bit(HCI_AUTO_OFF, &hdev->dev_flags) || | 5384 | test_bit(HCI_AUTO_OFF, &hdev->dev_flags) || |
5374 | test_bit(HCI_UNREGISTER, &hdev->dev_flags)) | 5385 | test_bit(HCI_UNREGISTER, &hdev->dev_flags)) |
5375 | return; | 5386 | return; |