diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 74 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 7 |
2 files changed, 0 insertions, 81 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 7bbd5c5767b9..83d3d3563bcc 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1521,75 +1521,6 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) | |||
1521 | return mgmt_device_unblocked(hdev, bdaddr, type); | 1521 | return mgmt_device_unblocked(hdev, bdaddr, type); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | static void hci_clear_adv_cache(struct work_struct *work) | ||
1525 | { | ||
1526 | struct hci_dev *hdev = container_of(work, struct hci_dev, | ||
1527 | adv_work.work); | ||
1528 | |||
1529 | hci_dev_lock(hdev); | ||
1530 | |||
1531 | hci_adv_entries_clear(hdev); | ||
1532 | |||
1533 | hci_dev_unlock(hdev); | ||
1534 | } | ||
1535 | |||
1536 | int hci_adv_entries_clear(struct hci_dev *hdev) | ||
1537 | { | ||
1538 | struct adv_entry *entry, *tmp; | ||
1539 | |||
1540 | list_for_each_entry_safe(entry, tmp, &hdev->adv_entries, list) { | ||
1541 | list_del(&entry->list); | ||
1542 | kfree(entry); | ||
1543 | } | ||
1544 | |||
1545 | BT_DBG("%s adv cache cleared", hdev->name); | ||
1546 | |||
1547 | return 0; | ||
1548 | } | ||
1549 | |||
1550 | struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr) | ||
1551 | { | ||
1552 | struct adv_entry *entry; | ||
1553 | |||
1554 | list_for_each_entry(entry, &hdev->adv_entries, list) | ||
1555 | if (bacmp(bdaddr, &entry->bdaddr) == 0) | ||
1556 | return entry; | ||
1557 | |||
1558 | return NULL; | ||
1559 | } | ||
1560 | |||
1561 | static inline int is_connectable_adv(u8 evt_type) | ||
1562 | { | ||
1563 | if (evt_type == ADV_IND || evt_type == ADV_DIRECT_IND) | ||
1564 | return 1; | ||
1565 | |||
1566 | return 0; | ||
1567 | } | ||
1568 | |||
1569 | int hci_add_adv_entry(struct hci_dev *hdev, | ||
1570 | struct hci_ev_le_advertising_info *ev) { struct adv_entry *entry; if (!is_connectable_adv(ev->evt_type)) | ||
1571 | return -EINVAL; | ||
1572 | |||
1573 | /* Only new entries should be added to adv_entries. So, if | ||
1574 | * bdaddr was found, don't add it. */ | ||
1575 | if (hci_find_adv_entry(hdev, &ev->bdaddr)) | ||
1576 | return 0; | ||
1577 | |||
1578 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
1579 | if (!entry) | ||
1580 | return -ENOMEM; | ||
1581 | |||
1582 | bacpy(&entry->bdaddr, &ev->bdaddr); | ||
1583 | entry->bdaddr_type = ev->bdaddr_type; | ||
1584 | |||
1585 | list_add(&entry->list, &hdev->adv_entries); | ||
1586 | |||
1587 | BT_DBG("%s adv entry added: address %s type %u", hdev->name, | ||
1588 | batostr(&entry->bdaddr), entry->bdaddr_type); | ||
1589 | |||
1590 | return 0; | ||
1591 | } | ||
1592 | |||
1593 | static void le_scan_param_req(struct hci_dev *hdev, unsigned long opt) | 1524 | static void le_scan_param_req(struct hci_dev *hdev, unsigned long opt) |
1594 | { | 1525 | { |
1595 | struct le_scan_params *param = (struct le_scan_params *) opt; | 1526 | struct le_scan_params *param = (struct le_scan_params *) opt; |
@@ -1735,7 +1666,6 @@ struct hci_dev *hci_alloc_dev(void) | |||
1735 | INIT_LIST_HEAD(&hdev->link_keys); | 1666 | INIT_LIST_HEAD(&hdev->link_keys); |
1736 | INIT_LIST_HEAD(&hdev->long_term_keys); | 1667 | INIT_LIST_HEAD(&hdev->long_term_keys); |
1737 | INIT_LIST_HEAD(&hdev->remote_oob_data); | 1668 | INIT_LIST_HEAD(&hdev->remote_oob_data); |
1738 | INIT_LIST_HEAD(&hdev->adv_entries); | ||
1739 | 1669 | ||
1740 | INIT_WORK(&hdev->rx_work, hci_rx_work); | 1670 | INIT_WORK(&hdev->rx_work, hci_rx_work); |
1741 | INIT_WORK(&hdev->cmd_work, hci_cmd_work); | 1671 | INIT_WORK(&hdev->cmd_work, hci_cmd_work); |
@@ -1743,7 +1673,6 @@ struct hci_dev *hci_alloc_dev(void) | |||
1743 | INIT_WORK(&hdev->power_on, hci_power_on); | 1673 | INIT_WORK(&hdev->power_on, hci_power_on); |
1744 | INIT_WORK(&hdev->le_scan, le_scan_work); | 1674 | INIT_WORK(&hdev->le_scan, le_scan_work); |
1745 | 1675 | ||
1746 | INIT_DELAYED_WORK(&hdev->adv_work, hci_clear_adv_cache); | ||
1747 | INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); | 1676 | INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); |
1748 | INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); | 1677 | INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); |
1749 | INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); | 1678 | INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); |
@@ -1889,8 +1818,6 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1889 | 1818 | ||
1890 | hci_del_sysfs(hdev); | 1819 | hci_del_sysfs(hdev); |
1891 | 1820 | ||
1892 | cancel_delayed_work_sync(&hdev->adv_work); | ||
1893 | |||
1894 | destroy_workqueue(hdev->workqueue); | 1821 | destroy_workqueue(hdev->workqueue); |
1895 | 1822 | ||
1896 | hci_dev_lock(hdev); | 1823 | hci_dev_lock(hdev); |
@@ -1899,7 +1826,6 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1899 | hci_link_keys_clear(hdev); | 1826 | hci_link_keys_clear(hdev); |
1900 | hci_smp_ltks_clear(hdev); | 1827 | hci_smp_ltks_clear(hdev); |
1901 | hci_remote_oob_data_clear(hdev); | 1828 | hci_remote_oob_data_clear(hdev); |
1902 | hci_adv_entries_clear(hdev); | ||
1903 | hci_dev_unlock(hdev); | 1829 | hci_dev_unlock(hdev); |
1904 | 1830 | ||
1905 | hci_dev_put(hdev); | 1831 | hci_dev_put(hdev); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 054b1ad74496..ae0a57d21ec4 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1100,10 +1100,7 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1100 | 1100 | ||
1101 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1101 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1102 | 1102 | ||
1103 | cancel_delayed_work_sync(&hdev->adv_work); | ||
1104 | |||
1105 | hci_dev_lock(hdev); | 1103 | hci_dev_lock(hdev); |
1106 | hci_adv_entries_clear(hdev); | ||
1107 | hci_discovery_set_state(hdev, DISCOVERY_FINDING); | 1104 | hci_discovery_set_state(hdev, DISCOVERY_FINDING); |
1108 | hci_dev_unlock(hdev); | 1105 | hci_dev_unlock(hdev); |
1109 | break; | 1106 | break; |
@@ -1118,8 +1115,6 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1118 | 1115 | ||
1119 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1116 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1120 | 1117 | ||
1121 | schedule_delayed_work(&hdev->adv_work, ADV_CLEAR_TIMEOUT); | ||
1122 | |||
1123 | if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED && | 1118 | if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED && |
1124 | hdev->discovery.state == DISCOVERY_FINDING) { | 1119 | hdev->discovery.state == DISCOVERY_FINDING) { |
1125 | mgmt_interleaved_discovery(hdev); | 1120 | mgmt_interleaved_discovery(hdev); |
@@ -3353,8 +3348,6 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev, | |||
3353 | while (num_reports--) { | 3348 | while (num_reports--) { |
3354 | struct hci_ev_le_advertising_info *ev = ptr; | 3349 | struct hci_ev_le_advertising_info *ev = ptr; |
3355 | 3350 | ||
3356 | hci_add_adv_entry(hdev, ev); | ||
3357 | |||
3358 | rssi = ev->data[ev->length]; | 3351 | rssi = ev->data[ev->length]; |
3359 | mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, | 3352 | mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, |
3360 | NULL, rssi, 0, 1, ev->data, ev->length); | 3353 | NULL, rssi, 0, 1, ev->data, ev->length); |