Lines Matching refs:hdev
37 void hci_req_init(struct hci_request *req, struct hci_dev *hdev) in hci_req_init() argument
40 req->hdev = hdev; in hci_req_init()
49 bool hci_req_status_pend(struct hci_dev *hdev) in hci_req_status_pend() argument
51 return hdev->req_status == HCI_REQ_PEND; in hci_req_status_pend()
57 struct hci_dev *hdev = req->hdev; in req_run() local
83 spin_lock_irqsave(&hdev->cmd_q.lock, flags); in req_run()
84 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q); in req_run()
85 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags); in req_run()
87 queue_work(hdev->workqueue, &hdev->cmd_work); in req_run()
102 static void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode, in hci_req_sync_complete() argument
105 BT_DBG("%s result 0x%2.2x", hdev->name, result); in hci_req_sync_complete()
107 if (hdev->req_status == HCI_REQ_PEND) { in hci_req_sync_complete()
108 hdev->req_result = result; in hci_req_sync_complete()
109 hdev->req_status = HCI_REQ_DONE; in hci_req_sync_complete()
111 hdev->req_skb = skb_get(skb); in hci_req_sync_complete()
112 wake_up_interruptible(&hdev->req_wait_q); in hci_req_sync_complete()
116 void hci_req_sync_cancel(struct hci_dev *hdev, int err) in hci_req_sync_cancel() argument
118 BT_DBG("%s err 0x%2.2x", hdev->name, err); in hci_req_sync_cancel()
120 if (hdev->req_status == HCI_REQ_PEND) { in hci_req_sync_cancel()
121 hdev->req_result = err; in hci_req_sync_cancel()
122 hdev->req_status = HCI_REQ_CANCELED; in hci_req_sync_cancel()
123 wake_up_interruptible(&hdev->req_wait_q); in hci_req_sync_cancel()
127 struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, in __hci_cmd_sync_ev() argument
134 BT_DBG("%s", hdev->name); in __hci_cmd_sync_ev()
136 hci_req_init(&req, hdev); in __hci_cmd_sync_ev()
140 hdev->req_status = HCI_REQ_PEND; in __hci_cmd_sync_ev()
146 err = wait_event_interruptible_timeout(hdev->req_wait_q, in __hci_cmd_sync_ev()
147 hdev->req_status != HCI_REQ_PEND, timeout); in __hci_cmd_sync_ev()
152 switch (hdev->req_status) { in __hci_cmd_sync_ev()
154 err = -bt_to_errno(hdev->req_result); in __hci_cmd_sync_ev()
158 err = -hdev->req_result; in __hci_cmd_sync_ev()
166 hdev->req_status = hdev->req_result = 0; in __hci_cmd_sync_ev()
167 skb = hdev->req_skb; in __hci_cmd_sync_ev()
168 hdev->req_skb = NULL; in __hci_cmd_sync_ev()
170 BT_DBG("%s end: err %d", hdev->name, err); in __hci_cmd_sync_ev()
184 struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, in __hci_cmd_sync() argument
187 return __hci_cmd_sync_ev(hdev, opcode, plen, param, 0, timeout); in __hci_cmd_sync()
192 int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req, in __hci_req_sync() argument
199 BT_DBG("%s start", hdev->name); in __hci_req_sync()
201 hci_req_init(&req, hdev); in __hci_req_sync()
203 hdev->req_status = HCI_REQ_PEND; in __hci_req_sync()
214 hdev->req_status = 0; in __hci_req_sync()
233 err = wait_event_interruptible_timeout(hdev->req_wait_q, in __hci_req_sync()
234 hdev->req_status != HCI_REQ_PEND, timeout); in __hci_req_sync()
239 switch (hdev->req_status) { in __hci_req_sync()
241 err = -bt_to_errno(hdev->req_result); in __hci_req_sync()
243 *hci_status = hdev->req_result; in __hci_req_sync()
247 err = -hdev->req_result; in __hci_req_sync()
259 kfree_skb(hdev->req_skb); in __hci_req_sync()
260 hdev->req_skb = NULL; in __hci_req_sync()
261 hdev->req_status = hdev->req_result = 0; in __hci_req_sync()
263 BT_DBG("%s end: err %d", hdev->name, err); in __hci_req_sync()
268 int hci_req_sync(struct hci_dev *hdev, int (*req)(struct hci_request *req, in hci_req_sync() argument
275 hci_req_sync_lock(hdev); in hci_req_sync()
280 if (test_bit(HCI_UP, &hdev->flags)) in hci_req_sync()
281 ret = __hci_req_sync(hdev, req, opt, timeout, hci_status); in hci_req_sync()
284 hci_req_sync_unlock(hdev); in hci_req_sync()
289 struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, in hci_prepare_cmd() argument
319 struct hci_dev *hdev = req->hdev; in hci_req_add_ev() local
322 BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen); in hci_req_add_ev()
330 skb = hci_prepare_cmd(hdev, opcode, plen, param); in hci_req_add_ev()
332 bt_dev_err(hdev, "no memory for command (opcode 0x%4.4x)", in hci_req_add_ev()
354 struct hci_dev *hdev = req->hdev; in __hci_req_write_fast_connectable() local
358 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in __hci_req_write_fast_connectable()
361 if (hdev->hci_ver < BLUETOOTH_VER_1_2) in __hci_req_write_fast_connectable()
378 if (__cpu_to_le16(hdev->page_scan_interval) != acp.interval || in __hci_req_write_fast_connectable()
379 __cpu_to_le16(hdev->page_scan_window) != acp.window) in __hci_req_write_fast_connectable()
383 if (hdev->page_scan_type != type) in __hci_req_write_fast_connectable()
395 struct hci_dev *hdev = req->hdev; in __hci_update_background_scan() local
397 if (!test_bit(HCI_UP, &hdev->flags) || in __hci_update_background_scan()
398 test_bit(HCI_INIT, &hdev->flags) || in __hci_update_background_scan()
399 hci_dev_test_flag(hdev, HCI_SETUP) || in __hci_update_background_scan()
400 hci_dev_test_flag(hdev, HCI_CONFIG) || in __hci_update_background_scan()
401 hci_dev_test_flag(hdev, HCI_AUTO_OFF) || in __hci_update_background_scan()
402 hci_dev_test_flag(hdev, HCI_UNREGISTER)) in __hci_update_background_scan()
406 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in __hci_update_background_scan()
410 if (hdev->discovery.state != DISCOVERY_STOPPED) in __hci_update_background_scan()
420 hci_discovery_filter_clear(hdev); in __hci_update_background_scan()
422 if (list_empty(&hdev->pend_le_conns) && in __hci_update_background_scan()
423 list_empty(&hdev->pend_le_reports)) { in __hci_update_background_scan()
430 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
435 BT_DBG("%s stopping background scanning", hdev->name); in __hci_update_background_scan()
445 if (hci_lookup_le_connect(hdev)) in __hci_update_background_scan()
451 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) in __hci_update_background_scan()
456 BT_DBG("%s starting background scanning", hdev->name); in __hci_update_background_scan()
462 struct hci_dev *hdev = req->hdev; in __hci_req_update_name() local
465 memcpy(cp.name, hdev->dev_name, sizeof(cp.name)); in __hci_req_update_name()
472 static u8 *create_uuid16_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) in create_uuid16_list() argument
480 list_for_each_entry(uuid, &hdev->uuids, list) { in create_uuid16_list()
514 static u8 *create_uuid32_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) in create_uuid32_list() argument
522 list_for_each_entry(uuid, &hdev->uuids, list) { in create_uuid32_list()
547 static u8 *create_uuid128_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) in create_uuid128_list() argument
555 list_for_each_entry(uuid, &hdev->uuids, list) { in create_uuid128_list()
580 static void create_eir(struct hci_dev *hdev, u8 *data) in create_eir() argument
585 name_len = strlen(hdev->dev_name); in create_eir()
598 memcpy(ptr + 2, hdev->dev_name, name_len); in create_eir()
603 if (hdev->inq_tx_power != HCI_TX_POWER_INVALID) { in create_eir()
606 ptr[2] = (u8) hdev->inq_tx_power; in create_eir()
611 if (hdev->devid_source > 0) { in create_eir()
615 put_unaligned_le16(hdev->devid_source, ptr + 2); in create_eir()
616 put_unaligned_le16(hdev->devid_vendor, ptr + 4); in create_eir()
617 put_unaligned_le16(hdev->devid_product, ptr + 6); in create_eir()
618 put_unaligned_le16(hdev->devid_version, ptr + 8); in create_eir()
623 ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); in create_eir()
624 ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); in create_eir()
625 ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); in create_eir()
630 struct hci_dev *hdev = req->hdev; in __hci_req_update_eir() local
633 if (!hdev_is_powered(hdev)) in __hci_req_update_eir()
636 if (!lmp_ext_inq_capable(hdev)) in __hci_req_update_eir()
639 if (!hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) in __hci_req_update_eir()
642 if (hci_dev_test_flag(hdev, HCI_SERVICE_CACHE)) in __hci_req_update_eir()
647 create_eir(hdev, cp.data); in __hci_req_update_eir()
649 if (memcmp(cp.data, hdev->eir, sizeof(cp.data)) == 0) in __hci_req_update_eir()
652 memcpy(hdev->eir, cp.data, sizeof(cp.data)); in __hci_req_update_eir()
659 struct hci_dev *hdev = req->hdev; in hci_req_add_le_scan_disable() local
661 if (use_ext_scan(hdev)) { in hci_req_add_le_scan_disable()
690 struct hci_dev *hdev = req->hdev; in update_white_list() local
701 list_for_each_entry(b, &hdev->le_white_list, list) { in update_white_list()
705 if (!hci_pend_le_action_lookup(&hdev->pend_le_conns, in update_white_list()
707 !hci_pend_le_action_lookup(&hdev->pend_le_reports, in update_white_list()
719 if (hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) { in update_white_list()
737 list_for_each_entry(params, &hdev->pend_le_conns, action) { in update_white_list()
738 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
742 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
747 if (hci_find_irk_by_addr(hdev, ¶ms->addr, in update_white_list()
761 list_for_each_entry(params, &hdev->pend_le_reports, action) { in update_white_list()
762 if (hci_bdaddr_list_lookup(&hdev->le_white_list, in update_white_list()
766 if (white_list_entries >= hdev->le_white_list_size) { in update_white_list()
771 if (hci_find_irk_by_addr(hdev, ¶ms->addr, in update_white_list()
785 static bool scan_use_rpa(struct hci_dev *hdev) in scan_use_rpa() argument
787 return hci_dev_test_flag(hdev, HCI_PRIVACY); in scan_use_rpa()
793 struct hci_dev *hdev = req->hdev; in hci_req_start_scan() local
798 if (use_ext_scan(hdev)) { in hci_req_start_scan()
814 if (scan_1m(hdev) || scan_2m(hdev)) { in hci_req_start_scan()
826 if (scan_coded(hdev)) { in hci_req_start_scan()
870 struct hci_dev *hdev = req->hdev; in hci_req_add_le_passive_scan() local
880 if (hci_update_random_address(req, false, scan_use_rpa(hdev), in hci_req_add_le_passive_scan()
899 if (hci_dev_test_flag(hdev, HCI_PRIVACY) && in hci_req_add_le_passive_scan()
900 (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) in hci_req_add_le_passive_scan()
903 hci_req_start_scan(req, LE_SCAN_PASSIVE, hdev->le_scan_interval, in hci_req_add_le_passive_scan()
904 hdev->le_scan_window, own_addr_type, filter_policy); in hci_req_add_le_passive_scan()
907 static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) in get_adv_instance_scan_rsp_len() argument
915 adv_instance = hci_find_adv_instance(hdev, instance); in get_adv_instance_scan_rsp_len()
925 static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev) in get_cur_adv_instance_scan_rsp_len() argument
927 u8 instance = hdev->cur_adv_instance; in get_cur_adv_instance_scan_rsp_len()
934 adv_instance = hci_find_adv_instance(hdev, instance); in get_cur_adv_instance_scan_rsp_len()
946 if (ext_adv_capable(req->hdev)) { in __hci_req_disable_advertising()
961 static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance) in get_adv_instance_flags() argument
975 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE)) in get_adv_instance_flags()
978 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) in get_adv_instance_flags()
980 else if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) in get_adv_instance_flags()
986 adv_instance = hci_find_adv_instance(hdev, instance); in get_adv_instance_flags()
995 static bool adv_use_rpa(struct hci_dev *hdev, uint32_t flags) in adv_use_rpa() argument
998 if (!hci_dev_test_flag(hdev, HCI_PRIVACY)) in adv_use_rpa()
1002 if (!hci_dev_test_flag(hdev, HCI_LIMITED_PRIVACY)) in adv_use_rpa()
1009 hci_dev_test_flag(hdev, HCI_BONDABLE)) in adv_use_rpa()
1018 static bool is_advertising_allowed(struct hci_dev *hdev, bool connectable) in is_advertising_allowed() argument
1021 if (hci_conn_num(hdev, LE_LINK) == 0) in is_advertising_allowed()
1025 if (hdev->conn_hash.le_num_slave > 0) { in is_advertising_allowed()
1027 if (!connectable && !(hdev->le_states[2] & 0x10)) in is_advertising_allowed()
1033 if (connectable && (!(hdev->le_states[4] & 0x40) || in is_advertising_allowed()
1034 !(hdev->le_states[2] & 0x20))) in is_advertising_allowed()
1039 if (hci_conn_num(hdev, LE_LINK) != hdev->conn_hash.le_num_slave) { in is_advertising_allowed()
1041 if (!connectable && !(hdev->le_states[2] & 0x02)) in is_advertising_allowed()
1047 if (connectable && (!(hdev->le_states[4] & 0x08) || in is_advertising_allowed()
1048 !(hdev->le_states[2] & 0x08))) in is_advertising_allowed()
1057 struct hci_dev *hdev = req->hdev; in __hci_req_enable_advertising() local
1064 flags = get_adv_instance_flags(hdev, hdev->cur_adv_instance); in __hci_req_enable_advertising()
1070 mgmt_get_connectable(hdev); in __hci_req_enable_advertising()
1072 if (!is_advertising_allowed(hdev, connectable)) in __hci_req_enable_advertising()
1075 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) in __hci_req_enable_advertising()
1083 hci_dev_clear_flag(hdev, HCI_LE_ADV); in __hci_req_enable_advertising()
1090 adv_use_rpa(hdev, flags), in __hci_req_enable_advertising()
1099 adv_min_interval = hdev->le_adv_min_interval; in __hci_req_enable_advertising()
1100 adv_max_interval = hdev->le_adv_max_interval; in __hci_req_enable_advertising()
1102 if (get_cur_adv_instance_scan_rsp_len(hdev)) in __hci_req_enable_advertising()
1107 if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE) || in __hci_req_enable_advertising()
1108 hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) { in __hci_req_enable_advertising()
1112 adv_min_interval = hdev->le_adv_min_interval; in __hci_req_enable_advertising()
1113 adv_max_interval = hdev->le_adv_max_interval; in __hci_req_enable_advertising()
1120 cp.channel_map = hdev->le_adv_channel_map; in __hci_req_enable_advertising()
1127 u8 append_local_name(struct hci_dev *hdev, u8 *ptr, u8 ad_len) in append_local_name() argument
1137 complete_len = strlen(hdev->dev_name); in append_local_name()
1140 hdev->dev_name, complete_len + 1); in append_local_name()
1143 short_len = strlen(hdev->short_name); in append_local_name()
1146 hdev->short_name, short_len + 1); in append_local_name()
1154 memcpy(name, hdev->dev_name, HCI_MAX_SHORT_NAME_LENGTH); in append_local_name()
1164 static u8 append_appearance(struct hci_dev *hdev, u8 *ptr, u8 ad_len) in append_appearance() argument
1166 return eir_append_le16(ptr, ad_len, EIR_APPEARANCE, hdev->appearance); in append_appearance()
1169 static u8 create_default_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) in create_default_scan_rsp_data() argument
1173 if (hdev->appearance) { in create_default_scan_rsp_data()
1174 scan_rsp_len = append_appearance(hdev, ptr, scan_rsp_len); in create_default_scan_rsp_data()
1177 return append_local_name(hdev, ptr, scan_rsp_len); in create_default_scan_rsp_data()
1180 static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 instance, in create_instance_scan_rsp_data() argument
1187 adv_instance = hci_find_adv_instance(hdev, instance); in create_instance_scan_rsp_data()
1193 if ((instance_flags & MGMT_ADV_FLAG_APPEARANCE) && hdev->appearance) { in create_instance_scan_rsp_data()
1194 scan_rsp_len = append_appearance(hdev, ptr, scan_rsp_len); in create_instance_scan_rsp_data()
1203 scan_rsp_len = append_local_name(hdev, ptr, scan_rsp_len); in create_instance_scan_rsp_data()
1210 struct hci_dev *hdev = req->hdev; in __hci_req_update_scan_rsp_data() local
1213 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in __hci_req_update_scan_rsp_data()
1216 if (ext_adv_capable(hdev)) { in __hci_req_update_scan_rsp_data()
1222 len = create_instance_scan_rsp_data(hdev, instance, in __hci_req_update_scan_rsp_data()
1225 len = create_default_scan_rsp_data(hdev, cp.data); in __hci_req_update_scan_rsp_data()
1227 if (hdev->scan_rsp_data_len == len && in __hci_req_update_scan_rsp_data()
1228 !memcmp(cp.data, hdev->scan_rsp_data, len)) in __hci_req_update_scan_rsp_data()
1231 memcpy(hdev->scan_rsp_data, cp.data, sizeof(cp.data)); in __hci_req_update_scan_rsp_data()
1232 hdev->scan_rsp_data_len = len; in __hci_req_update_scan_rsp_data()
1247 len = create_instance_scan_rsp_data(hdev, instance, in __hci_req_update_scan_rsp_data()
1250 len = create_default_scan_rsp_data(hdev, cp.data); in __hci_req_update_scan_rsp_data()
1252 if (hdev->scan_rsp_data_len == len && in __hci_req_update_scan_rsp_data()
1253 !memcmp(cp.data, hdev->scan_rsp_data, len)) in __hci_req_update_scan_rsp_data()
1256 memcpy(hdev->scan_rsp_data, cp.data, sizeof(cp.data)); in __hci_req_update_scan_rsp_data()
1257 hdev->scan_rsp_data_len = len; in __hci_req_update_scan_rsp_data()
1265 static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) in create_instance_adv_data() argument
1273 adv_instance = hci_find_adv_instance(hdev, instance); in create_instance_adv_data()
1278 instance_flags = get_adv_instance_flags(hdev, instance); in create_instance_adv_data()
1297 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in create_instance_adv_data()
1305 flags |= mgmt_get_adv_discov_flags(hdev); in create_instance_adv_data()
1331 if (ext_adv_capable(hdev)) { in create_instance_adv_data()
1335 adv_tx_power = hdev->adv_tx_power; in create_instance_adv_data()
1337 adv_tx_power = hdev->adv_tx_power; in create_instance_adv_data()
1356 struct hci_dev *hdev = req->hdev; in __hci_req_update_adv_data() local
1359 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in __hci_req_update_adv_data()
1362 if (ext_adv_capable(hdev)) { in __hci_req_update_adv_data()
1367 len = create_instance_adv_data(hdev, instance, cp.data); in __hci_req_update_adv_data()
1370 if (hdev->adv_data_len == len && in __hci_req_update_adv_data()
1371 memcmp(cp.data, hdev->adv_data, len) == 0) in __hci_req_update_adv_data()
1374 memcpy(hdev->adv_data, cp.data, sizeof(cp.data)); in __hci_req_update_adv_data()
1375 hdev->adv_data_len = len; in __hci_req_update_adv_data()
1388 len = create_instance_adv_data(hdev, instance, cp.data); in __hci_req_update_adv_data()
1391 if (hdev->adv_data_len == len && in __hci_req_update_adv_data()
1392 memcmp(cp.data, hdev->adv_data, len) == 0) in __hci_req_update_adv_data()
1395 memcpy(hdev->adv_data, cp.data, sizeof(cp.data)); in __hci_req_update_adv_data()
1396 hdev->adv_data_len = len; in __hci_req_update_adv_data()
1404 int hci_req_update_adv_data(struct hci_dev *hdev, u8 instance) in hci_req_update_adv_data() argument
1408 hci_req_init(&req, hdev); in hci_req_update_adv_data()
1414 static void adv_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) in adv_enable_complete() argument
1416 BT_DBG("%s status %u", hdev->name, status); in adv_enable_complete()
1419 void hci_req_reenable_advertising(struct hci_dev *hdev) in hci_req_reenable_advertising() argument
1423 if (!hci_dev_test_flag(hdev, HCI_ADVERTISING) && in hci_req_reenable_advertising()
1424 list_empty(&hdev->adv_instances)) in hci_req_reenable_advertising()
1427 hci_req_init(&req, hdev); in hci_req_reenable_advertising()
1429 if (hdev->cur_adv_instance) { in hci_req_reenable_advertising()
1430 __hci_req_schedule_adv_instance(&req, hdev->cur_adv_instance, in hci_req_reenable_advertising()
1433 if (ext_adv_capable(hdev)) { in hci_req_reenable_advertising()
1447 struct hci_dev *hdev = container_of(work, struct hci_dev, in adv_timeout_expire() local
1453 BT_DBG("%s", hdev->name); in adv_timeout_expire()
1455 hci_dev_lock(hdev); in adv_timeout_expire()
1457 hdev->adv_instance_timeout = 0; in adv_timeout_expire()
1459 instance = hdev->cur_adv_instance; in adv_timeout_expire()
1463 hci_req_init(&req, hdev); in adv_timeout_expire()
1465 hci_req_clear_adv_instance(hdev, NULL, &req, instance, false); in adv_timeout_expire()
1467 if (list_empty(&hdev->adv_instances)) in adv_timeout_expire()
1473 hci_dev_unlock(hdev); in adv_timeout_expire()
1476 int hci_get_random_address(struct hci_dev *hdev, bool require_privacy, in hci_get_random_address() argument
1494 !bacmp(&adv_instance->random_addr, &hdev->rpa)) in hci_get_random_address()
1499 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && in hci_get_random_address()
1500 !bacmp(&hdev->random_addr, &hdev->rpa)) in hci_get_random_address()
1504 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); in hci_get_random_address()
1506 BT_ERR("%s failed to generate new RPA", hdev->name); in hci_get_random_address()
1510 bacpy(rand_addr, &hdev->rpa); in hci_get_random_address()
1512 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); in hci_get_random_address()
1514 queue_delayed_work(hdev->workqueue, in hci_get_random_address()
1517 queue_delayed_work(hdev->workqueue, in hci_get_random_address()
1518 &hdev->rpa_expired, to); in hci_get_random_address()
1541 if (bacmp(&hdev->bdaddr, &nrpa)) in hci_get_random_address()
1565 struct hci_dev *hdev = req->hdev; in __hci_req_setup_ext_adv_instance() local
1577 adv_instance = hci_find_adv_instance(hdev, instance); in __hci_req_setup_ext_adv_instance()
1584 flags = get_adv_instance_flags(hdev, instance); in __hci_req_setup_ext_adv_instance()
1590 mgmt_get_connectable(hdev); in __hci_req_setup_ext_adv_instance()
1592 if (!is_advertising_allowed(hdev, connectable)) in __hci_req_setup_ext_adv_instance()
1599 err = hci_get_random_address(hdev, !connectable, in __hci_req_setup_ext_adv_instance()
1600 adv_use_rpa(hdev, flags), adv_instance, in __hci_req_setup_ext_adv_instance()
1617 } else if (get_adv_instance_scan_rsp_len(hdev, instance)) { in __hci_req_setup_ext_adv_instance()
1630 cp.channel_map = hdev->le_adv_channel_map; in __hci_req_setup_ext_adv_instance()
1657 if (!bacmp(&random_addr, &hdev->random_addr)) in __hci_req_setup_ext_adv_instance()
1676 struct hci_dev *hdev = req->hdev; in __hci_req_enable_ext_advertising() local
1683 adv_instance = hci_find_adv_instance(hdev, instance); in __hci_req_enable_ext_advertising()
1721 struct hci_dev *hdev = req->hdev; in __hci_req_start_ext_adv() local
1724 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) in __hci_req_start_ext_adv()
1740 struct hci_dev *hdev = req->hdev; in __hci_req_schedule_adv_instance() local
1744 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || in __hci_req_schedule_adv_instance()
1745 list_empty(&hdev->adv_instances)) in __hci_req_schedule_adv_instance()
1748 if (hdev->adv_instance_timeout) in __hci_req_schedule_adv_instance()
1751 adv_instance = hci_find_adv_instance(hdev, instance); in __hci_req_schedule_adv_instance()
1777 if (!ext_adv_capable(hdev)) { in __hci_req_schedule_adv_instance()
1778 hdev->adv_instance_timeout = timeout; in __hci_req_schedule_adv_instance()
1779 queue_delayed_work(hdev->req_workqueue, in __hci_req_schedule_adv_instance()
1780 &hdev->adv_instance_expire, in __hci_req_schedule_adv_instance()
1788 if (!force && hdev->cur_adv_instance == instance && in __hci_req_schedule_adv_instance()
1789 hci_dev_test_flag(hdev, HCI_LE_ADV)) in __hci_req_schedule_adv_instance()
1792 hdev->cur_adv_instance = instance; in __hci_req_schedule_adv_instance()
1793 if (ext_adv_capable(hdev)) { in __hci_req_schedule_adv_instance()
1804 static void cancel_adv_timeout(struct hci_dev *hdev) in cancel_adv_timeout() argument
1806 if (hdev->adv_instance_timeout) { in cancel_adv_timeout()
1807 hdev->adv_instance_timeout = 0; in cancel_adv_timeout()
1808 cancel_delayed_work(&hdev->adv_instance_expire); in cancel_adv_timeout()
1823 void hci_req_clear_adv_instance(struct hci_dev *hdev, struct sock *sk, in hci_req_clear_adv_instance() argument
1832 if (!instance || hdev->cur_adv_instance == instance) in hci_req_clear_adv_instance()
1833 cancel_adv_timeout(hdev); in hci_req_clear_adv_instance()
1839 if (instance && hdev->cur_adv_instance == instance) in hci_req_clear_adv_instance()
1840 next_instance = hci_get_next_instance(hdev, instance); in hci_req_clear_adv_instance()
1843 list_for_each_entry_safe(adv_instance, n, &hdev->adv_instances, in hci_req_clear_adv_instance()
1849 err = hci_remove_adv_instance(hdev, rem_inst); in hci_req_clear_adv_instance()
1851 mgmt_advertising_removed(sk, hdev, rem_inst); in hci_req_clear_adv_instance()
1854 adv_instance = hci_find_adv_instance(hdev, instance); in hci_req_clear_adv_instance()
1863 err = hci_remove_adv_instance(hdev, instance); in hci_req_clear_adv_instance()
1865 mgmt_advertising_removed(sk, hdev, instance); in hci_req_clear_adv_instance()
1869 if (!req || !hdev_is_powered(hdev) || in hci_req_clear_adv_instance()
1870 hci_dev_test_flag(hdev, HCI_ADVERTISING)) in hci_req_clear_adv_instance()
1880 struct hci_dev *hdev = req->hdev; in set_random_addr() local
1892 if (hci_dev_test_flag(hdev, HCI_LE_ADV) || in set_random_addr()
1893 hci_lookup_le_connect(hdev)) { in set_random_addr()
1895 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); in set_random_addr()
1905 struct hci_dev *hdev = req->hdev; in hci_update_random_address() local
1917 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && in hci_update_random_address()
1918 !bacmp(&hdev->random_addr, &hdev->rpa)) in hci_update_random_address()
1921 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); in hci_update_random_address()
1923 bt_dev_err(hdev, "failed to generate new RPA"); in hci_update_random_address()
1927 set_random_addr(req, &hdev->rpa); in hci_update_random_address()
1929 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); in hci_update_random_address()
1930 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); in hci_update_random_address()
1953 if (bacmp(&hdev->bdaddr, &nrpa)) in hci_update_random_address()
1971 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || in hci_update_random_address()
1972 !bacmp(&hdev->bdaddr, BDADDR_ANY) || in hci_update_random_address()
1973 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && in hci_update_random_address()
1974 bacmp(&hdev->static_addr, BDADDR_ANY))) { in hci_update_random_address()
1976 if (bacmp(&hdev->static_addr, &hdev->random_addr)) in hci_update_random_address()
1978 &hdev->static_addr); in hci_update_random_address()
1990 static bool disconnected_whitelist_entries(struct hci_dev *hdev) in disconnected_whitelist_entries() argument
1994 list_for_each_entry(b, &hdev->whitelist, list) { in disconnected_whitelist_entries()
1997 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr); in disconnected_whitelist_entries()
2010 struct hci_dev *hdev = req->hdev; in __hci_req_update_scan() local
2013 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in __hci_req_update_scan()
2016 if (!hdev_is_powered(hdev)) in __hci_req_update_scan()
2019 if (mgmt_powering_down(hdev)) in __hci_req_update_scan()
2022 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) || in __hci_req_update_scan()
2023 disconnected_whitelist_entries(hdev)) in __hci_req_update_scan()
2028 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) in __hci_req_update_scan()
2031 if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE) && in __hci_req_update_scan()
2032 test_bit(HCI_ISCAN, &hdev->flags) == !!(scan & SCAN_INQUIRY)) in __hci_req_update_scan()
2040 hci_dev_lock(req->hdev); in update_scan()
2042 hci_dev_unlock(req->hdev); in update_scan()
2048 struct hci_dev *hdev = container_of(work, struct hci_dev, scan_update); in scan_update_work() local
2050 hci_req_sync(hdev, update_scan, 0, HCI_CMD_TIMEOUT, NULL); in scan_update_work()
2055 struct hci_dev *hdev = req->hdev; in connectable_update() local
2057 hci_dev_lock(hdev); in connectable_update()
2065 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in connectable_update()
2066 __hci_req_update_adv_data(req, hdev->cur_adv_instance); in connectable_update()
2069 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || in connectable_update()
2070 !list_empty(&hdev->adv_instances)) { in connectable_update()
2071 if (ext_adv_capable(hdev)) in connectable_update()
2072 __hci_req_start_ext_adv(req, hdev->cur_adv_instance); in connectable_update()
2079 hci_dev_unlock(hdev); in connectable_update()
2086 struct hci_dev *hdev = container_of(work, struct hci_dev, in connectable_update_work() local
2090 hci_req_sync(hdev, connectable_update, 0, HCI_CMD_TIMEOUT, &status); in connectable_update_work()
2091 mgmt_set_connectable_complete(hdev, status); in connectable_update_work()
2094 static u8 get_service_classes(struct hci_dev *hdev) in get_service_classes() argument
2099 list_for_each_entry(uuid, &hdev->uuids, list) in get_service_classes()
2107 struct hci_dev *hdev = req->hdev; in __hci_req_update_class() local
2110 BT_DBG("%s", hdev->name); in __hci_req_update_class()
2112 if (!hdev_is_powered(hdev)) in __hci_req_update_class()
2115 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) in __hci_req_update_class()
2118 if (hci_dev_test_flag(hdev, HCI_SERVICE_CACHE)) in __hci_req_update_class()
2121 cod[0] = hdev->minor_class; in __hci_req_update_class()
2122 cod[1] = hdev->major_class; in __hci_req_update_class()
2123 cod[2] = get_service_classes(hdev); in __hci_req_update_class()
2125 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) in __hci_req_update_class()
2128 if (memcmp(cod, hdev->dev_class, 3) == 0) in __hci_req_update_class()
2136 struct hci_dev *hdev = req->hdev; in write_iac() local
2139 if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) in write_iac()
2142 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) { in write_iac()
2144 cp.num_iac = min_t(u8, hdev->num_iac, 2); in write_iac()
2165 struct hci_dev *hdev = req->hdev; in discoverable_update() local
2167 hci_dev_lock(hdev); in discoverable_update()
2169 if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { in discoverable_update()
2178 if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) { in discoverable_update()
2184 if (hci_dev_test_flag(hdev, HCI_LIMITED_PRIVACY)) { in discoverable_update()
2185 if (ext_adv_capable(hdev)) in discoverable_update()
2192 hci_dev_unlock(hdev); in discoverable_update()
2199 struct hci_dev *hdev = container_of(work, struct hci_dev, in discoverable_update_work() local
2203 hci_req_sync(hdev, discoverable_update, 0, HCI_CMD_TIMEOUT, &status); in discoverable_update_work()
2204 mgmt_set_discoverable_complete(hdev, status); in discoverable_update_work()
2238 if (req->hdev->hci_ver < BLUETOOTH_VER_1_2) in __hci_abort_conn()
2276 static void abort_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode) in abort_conn_complete() argument
2287 hci_req_init(&req, conn->hdev); in hci_abort_conn()
2293 bt_dev_err(conn->hdev, "failed to run HCI request: err %d", err); in hci_abort_conn()
2302 hci_dev_lock(req->hdev); in update_bg_scan()
2304 hci_dev_unlock(req->hdev); in update_bg_scan()
2310 struct hci_dev *hdev = container_of(work, struct hci_dev, in bg_scan_update() local
2316 err = hci_req_sync(hdev, update_bg_scan, 0, HCI_CMD_TIMEOUT, &status); in bg_scan_update()
2320 hci_dev_lock(hdev); in bg_scan_update()
2322 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); in bg_scan_update()
2326 hci_dev_unlock(hdev); in bg_scan_update()
2342 BT_DBG("%s", req->hdev->name); in bredr_inquiry()
2344 hci_dev_lock(req->hdev); in bredr_inquiry()
2345 hci_inquiry_cache_flush(req->hdev); in bredr_inquiry()
2346 hci_dev_unlock(req->hdev); in bredr_inquiry()
2350 if (req->hdev->discovery.limited) in bredr_inquiry()
2364 struct hci_dev *hdev = container_of(work, struct hci_dev, in le_scan_disable_work() local
2368 BT_DBG("%s", hdev->name); in le_scan_disable_work()
2370 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) in le_scan_disable_work()
2373 cancel_delayed_work(&hdev->le_scan_restart); in le_scan_disable_work()
2375 hci_req_sync(hdev, le_scan_disable, 0, HCI_CMD_TIMEOUT, &status); in le_scan_disable_work()
2377 bt_dev_err(hdev, "failed to disable LE scan: status 0x%02x", in le_scan_disable_work()
2382 hdev->discovery.scan_start = 0; in le_scan_disable_work()
2392 if (hdev->discovery.type == DISCOV_TYPE_LE) in le_scan_disable_work()
2395 if (hdev->discovery.type != DISCOV_TYPE_INTERLEAVED) in le_scan_disable_work()
2398 if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) { in le_scan_disable_work()
2399 if (!test_bit(HCI_INQUIRY, &hdev->flags) && in le_scan_disable_work()
2400 hdev->discovery.state != DISCOVERY_RESOLVING) in le_scan_disable_work()
2406 hci_req_sync(hdev, bredr_inquiry, DISCOV_INTERLEAVED_INQUIRY_LEN, in le_scan_disable_work()
2409 bt_dev_err(hdev, "inquiry failed: status 0x%02x", status); in le_scan_disable_work()
2416 hci_dev_lock(hdev); in le_scan_disable_work()
2417 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in le_scan_disable_work()
2418 hci_dev_unlock(hdev); in le_scan_disable_work()
2423 struct hci_dev *hdev = req->hdev; in le_scan_restart() local
2426 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) in le_scan_restart()
2431 if (use_ext_scan(hdev)) { in le_scan_restart()
2454 struct hci_dev *hdev = container_of(work, struct hci_dev, in le_scan_restart_work() local
2459 BT_DBG("%s", hdev->name); in le_scan_restart_work()
2461 hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status); in le_scan_restart_work()
2463 bt_dev_err(hdev, "failed to restart LE scan: status %d", in le_scan_restart_work()
2468 hci_dev_lock(hdev); in le_scan_restart_work()
2470 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) || in le_scan_restart_work()
2471 !hdev->discovery.scan_start) in le_scan_restart_work()
2479 duration = hdev->discovery.scan_duration; in le_scan_restart_work()
2480 scan_start = hdev->discovery.scan_start; in le_scan_restart_work()
2495 queue_delayed_work(hdev->req_workqueue, in le_scan_restart_work()
2496 &hdev->le_scan_disable, timeout); in le_scan_restart_work()
2499 hci_dev_unlock(hdev); in le_scan_restart_work()
2505 struct hci_dev *hdev = req->hdev; in active_scan() local
2509 BT_DBG("%s", hdev->name); in active_scan()
2511 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) { in active_scan()
2512 hci_dev_lock(hdev); in active_scan()
2517 if (hci_lookup_le_connect(hdev)) { in active_scan()
2518 hci_dev_unlock(hdev); in active_scan()
2522 cancel_adv_timeout(hdev); in active_scan()
2523 hci_dev_unlock(hdev); in active_scan()
2532 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) in active_scan()
2539 err = hci_update_random_address(req, true, scan_use_rpa(hdev), in active_scan()
2553 BT_DBG("%s", req->hdev->name); in interleaved_discov()
2562 static void start_discovery(struct hci_dev *hdev, u8 *status) in start_discovery() argument
2566 BT_DBG("%s type %u", hdev->name, hdev->discovery.type); in start_discovery()
2568 switch (hdev->discovery.type) { in start_discovery()
2570 if (!hci_dev_test_flag(hdev, HCI_INQUIRY)) in start_discovery()
2571 hci_req_sync(hdev, bredr_inquiry, in start_discovery()
2585 &hdev->quirks)) { in start_discovery()
2591 hci_req_sync(hdev, interleaved_discov, in start_discovery()
2597 timeout = msecs_to_jiffies(hdev->discov_interleaved_timeout); in start_discovery()
2598 hci_req_sync(hdev, active_scan, DISCOV_LE_SCAN_INT, in start_discovery()
2603 hci_req_sync(hdev, active_scan, DISCOV_LE_SCAN_INT, in start_discovery()
2614 BT_DBG("%s timeout %u ms", hdev->name, jiffies_to_msecs(timeout)); in start_discovery()
2621 if (test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) && in start_discovery()
2622 hdev->discovery.result_filtering) { in start_discovery()
2623 hdev->discovery.scan_start = jiffies; in start_discovery()
2624 hdev->discovery.scan_duration = timeout; in start_discovery()
2627 queue_delayed_work(hdev->req_workqueue, &hdev->le_scan_disable, in start_discovery()
2633 struct hci_dev *hdev = req->hdev; in hci_req_stop_discovery() local
2634 struct discovery_state *d = &hdev->discovery; in hci_req_stop_discovery()
2639 BT_DBG("%s state %u", hdev->name, hdev->discovery.state); in hci_req_stop_discovery()
2642 if (test_bit(HCI_INQUIRY, &hdev->flags)) in hci_req_stop_discovery()
2645 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { in hci_req_stop_discovery()
2646 cancel_delayed_work(&hdev->le_scan_disable); in hci_req_stop_discovery()
2653 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { in hci_req_stop_discovery()
2664 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, in hci_req_stop_discovery()
2680 hci_dev_lock(req->hdev); in stop_discovery()
2682 hci_dev_unlock(req->hdev); in stop_discovery()
2689 struct hci_dev *hdev = container_of(work, struct hci_dev, in discov_update() local
2693 switch (hdev->discovery.state) { in discov_update()
2695 start_discovery(hdev, &status); in discov_update()
2696 mgmt_start_discovery_complete(hdev, status); in discov_update()
2698 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in discov_update()
2700 hci_discovery_set_state(hdev, DISCOVERY_FINDING); in discov_update()
2703 hci_req_sync(hdev, stop_discovery, 0, HCI_CMD_TIMEOUT, &status); in discov_update()
2704 mgmt_stop_discovery_complete(hdev, status); in discov_update()
2706 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); in discov_update()
2716 struct hci_dev *hdev = container_of(work, struct hci_dev, in discov_off() local
2719 BT_DBG("%s", hdev->name); in discov_off()
2721 hci_dev_lock(hdev); in discov_off()
2728 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); in discov_off()
2729 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); in discov_off()
2730 hdev->discov_timeout = 0; in discov_off()
2732 hci_dev_unlock(hdev); in discov_off()
2734 hci_req_sync(hdev, discoverable_update, 0, HCI_CMD_TIMEOUT, NULL); in discov_off()
2735 mgmt_new_settings(hdev); in discov_off()
2740 struct hci_dev *hdev = req->hdev; in powered_update_hci() local
2743 hci_dev_lock(hdev); in powered_update_hci()
2745 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED) && in powered_update_hci()
2746 !lmp_host_ssp_capable(hdev)) { in powered_update_hci()
2751 if (bredr_sc_enabled(hdev) && !lmp_host_sc_capable(hdev)) { in powered_update_hci()
2759 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED) && in powered_update_hci()
2760 lmp_bredr_capable(hdev)) { in powered_update_hci()
2769 if (cp.le != lmp_host_le_capable(hdev) || in powered_update_hci()
2770 cp.simul != lmp_host_le_br_capable(hdev)) in powered_update_hci()
2775 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { in powered_update_hci()
2780 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || in powered_update_hci()
2781 list_empty(&hdev->adv_instances)) { in powered_update_hci()
2784 if (ext_adv_capable(hdev)) { in powered_update_hci()
2796 if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) { in powered_update_hci()
2797 if (!ext_adv_capable(hdev)) in powered_update_hci()
2803 } else if (!list_empty(&hdev->adv_instances)) { in powered_update_hci()
2806 adv_instance = list_first_entry(&hdev->adv_instances, in powered_update_hci()
2814 link_sec = hci_dev_test_flag(hdev, HCI_LINK_SECURITY); in powered_update_hci()
2815 if (link_sec != test_bit(HCI_AUTH, &hdev->flags)) in powered_update_hci()
2819 if (lmp_bredr_capable(hdev)) { in powered_update_hci()
2820 if (hci_dev_test_flag(hdev, HCI_FAST_CONNECTABLE)) in powered_update_hci()
2830 hci_dev_unlock(hdev); in powered_update_hci()
2834 int __hci_req_hci_power_on(struct hci_dev *hdev) in __hci_req_hci_power_on() argument
2841 smp_register(hdev); in __hci_req_hci_power_on()
2843 return __hci_req_sync(hdev, powered_update_hci, 0, HCI_CMD_TIMEOUT, in __hci_req_hci_power_on()
2847 void hci_request_setup(struct hci_dev *hdev) in hci_request_setup() argument
2849 INIT_WORK(&hdev->discov_update, discov_update); in hci_request_setup()
2850 INIT_WORK(&hdev->bg_scan_update, bg_scan_update); in hci_request_setup()
2851 INIT_WORK(&hdev->scan_update, scan_update_work); in hci_request_setup()
2852 INIT_WORK(&hdev->connectable_update, connectable_update_work); in hci_request_setup()
2853 INIT_WORK(&hdev->discoverable_update, discoverable_update_work); in hci_request_setup()
2854 INIT_DELAYED_WORK(&hdev->discov_off, discov_off); in hci_request_setup()
2855 INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); in hci_request_setup()
2856 INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work); in hci_request_setup()
2857 INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire); in hci_request_setup()
2860 void hci_request_cancel_all(struct hci_dev *hdev) in hci_request_cancel_all() argument
2862 hci_req_sync_cancel(hdev, ENODEV); in hci_request_cancel_all()
2864 cancel_work_sync(&hdev->discov_update); in hci_request_cancel_all()
2865 cancel_work_sync(&hdev->bg_scan_update); in hci_request_cancel_all()
2866 cancel_work_sync(&hdev->scan_update); in hci_request_cancel_all()
2867 cancel_work_sync(&hdev->connectable_update); in hci_request_cancel_all()
2868 cancel_work_sync(&hdev->discoverable_update); in hci_request_cancel_all()
2869 cancel_delayed_work_sync(&hdev->discov_off); in hci_request_cancel_all()
2870 cancel_delayed_work_sync(&hdev->le_scan_disable); in hci_request_cancel_all()
2871 cancel_delayed_work_sync(&hdev->le_scan_restart); in hci_request_cancel_all()
2873 if (hdev->adv_instance_timeout) { in hci_request_cancel_all()
2874 cancel_delayed_work_sync(&hdev->adv_instance_expire); in hci_request_cancel_all()
2875 hdev->adv_instance_timeout = 0; in hci_request_cancel_all()