diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 14 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cc40f221f5e7..ff6b784c58c5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1202,6 +1202,17 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | |||
1202 | return 0; | 1202 | return 0; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | static void hci_clear_adv_cache(unsigned long arg) | ||
1206 | { | ||
1207 | struct hci_dev *hdev = (void *) arg; | ||
1208 | |||
1209 | hci_dev_lock(hdev); | ||
1210 | |||
1211 | hci_adv_entries_clear(hdev); | ||
1212 | |||
1213 | hci_dev_unlock(hdev); | ||
1214 | } | ||
1215 | |||
1205 | int hci_adv_entries_clear(struct hci_dev *hdev) | 1216 | int hci_adv_entries_clear(struct hci_dev *hdev) |
1206 | { | 1217 | { |
1207 | struct adv_entry *entry, *tmp; | 1218 | struct adv_entry *entry, *tmp; |
@@ -1330,6 +1341,8 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1330 | INIT_LIST_HEAD(&hdev->remote_oob_data); | 1341 | INIT_LIST_HEAD(&hdev->remote_oob_data); |
1331 | 1342 | ||
1332 | INIT_LIST_HEAD(&hdev->adv_entries); | 1343 | INIT_LIST_HEAD(&hdev->adv_entries); |
1344 | setup_timer(&hdev->adv_timer, hci_clear_adv_cache, | ||
1345 | (unsigned long) hdev); | ||
1333 | 1346 | ||
1334 | INIT_WORK(&hdev->power_on, hci_power_on); | 1347 | INIT_WORK(&hdev->power_on, hci_power_on); |
1335 | INIT_WORK(&hdev->power_off, hci_power_off); | 1348 | INIT_WORK(&hdev->power_off, hci_power_off); |
@@ -1403,6 +1416,7 @@ int hci_unregister_dev(struct hci_dev *hdev) | |||
1403 | hci_unregister_sysfs(hdev); | 1416 | hci_unregister_sysfs(hdev); |
1404 | 1417 | ||
1405 | hci_del_off_timer(hdev); | 1418 | hci_del_off_timer(hdev); |
1419 | del_timer(&hdev->adv_timer); | ||
1406 | 1420 | ||
1407 | destroy_workqueue(hdev->workqueue); | 1421 | destroy_workqueue(hdev->workqueue); |
1408 | 1422 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 056f7b2fa02f..a90200cac11d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -856,8 +856,12 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
856 | 856 | ||
857 | hci_dev_lock(hdev); | 857 | hci_dev_lock(hdev); |
858 | 858 | ||
859 | if (cp->enable == 0x01) | 859 | if (cp->enable == 0x01) { |
860 | del_timer(&hdev->adv_timer); | ||
860 | hci_adv_entries_clear(hdev); | 861 | hci_adv_entries_clear(hdev); |
862 | } else if (cp->enable == 0x00) { | ||
863 | mod_timer(&hdev->adv_timer, jiffies + ADV_CLEAR_TIMEOUT); | ||
864 | } | ||
861 | 865 | ||
862 | hci_dev_unlock(hdev); | 866 | hci_dev_unlock(hdev); |
863 | } | 867 | } |