Searched refs:hdev (Results 1 - 200 of 209) sorted by relevance

12

/linux-4.1.27/net/bluetooth/
H A Dhci_debugfs.c36 struct hci_dev *hdev = file->private_data; \
39 buf[0] = test_bit(__quirk, &hdev->quirks) ? 'Y' : 'N'; \
49 struct hci_dev *hdev = file->private_data; \
54 if (test_bit(HCI_UP, &hdev->flags)) \
64 if (enable == test_bit(__quirk, &hdev->quirks)) \
67 change_bit(__quirk, &hdev->quirks); \
81 struct hci_dev *hdev = f->private; features_show() local
84 hci_dev_lock(hdev); features_show()
85 for (p = 0; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { features_show()
88 hdev->features[p][0], hdev->features[p][1], features_show()
89 hdev->features[p][2], hdev->features[p][3], features_show()
90 hdev->features[p][4], hdev->features[p][5], features_show()
91 hdev->features[p][6], hdev->features[p][7]); features_show()
93 if (lmp_le_capable(hdev)) features_show()
96 hdev->le_features[0], hdev->le_features[1], features_show()
97 hdev->le_features[2], hdev->le_features[3], features_show()
98 hdev->le_features[4], hdev->le_features[5], features_show()
99 hdev->le_features[6], hdev->le_features[7]); features_show()
100 hci_dev_unlock(hdev); features_show()
119 struct hci_dev *hdev = f->private; device_id_show() local
121 hci_dev_lock(hdev); device_id_show()
122 seq_printf(f, "%4.4x:%4.4x:%4.4x:%4.4x\n", hdev->devid_source, device_id_show()
123 hdev->devid_vendor, hdev->devid_product, hdev->devid_version); device_id_show()
124 hci_dev_unlock(hdev); device_id_show()
143 struct hci_dev *hdev = f->private; device_list_show() local
147 hci_dev_lock(hdev); device_list_show()
148 list_for_each_entry(b, &hdev->whitelist, list) device_list_show()
150 list_for_each_entry(p, &hdev->le_conn_params, list) { device_list_show()
154 hci_dev_unlock(hdev); device_list_show()
173 struct hci_dev *hdev = f->private; blacklist_show() local
176 hci_dev_lock(hdev); blacklist_show()
177 list_for_each_entry(b, &hdev->blacklist, list) blacklist_show()
179 hci_dev_unlock(hdev); blacklist_show()
198 struct hci_dev *hdev = f->private; uuids_show() local
201 hci_dev_lock(hdev); uuids_show()
202 list_for_each_entry(uuid, &hdev->uuids, list) { uuids_show()
214 hci_dev_unlock(hdev); uuids_show()
233 struct hci_dev *hdev = f->private; remote_oob_show() local
236 hci_dev_lock(hdev); remote_oob_show()
237 list_for_each_entry(data, &hdev->remote_oob_data, list) { remote_oob_show()
243 hci_dev_unlock(hdev); remote_oob_show()
262 struct hci_dev *hdev = data; conn_info_min_age_set() local
264 if (val == 0 || val > hdev->conn_info_max_age) conn_info_min_age_set()
267 hci_dev_lock(hdev); conn_info_min_age_set()
268 hdev->conn_info_min_age = val; conn_info_min_age_set()
269 hci_dev_unlock(hdev); conn_info_min_age_set()
276 struct hci_dev *hdev = data; conn_info_min_age_get() local
278 hci_dev_lock(hdev); conn_info_min_age_get()
279 *val = hdev->conn_info_min_age; conn_info_min_age_get()
280 hci_dev_unlock(hdev); conn_info_min_age_get()
290 struct hci_dev *hdev = data; conn_info_max_age_set() local
292 if (val == 0 || val < hdev->conn_info_min_age) conn_info_max_age_set()
295 hci_dev_lock(hdev); conn_info_max_age_set()
296 hdev->conn_info_max_age = val; conn_info_max_age_set()
297 hci_dev_unlock(hdev); conn_info_max_age_set()
304 struct hci_dev *hdev = data; conn_info_max_age_get() local
306 hci_dev_lock(hdev); conn_info_max_age_get()
307 *val = hdev->conn_info_max_age; conn_info_max_age_get()
308 hci_dev_unlock(hdev); conn_info_max_age_get()
319 struct hci_dev *hdev = file->private_data; use_debug_keys_read() local
322 buf[0] = hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS) ? 'Y': 'N'; use_debug_keys_read()
337 struct hci_dev *hdev = file->private_data; sc_only_mode_read() local
340 buf[0] = hci_dev_test_flag(hdev, HCI_SC_ONLY) ? 'Y': 'N'; sc_only_mode_read()
352 void hci_debugfs_create_common(struct hci_dev *hdev) hci_debugfs_create_common() argument
354 debugfs_create_file("features", 0444, hdev->debugfs, hdev, hci_debugfs_create_common()
356 debugfs_create_u16("manufacturer", 0444, hdev->debugfs, hci_debugfs_create_common()
357 &hdev->manufacturer); hci_debugfs_create_common()
358 debugfs_create_u8("hci_version", 0444, hdev->debugfs, &hdev->hci_ver); hci_debugfs_create_common()
359 debugfs_create_u16("hci_revision", 0444, hdev->debugfs, &hdev->hci_rev); hci_debugfs_create_common()
360 debugfs_create_u8("hardware_error", 0444, hdev->debugfs, hci_debugfs_create_common()
361 &hdev->hw_error_code); hci_debugfs_create_common()
362 debugfs_create_file("device_id", 0444, hdev->debugfs, hdev, hci_debugfs_create_common()
365 debugfs_create_file("device_list", 0444, hdev->debugfs, hdev, hci_debugfs_create_common()
367 debugfs_create_file("blacklist", 0444, hdev->debugfs, hdev, hci_debugfs_create_common()
369 debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops); hci_debugfs_create_common()
370 debugfs_create_file("remote_oob", 0400, hdev->debugfs, hdev, hci_debugfs_create_common()
373 debugfs_create_file("conn_info_min_age", 0644, hdev->debugfs, hdev, hci_debugfs_create_common()
375 debugfs_create_file("conn_info_max_age", 0644, hdev->debugfs, hdev, hci_debugfs_create_common()
378 if (lmp_ssp_capable(hdev) || lmp_le_capable(hdev)) hci_debugfs_create_common()
379 debugfs_create_file("use_debug_keys", 0444, hdev->debugfs, hci_debugfs_create_common()
380 hdev, &use_debug_keys_fops); hci_debugfs_create_common()
382 if (lmp_sc_capable(hdev) || lmp_le_capable(hdev)) hci_debugfs_create_common()
383 debugfs_create_file("sc_only_mode", 0444, hdev->debugfs, hci_debugfs_create_common()
384 hdev, &sc_only_mode_fops); hci_debugfs_create_common()
389 struct hci_dev *hdev = f->private; inquiry_cache_show() local
390 struct discovery_state *cache = &hdev->discovery; inquiry_cache_show()
393 hci_dev_lock(hdev); inquiry_cache_show()
406 hci_dev_unlock(hdev); inquiry_cache_show()
425 struct hci_dev *hdev = f->private; link_keys_show() local
429 list_for_each_entry_rcu(key, &hdev->link_keys, list) link_keys_show()
451 struct hci_dev *hdev = f->private; dev_class_show() local
453 hci_dev_lock(hdev); dev_class_show()
454 seq_printf(f, "0x%.2x%.2x%.2x\n", hdev->dev_class[2], dev_class_show()
455 hdev->dev_class[1], hdev->dev_class[0]); dev_class_show()
456 hci_dev_unlock(hdev); dev_class_show()
475 struct hci_dev *hdev = data; voice_setting_get() local
477 hci_dev_lock(hdev); voice_setting_get()
478 *val = hdev->voice_setting; voice_setting_get()
479 hci_dev_unlock(hdev); voice_setting_get()
490 struct hci_dev *hdev = file->private_data; ssp_debug_mode_read() local
493 buf[0] = hdev->ssp_debug_mode ? 'Y': 'N'; ssp_debug_mode_read()
507 struct hci_dev *hdev = data; auto_accept_delay_set() local
509 hci_dev_lock(hdev); auto_accept_delay_set()
510 hdev->auto_accept_delay = val; auto_accept_delay_set()
511 hci_dev_unlock(hdev); auto_accept_delay_set()
518 struct hci_dev *hdev = data; auto_accept_delay_get() local
520 hci_dev_lock(hdev); auto_accept_delay_get()
521 *val = hdev->auto_accept_delay; auto_accept_delay_get()
522 hci_dev_unlock(hdev); auto_accept_delay_get()
532 struct hci_dev *hdev = data; idle_timeout_set() local
537 hci_dev_lock(hdev); idle_timeout_set()
538 hdev->idle_timeout = val; idle_timeout_set()
539 hci_dev_unlock(hdev); idle_timeout_set()
546 struct hci_dev *hdev = data; idle_timeout_get() local
548 hci_dev_lock(hdev); idle_timeout_get()
549 *val = hdev->idle_timeout; idle_timeout_get()
550 hci_dev_unlock(hdev); idle_timeout_get()
560 struct hci_dev *hdev = data; sniff_min_interval_set() local
562 if (val == 0 || val % 2 || val > hdev->sniff_max_interval) sniff_min_interval_set()
565 hci_dev_lock(hdev); sniff_min_interval_set()
566 hdev->sniff_min_interval = val; sniff_min_interval_set()
567 hci_dev_unlock(hdev); sniff_min_interval_set()
574 struct hci_dev *hdev = data; sniff_min_interval_get() local
576 hci_dev_lock(hdev); sniff_min_interval_get()
577 *val = hdev->sniff_min_interval; sniff_min_interval_get()
578 hci_dev_unlock(hdev); sniff_min_interval_get()
588 struct hci_dev *hdev = data; sniff_max_interval_set() local
590 if (val == 0 || val % 2 || val < hdev->sniff_min_interval) sniff_max_interval_set()
593 hci_dev_lock(hdev); sniff_max_interval_set()
594 hdev->sniff_max_interval = val; sniff_max_interval_set()
595 hci_dev_unlock(hdev); sniff_max_interval_set()
602 struct hci_dev *hdev = data; sniff_max_interval_get() local
604 hci_dev_lock(hdev); sniff_max_interval_get()
605 *val = hdev->sniff_max_interval; sniff_max_interval_get()
606 hci_dev_unlock(hdev); sniff_max_interval_get()
614 void hci_debugfs_create_bredr(struct hci_dev *hdev) hci_debugfs_create_bredr() argument
616 debugfs_create_file("inquiry_cache", 0444, hdev->debugfs, hdev, hci_debugfs_create_bredr()
618 debugfs_create_file("link_keys", 0400, hdev->debugfs, hdev, hci_debugfs_create_bredr()
620 debugfs_create_file("dev_class", 0444, hdev->debugfs, hdev, hci_debugfs_create_bredr()
622 debugfs_create_file("voice_setting", 0444, hdev->debugfs, hdev, hci_debugfs_create_bredr()
625 if (lmp_ssp_capable(hdev)) { hci_debugfs_create_bredr()
626 debugfs_create_file("ssp_debug_mode", 0444, hdev->debugfs, hci_debugfs_create_bredr()
627 hdev, &ssp_debug_mode_fops); hci_debugfs_create_bredr()
628 debugfs_create_file("auto_accept_delay", 0644, hdev->debugfs, hci_debugfs_create_bredr()
629 hdev, &auto_accept_delay_fops); hci_debugfs_create_bredr()
632 if (lmp_sniff_capable(hdev)) { hci_debugfs_create_bredr()
633 debugfs_create_file("idle_timeout", 0644, hdev->debugfs, hci_debugfs_create_bredr()
634 hdev, &idle_timeout_fops); hci_debugfs_create_bredr()
635 debugfs_create_file("sniff_min_interval", 0644, hdev->debugfs, hci_debugfs_create_bredr()
636 hdev, &sniff_min_interval_fops); hci_debugfs_create_bredr()
637 debugfs_create_file("sniff_max_interval", 0644, hdev->debugfs, hci_debugfs_create_bredr()
638 hdev, &sniff_max_interval_fops); hci_debugfs_create_bredr()
644 struct hci_dev *hdev = f->private; identity_show() local
648 hci_dev_lock(hdev); identity_show()
650 hci_copy_identity_address(hdev, &addr, &addr_type); identity_show()
653 16, hdev->irk, &hdev->rpa); identity_show()
655 hci_dev_unlock(hdev); identity_show()
674 struct hci_dev *hdev = data; rpa_timeout_set() local
682 hci_dev_lock(hdev); rpa_timeout_set()
683 hdev->rpa_timeout = val; rpa_timeout_set()
684 hci_dev_unlock(hdev); rpa_timeout_set()
691 struct hci_dev *hdev = data; rpa_timeout_get() local
693 hci_dev_lock(hdev); rpa_timeout_get()
694 *val = hdev->rpa_timeout; rpa_timeout_get()
695 hci_dev_unlock(hdev); rpa_timeout_get()
705 struct hci_dev *hdev = f->private; random_address_show() local
707 hci_dev_lock(hdev); random_address_show()
708 seq_printf(f, "%pMR\n", &hdev->random_addr); random_address_show()
709 hci_dev_unlock(hdev); random_address_show()
728 struct hci_dev *hdev = f->private; static_address_show() local
730 hci_dev_lock(hdev); static_address_show()
731 seq_printf(f, "%pMR\n", &hdev->static_addr); static_address_show()
732 hci_dev_unlock(hdev); static_address_show()
753 struct hci_dev *hdev = file->private_data; force_static_address_read() local
756 buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y': 'N'; force_static_address_read()
766 struct hci_dev *hdev = file->private_data; force_static_address_write() local
771 if (test_bit(HCI_UP, &hdev->flags)) force_static_address_write()
781 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR)) force_static_address_write()
784 hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR); force_static_address_write()
798 struct hci_dev *hdev = f->private; white_list_show() local
801 hci_dev_lock(hdev); white_list_show()
802 list_for_each_entry(b, &hdev->le_white_list, list) white_list_show()
804 hci_dev_unlock(hdev); white_list_show()
823 struct hci_dev *hdev = f->private; identity_resolving_keys_show() local
827 list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { identity_resolving_keys_show()
852 struct hci_dev *hdev = f->private; long_term_keys_show() local
856 list_for_each_entry_rcu(ltk, &hdev->long_term_keys, list) long_term_keys_show()
880 struct hci_dev *hdev = data; conn_min_interval_set() local
882 if (val < 0x0006 || val > 0x0c80 || val > hdev->le_conn_max_interval) conn_min_interval_set()
885 hci_dev_lock(hdev); conn_min_interval_set()
886 hdev->le_conn_min_interval = val; conn_min_interval_set()
887 hci_dev_unlock(hdev); conn_min_interval_set()
894 struct hci_dev *hdev = data; conn_min_interval_get() local
896 hci_dev_lock(hdev); conn_min_interval_get()
897 *val = hdev->le_conn_min_interval; conn_min_interval_get()
898 hci_dev_unlock(hdev); conn_min_interval_get()
908 struct hci_dev *hdev = data; conn_max_interval_set() local
910 if (val < 0x0006 || val > 0x0c80 || val < hdev->le_conn_min_interval) conn_max_interval_set()
913 hci_dev_lock(hdev); conn_max_interval_set()
914 hdev->le_conn_max_interval = val; conn_max_interval_set()
915 hci_dev_unlock(hdev); conn_max_interval_set()
922 struct hci_dev *hdev = data; conn_max_interval_get() local
924 hci_dev_lock(hdev); conn_max_interval_get()
925 *val = hdev->le_conn_max_interval; conn_max_interval_get()
926 hci_dev_unlock(hdev); conn_max_interval_get()
936 struct hci_dev *hdev = data; conn_latency_set() local
941 hci_dev_lock(hdev); conn_latency_set()
942 hdev->le_conn_latency = val; conn_latency_set()
943 hci_dev_unlock(hdev); conn_latency_set()
950 struct hci_dev *hdev = data; conn_latency_get() local
952 hci_dev_lock(hdev); conn_latency_get()
953 *val = hdev->le_conn_latency; conn_latency_get()
954 hci_dev_unlock(hdev); conn_latency_get()
964 struct hci_dev *hdev = data; supervision_timeout_set() local
969 hci_dev_lock(hdev); supervision_timeout_set()
970 hdev->le_supv_timeout = val; supervision_timeout_set()
971 hci_dev_unlock(hdev); supervision_timeout_set()
978 struct hci_dev *hdev = data; supervision_timeout_get() local
980 hci_dev_lock(hdev); supervision_timeout_get()
981 *val = hdev->le_supv_timeout; supervision_timeout_get()
982 hci_dev_unlock(hdev); supervision_timeout_get()
992 struct hci_dev *hdev = data; adv_channel_map_set() local
997 hci_dev_lock(hdev); adv_channel_map_set()
998 hdev->le_adv_channel_map = val; adv_channel_map_set()
999 hci_dev_unlock(hdev); adv_channel_map_set()
1006 struct hci_dev *hdev = data; adv_channel_map_get() local
1008 hci_dev_lock(hdev); adv_channel_map_get()
1009 *val = hdev->le_adv_channel_map; adv_channel_map_get()
1010 hci_dev_unlock(hdev); adv_channel_map_get()
1020 struct hci_dev *hdev = data; adv_min_interval_set() local
1022 if (val < 0x0020 || val > 0x4000 || val > hdev->le_adv_max_interval) adv_min_interval_set()
1025 hci_dev_lock(hdev); adv_min_interval_set()
1026 hdev->le_adv_min_interval = val; adv_min_interval_set()
1027 hci_dev_unlock(hdev); adv_min_interval_set()
1034 struct hci_dev *hdev = data; adv_min_interval_get() local
1036 hci_dev_lock(hdev); adv_min_interval_get()
1037 *val = hdev->le_adv_min_interval; adv_min_interval_get()
1038 hci_dev_unlock(hdev); adv_min_interval_get()
1048 struct hci_dev *hdev = data; adv_max_interval_set() local
1050 if (val < 0x0020 || val > 0x4000 || val < hdev->le_adv_min_interval) adv_max_interval_set()
1053 hci_dev_lock(hdev); adv_max_interval_set()
1054 hdev->le_adv_max_interval = val; adv_max_interval_set()
1055 hci_dev_unlock(hdev); adv_max_interval_set()
1062 struct hci_dev *hdev = data; adv_max_interval_get() local
1064 hci_dev_lock(hdev); adv_max_interval_get()
1065 *val = hdev->le_adv_max_interval; adv_max_interval_get()
1066 hci_dev_unlock(hdev); adv_max_interval_get()
1079 void hci_debugfs_create_le(struct hci_dev *hdev) hci_debugfs_create_le() argument
1081 debugfs_create_file("identity", 0400, hdev->debugfs, hdev, hci_debugfs_create_le()
1083 debugfs_create_file("rpa_timeout", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1085 debugfs_create_file("random_address", 0444, hdev->debugfs, hdev, hci_debugfs_create_le()
1087 debugfs_create_file("static_address", 0444, hdev->debugfs, hdev, hci_debugfs_create_le()
1094 if (bacmp(&hdev->bdaddr, BDADDR_ANY)) hci_debugfs_create_le()
1096 hdev->debugfs, hdev, hci_debugfs_create_le()
1099 debugfs_create_u8("white_list_size", 0444, hdev->debugfs, hci_debugfs_create_le()
1100 &hdev->le_white_list_size); hci_debugfs_create_le()
1101 debugfs_create_file("white_list", 0444, hdev->debugfs, hdev, hci_debugfs_create_le()
1103 debugfs_create_file("identity_resolving_keys", 0400, hdev->debugfs, hci_debugfs_create_le()
1104 hdev, &identity_resolving_keys_fops); hci_debugfs_create_le()
1105 debugfs_create_file("long_term_keys", 0400, hdev->debugfs, hdev, hci_debugfs_create_le()
1107 debugfs_create_file("conn_min_interval", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1109 debugfs_create_file("conn_max_interval", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1111 debugfs_create_file("conn_latency", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1113 debugfs_create_file("supervision_timeout", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1115 debugfs_create_file("adv_channel_map", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1117 debugfs_create_file("adv_min_interval", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1119 debugfs_create_file("adv_max_interval", 0644, hdev->debugfs, hdev, hci_debugfs_create_le()
1121 debugfs_create_u16("discov_interleaved_timeout", 0644, hdev->debugfs, hci_debugfs_create_le()
1122 &hdev->discov_interleaved_timeout); hci_debugfs_create_le()
1125 hdev->debugfs, hdev, hci_debugfs_create_le()
1128 hdev->debugfs, hdev, hci_debugfs_create_le()
1134 struct hci_dev *hdev = conn->hdev; hci_debugfs_create_conn() local
1137 if (IS_ERR_OR_NULL(hdev->debugfs)) hci_debugfs_create_conn()
1141 conn->debugfs = debugfs_create_dir(name, hdev->debugfs); hci_debugfs_create_conn()
H A Dmgmt.c243 static int mgmt_index_event(u16 event, struct hci_dev *hdev, void *data, mgmt_index_event() argument
246 return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len, mgmt_index_event()
250 static int mgmt_limited_event(u16 event, struct hci_dev *hdev, void *data, mgmt_limited_event() argument
253 return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len, mgmt_limited_event()
257 static int mgmt_generic_event(u16 event, struct hci_dev *hdev, void *data, mgmt_generic_event() argument
260 return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len, mgmt_generic_event()
264 static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 len, mgmt_event() argument
267 return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len, mgmt_event()
271 static int read_version(struct sock *sk, struct hci_dev *hdev, void *data, read_version() argument
285 static int read_commands(struct sock *sk, struct hci_dev *hdev, void *data, read_commands() argument
337 static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, read_index_list() argument
397 static int read_unconf_index_list(struct sock *sk, struct hci_dev *hdev, read_unconf_index_list() argument
457 static int read_ext_index_list(struct sock *sk, struct hci_dev *hdev, read_ext_index_list() argument
533 static bool is_configured(struct hci_dev *hdev) is_configured() argument
535 if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) && is_configured()
536 !hci_dev_test_flag(hdev, HCI_EXT_CONFIGURED)) is_configured()
539 if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) && is_configured()
540 !bacmp(&hdev->public_addr, BDADDR_ANY)) is_configured()
546 static __le32 get_missing_options(struct hci_dev *hdev) get_missing_options() argument
550 if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) && get_missing_options()
551 !hci_dev_test_flag(hdev, HCI_EXT_CONFIGURED)) get_missing_options()
554 if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) && get_missing_options()
555 !bacmp(&hdev->public_addr, BDADDR_ANY)) get_missing_options()
561 static int new_options(struct hci_dev *hdev, struct sock *skip) new_options() argument
563 __le32 options = get_missing_options(hdev); new_options()
565 return mgmt_generic_event(MGMT_EV_NEW_CONFIG_OPTIONS, hdev, &options, new_options()
569 static int send_options_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev) send_options_rsp() argument
571 __le32 options = get_missing_options(hdev); send_options_rsp()
573 return mgmt_cmd_complete(sk, hdev->id, opcode, 0, &options, send_options_rsp()
577 static int read_config_info(struct sock *sk, struct hci_dev *hdev, read_config_info() argument
583 BT_DBG("sock %p %s", sk, hdev->name); read_config_info()
585 hci_dev_lock(hdev); read_config_info()
588 rp.manufacturer = cpu_to_le16(hdev->manufacturer); read_config_info()
590 if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks)) read_config_info()
593 if (hdev->set_bdaddr) read_config_info()
597 rp.missing_options = get_missing_options(hdev); read_config_info()
599 hci_dev_unlock(hdev); read_config_info()
601 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_CONFIG_INFO, 0, read_config_info()
605 static u32 get_supported_settings(struct hci_dev *hdev) get_supported_settings() argument
615 if (lmp_bredr_capable(hdev)) { get_supported_settings()
616 if (hdev->hci_ver >= BLUETOOTH_VER_1_2) get_supported_settings()
621 if (lmp_ssp_capable(hdev)) { get_supported_settings()
626 if (lmp_sc_capable(hdev)) get_supported_settings()
630 if (lmp_le_capable(hdev)) { get_supported_settings()
638 if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || get_supported_settings()
639 hdev->set_bdaddr) get_supported_settings()
645 static u32 get_current_settings(struct hci_dev *hdev) get_current_settings() argument
649 if (hdev_is_powered(hdev)) get_current_settings()
652 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE)) get_current_settings()
655 if (hci_dev_test_flag(hdev, HCI_FAST_CONNECTABLE)) get_current_settings()
658 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) get_current_settings()
661 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) get_current_settings()
664 if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) get_current_settings()
667 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) get_current_settings()
670 if (hci_dev_test_flag(hdev, HCI_LINK_SECURITY)) get_current_settings()
673 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) get_current_settings()
676 if (hci_dev_test_flag(hdev, HCI_HS_ENABLED)) get_current_settings()
679 if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) get_current_settings()
682 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED)) get_current_settings()
685 if (hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS)) get_current_settings()
688 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) get_current_settings()
703 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || get_current_settings()
704 !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) || get_current_settings()
705 !bacmp(&hdev->bdaddr, BDADDR_ANY)) { get_current_settings()
706 if (bacmp(&hdev->static_addr, BDADDR_ANY)) get_current_settings()
715 static u8 *create_uuid16_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) create_uuid16_list() argument
723 list_for_each_entry(uuid, &hdev->uuids, list) { create_uuid16_list()
757 static u8 *create_uuid32_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) create_uuid32_list() argument
765 list_for_each_entry(uuid, &hdev->uuids, list) { create_uuid32_list()
790 static u8 *create_uuid128_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) create_uuid128_list() argument
798 list_for_each_entry(uuid, &hdev->uuids, list) { create_uuid128_list()
823 static struct mgmt_pending_cmd *pending_find(u16 opcode, struct hci_dev *hdev) pending_find() argument
825 return mgmt_pending_find(HCI_CHANNEL_CONTROL, opcode, hdev); pending_find()
829 struct hci_dev *hdev, pending_find_data()
832 return mgmt_pending_find_data(HCI_CHANNEL_CONTROL, opcode, hdev, data); pending_find_data()
835 static u8 create_default_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) create_default_scan_rsp_data() argument
840 name_len = strlen(hdev->dev_name); create_default_scan_rsp_data()
852 memcpy(ptr + 2, hdev->dev_name, name_len); create_default_scan_rsp_data()
861 static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) create_instance_scan_rsp_data() argument
866 memcpy(ptr, hdev->adv_instance.scan_rsp_data, create_instance_scan_rsp_data()
867 hdev->adv_instance.scan_rsp_len); create_instance_scan_rsp_data()
869 return hdev->adv_instance.scan_rsp_len; create_instance_scan_rsp_data()
875 struct hci_dev *hdev = req->hdev; update_scan_rsp_data_for_instance() local
879 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) update_scan_rsp_data_for_instance()
885 len = create_instance_scan_rsp_data(hdev, cp.data); update_scan_rsp_data_for_instance()
887 len = create_default_scan_rsp_data(hdev, cp.data); update_scan_rsp_data_for_instance()
889 if (hdev->scan_rsp_data_len == len && update_scan_rsp_data_for_instance()
890 !memcmp(cp.data, hdev->scan_rsp_data, len)) update_scan_rsp_data_for_instance()
893 memcpy(hdev->scan_rsp_data, cp.data, sizeof(cp.data)); update_scan_rsp_data_for_instance()
894 hdev->scan_rsp_data_len = len; update_scan_rsp_data_for_instance()
903 struct hci_dev *hdev = req->hdev; update_scan_rsp_data() local
911 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) && update_scan_rsp_data()
912 !hci_dev_test_flag(hdev, HCI_ADVERTISING)) update_scan_rsp_data()
920 static u8 get_adv_discov_flags(struct hci_dev *hdev) get_adv_discov_flags() argument
927 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); get_adv_discov_flags()
935 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) get_adv_discov_flags()
937 else if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) get_adv_discov_flags()
944 static u8 get_current_adv_instance(struct hci_dev *hdev) get_current_adv_instance() argument
951 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) && get_current_adv_instance()
952 !hci_dev_test_flag(hdev, HCI_ADVERTISING)) get_current_adv_instance()
958 static bool get_connectable(struct hci_dev *hdev) get_connectable() argument
965 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev); get_connectable()
972 return hci_dev_test_flag(hdev, HCI_CONNECTABLE); get_connectable()
975 static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance) get_adv_instance_flags() argument
983 return hdev->adv_instance.flags; get_adv_instance_flags()
991 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE)) get_adv_instance_flags()
997 static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) get_adv_instance_scan_rsp_len() argument
1006 return hdev->adv_instance.scan_rsp_len; get_adv_instance_scan_rsp_len()
1009 static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) create_instance_adv_data() argument
1012 u32 instance_flags = get_adv_instance_flags(hdev, instance); create_instance_adv_data()
1028 flags |= get_adv_discov_flags(hdev); create_instance_adv_data()
1030 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) create_instance_adv_data()
1047 memcpy(ptr, hdev->adv_instance.adv_data, create_instance_adv_data()
1048 hdev->adv_instance.adv_data_len); create_instance_adv_data()
1050 ad_len += hdev->adv_instance.adv_data_len; create_instance_adv_data()
1051 ptr += hdev->adv_instance.adv_data_len; create_instance_adv_data()
1055 if (hdev->adv_tx_power != HCI_TX_POWER_INVALID && create_instance_adv_data()
1059 ptr[2] = (u8)hdev->adv_tx_power; create_instance_adv_data()
1070 struct hci_dev *hdev = req->hdev; update_adv_data_for_instance() local
1074 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) update_adv_data_for_instance()
1079 len = create_instance_adv_data(hdev, instance, cp.data); update_adv_data_for_instance()
1082 if (hdev->adv_data_len == len && update_adv_data_for_instance()
1083 memcmp(cp.data, hdev->adv_data, len) == 0) update_adv_data_for_instance()
1086 memcpy(hdev->adv_data, cp.data, sizeof(cp.data)); update_adv_data_for_instance()
1087 hdev->adv_data_len = len; update_adv_data_for_instance()
1096 struct hci_dev *hdev = req->hdev; update_adv_data() local
1097 u8 instance = get_current_adv_instance(hdev); update_adv_data()
1102 int mgmt_update_adv_data(struct hci_dev *hdev) mgmt_update_adv_data() argument
1106 hci_req_init(&req, hdev); mgmt_update_adv_data()
1112 static void create_eir(struct hci_dev *hdev, u8 *data) create_eir() argument
1117 name_len = strlen(hdev->dev_name); create_eir()
1130 memcpy(ptr + 2, hdev->dev_name, name_len); create_eir()
1135 if (hdev->inq_tx_power != HCI_TX_POWER_INVALID) { create_eir()
1138 ptr[2] = (u8) hdev->inq_tx_power; create_eir()
1143 if (hdev->devid_source > 0) { create_eir()
1147 put_unaligned_le16(hdev->devid_source, ptr + 2); create_eir()
1148 put_unaligned_le16(hdev->devid_vendor, ptr + 4); create_eir()
1149 put_unaligned_le16(hdev->devid_product, ptr + 6); create_eir()
1150 put_unaligned_le16(hdev->devid_version, ptr + 8); create_eir()
1155 ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); create_eir()
1156 ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); create_eir()
1157 ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); create_eir()
1162 struct hci_dev *hdev = req->hdev; update_eir() local
1165 if (!hdev_is_powered(hdev)) update_eir()
1168 if (!lmp_ext_inq_capable(hdev)) update_eir()
1171 if (!hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) update_eir()
1174 if (hci_dev_test_flag(hdev, HCI_SERVICE_CACHE)) update_eir()
1179 create_eir(hdev, cp.data); update_eir()
1181 if (memcmp(cp.data, hdev->eir, sizeof(cp.data)) == 0) update_eir()
1184 memcpy(hdev->eir, cp.data, sizeof(cp.data)); update_eir()
1189 static u8 get_service_classes(struct hci_dev *hdev) get_service_classes() argument
1194 list_for_each_entry(uuid, &hdev->uuids, list) get_service_classes()
1202 struct hci_dev *hdev = req->hdev; update_class() local
1205 BT_DBG("%s", hdev->name); update_class()
1207 if (!hdev_is_powered(hdev)) update_class()
1210 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) update_class()
1213 if (hci_dev_test_flag(hdev, HCI_SERVICE_CACHE)) update_class()
1216 cod[0] = hdev->minor_class; update_class()
1217 cod[1] = hdev->major_class; update_class()
1218 cod[2] = get_service_classes(hdev); update_class()
1220 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) update_class()
1223 if (memcmp(cod, hdev->dev_class, 3) == 0) update_class()
1238 struct hci_dev *hdev = req->hdev; enable_advertising() local
1245 if (hci_conn_num(hdev, LE_LINK) > 0) enable_advertising()
1248 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) enable_advertising()
1256 hci_dev_clear_flag(hdev, HCI_LE_ADV); enable_advertising()
1258 instance = get_current_adv_instance(hdev); enable_advertising()
1259 flags = get_adv_instance_flags(hdev, instance); enable_advertising()
1265 get_connectable(hdev); enable_advertising()
1275 cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); enable_advertising()
1276 cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); enable_advertising()
1280 else if (get_adv_instance_scan_rsp_len(hdev, instance)) enable_advertising()
1286 cp.channel_map = hdev->le_adv_channel_map; enable_advertising()
1295 struct hci_dev *hdev = container_of(work, struct hci_dev, service_cache_off() local
1299 if (!hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE)) service_cache_off()
1302 hci_req_init(&req, hdev); service_cache_off()
1304 hci_dev_lock(hdev); service_cache_off()
1309 hci_dev_unlock(hdev); service_cache_off()
1316 struct hci_dev *hdev = container_of(work, struct hci_dev, rpa_expired() local
1322 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); rpa_expired()
1324 if (!hci_dev_test_flag(hdev, HCI_ADVERTISING)) rpa_expired()
1330 hci_req_init(&req, hdev); rpa_expired()
1335 static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev) mgmt_init_hdev() argument
1337 if (hci_dev_test_and_set_flag(hdev, HCI_MGMT)) mgmt_init_hdev()
1340 INIT_DELAYED_WORK(&hdev->service_cache, service_cache_off); mgmt_init_hdev()
1341 INIT_DELAYED_WORK(&hdev->rpa_expired, rpa_expired); mgmt_init_hdev()
1348 hci_dev_clear_flag(hdev, HCI_BONDABLE); mgmt_init_hdev()
1351 static int read_controller_info(struct sock *sk, struct hci_dev *hdev, read_controller_info() argument
1356 BT_DBG("sock %p %s", sk, hdev->name); read_controller_info()
1358 hci_dev_lock(hdev); read_controller_info()
1362 bacpy(&rp.bdaddr, &hdev->bdaddr); read_controller_info()
1364 rp.version = hdev->hci_ver; read_controller_info()
1365 rp.manufacturer = cpu_to_le16(hdev->manufacturer); read_controller_info()
1367 rp.supported_settings = cpu_to_le32(get_supported_settings(hdev)); read_controller_info()
1368 rp.current_settings = cpu_to_le32(get_current_settings(hdev)); read_controller_info()
1370 memcpy(rp.dev_class, hdev->dev_class, 3); read_controller_info()
1372 memcpy(rp.name, hdev->dev_name, sizeof(hdev->dev_name)); read_controller_info()
1373 memcpy(rp.short_name, hdev->short_name, sizeof(hdev->short_name)); read_controller_info()
1375 hci_dev_unlock(hdev); read_controller_info()
1377 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_INFO, 0, &rp, read_controller_info()
1381 static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev) send_settings_rsp() argument
1383 __le32 settings = cpu_to_le32(get_current_settings(hdev)); send_settings_rsp()
1385 return mgmt_cmd_complete(sk, hdev->id, opcode, 0, &settings, send_settings_rsp()
1389 static void clean_up_hci_complete(struct hci_dev *hdev, u8 status, u16 opcode) clean_up_hci_complete() argument
1391 BT_DBG("%s status 0x%02x", hdev->name, status); clean_up_hci_complete()
1393 if (hci_conn_count(hdev) == 0) { clean_up_hci_complete()
1394 cancel_delayed_work(&hdev->power_off); clean_up_hci_complete()
1395 queue_work(hdev->req_workqueue, &hdev->power_off.work); clean_up_hci_complete()
1401 struct hci_dev *hdev = req->hdev; hci_stop_discovery() local
1405 switch (hdev->discovery.state) { hci_stop_discovery()
1407 if (test_bit(HCI_INQUIRY, &hdev->flags)) hci_stop_discovery()
1410 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { hci_stop_discovery()
1411 cancel_delayed_work(&hdev->le_scan_disable); hci_stop_discovery()
1418 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, hci_stop_discovery()
1431 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { hci_stop_discovery()
1442 static void advertising_added(struct sock *sk, struct hci_dev *hdev, advertising_added() argument
1449 mgmt_event(MGMT_EV_ADVERTISING_ADDED, hdev, &ev, sizeof(ev), sk); advertising_added()
1452 static void advertising_removed(struct sock *sk, struct hci_dev *hdev, advertising_removed() argument
1459 mgmt_event(MGMT_EV_ADVERTISING_REMOVED, hdev, &ev, sizeof(ev), sk); advertising_removed()
1462 static void clear_adv_instance(struct hci_dev *hdev) clear_adv_instance() argument
1466 if (!hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) clear_adv_instance()
1469 if (hdev->adv_instance.timeout) clear_adv_instance()
1470 cancel_delayed_work(&hdev->adv_instance.timeout_exp); clear_adv_instance()
1472 memset(&hdev->adv_instance, 0, sizeof(hdev->adv_instance)); clear_adv_instance()
1473 advertising_removed(NULL, hdev, 1); clear_adv_instance()
1474 hci_dev_clear_flag(hdev, HCI_ADVERTISING_INSTANCE); clear_adv_instance()
1476 if (!hdev_is_powered(hdev) || clear_adv_instance()
1477 hci_dev_test_flag(hdev, HCI_ADVERTISING)) clear_adv_instance()
1480 hci_req_init(&req, hdev); clear_adv_instance()
1485 static int clean_up_hci_state(struct hci_dev *hdev) clean_up_hci_state() argument
1492 hci_req_init(&req, hdev); clean_up_hci_state()
1494 if (test_bit(HCI_ISCAN, &hdev->flags) || clean_up_hci_state()
1495 test_bit(HCI_PSCAN, &hdev->flags)) { clean_up_hci_state()
1500 if (hdev->adv_instance.timeout) clean_up_hci_state()
1501 clear_adv_instance(hdev); clean_up_hci_state()
1503 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) clean_up_hci_state()
1508 list_for_each_entry(conn, &hdev->conn_hash.list, list) { clean_up_hci_state()
1542 hci_discovery_set_state(hdev, DISCOVERY_STOPPING); clean_up_hci_state()
1547 static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data, set_powered() argument
1554 BT_DBG("request for %s", hdev->name); set_powered()
1557 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED, set_powered()
1560 hci_dev_lock(hdev); set_powered()
1562 if (pending_find(MGMT_OP_SET_POWERED, hdev)) { set_powered()
1563 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED, set_powered()
1568 if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) { set_powered()
1569 cancel_delayed_work(&hdev->power_off); set_powered()
1572 mgmt_pending_add(sk, MGMT_OP_SET_POWERED, hdev, set_powered()
1574 err = mgmt_powered(hdev, 1); set_powered()
1579 if (!!cp->val == hdev_is_powered(hdev)) { set_powered()
1580 err = send_settings_rsp(sk, MGMT_OP_SET_POWERED, hdev); set_powered()
1584 cmd = mgmt_pending_add(sk, MGMT_OP_SET_POWERED, hdev, data, len); set_powered()
1591 queue_work(hdev->req_workqueue, &hdev->power_on); set_powered()
1595 err = clean_up_hci_state(hdev); set_powered()
1597 queue_delayed_work(hdev->req_workqueue, &hdev->power_off, set_powered()
1602 cancel_delayed_work(&hdev->power_off); set_powered()
1603 queue_work(hdev->req_workqueue, &hdev->power_off.work); set_powered()
1609 hci_dev_unlock(hdev); set_powered()
1613 static int new_settings(struct hci_dev *hdev, struct sock *skip) new_settings() argument
1615 __le32 ev = cpu_to_le32(get_current_settings(hdev)); new_settings()
1617 return mgmt_generic_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, new_settings()
1621 int mgmt_new_settings(struct hci_dev *hdev) mgmt_new_settings() argument
1623 return new_settings(hdev, NULL); mgmt_new_settings()
1628 struct hci_dev *hdev; member in struct:cmd_lookup
1636 send_settings_rsp(cmd->sk, cmd->opcode, match->hdev); settings_rsp()
1682 static u8 mgmt_bredr_support(struct hci_dev *hdev) mgmt_bredr_support() argument
1684 if (!lmp_bredr_capable(hdev)) mgmt_bredr_support()
1686 else if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) mgmt_bredr_support()
1692 static u8 mgmt_le_support(struct hci_dev *hdev) mgmt_le_support() argument
1694 if (!lmp_le_capable(hdev)) mgmt_le_support()
1696 else if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) mgmt_le_support()
1702 static void set_discoverable_complete(struct hci_dev *hdev, u8 status, set_discoverable_complete() argument
1712 hci_dev_lock(hdev); set_discoverable_complete()
1714 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable_complete()
1721 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); set_discoverable_complete()
1727 changed = !hci_dev_test_and_set_flag(hdev, HCI_DISCOVERABLE); set_discoverable_complete()
1729 if (hdev->discov_timeout > 0) { set_discoverable_complete()
1730 int to = msecs_to_jiffies(hdev->discov_timeout * 1000); set_discoverable_complete()
1731 queue_delayed_work(hdev->workqueue, &hdev->discov_off, set_discoverable_complete()
1735 changed = hci_dev_test_and_clear_flag(hdev, HCI_DISCOVERABLE); set_discoverable_complete()
1738 send_settings_rsp(cmd->sk, MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable_complete()
1741 new_settings(hdev, cmd->sk); set_discoverable_complete()
1748 hci_req_init(&req, hdev); set_discoverable_complete()
1757 hci_dev_unlock(hdev); set_discoverable_complete()
1760 static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, set_discoverable() argument
1770 BT_DBG("request for %s", hdev->name); set_discoverable()
1772 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED) && set_discoverable()
1773 !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) set_discoverable()
1774 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1778 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1788 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1791 hci_dev_lock(hdev); set_discoverable()
1793 if (!hdev_is_powered(hdev) && timeout > 0) { set_discoverable()
1794 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1799 if (pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || set_discoverable()
1800 pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { set_discoverable()
1801 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1806 if (!hci_dev_test_flag(hdev, HCI_CONNECTABLE)) { set_discoverable()
1807 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, set_discoverable()
1812 if (!hdev_is_powered(hdev)) { set_discoverable()
1819 if (!!cp->val != hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) { set_discoverable()
1820 hci_dev_change_flag(hdev, HCI_DISCOVERABLE); set_discoverable()
1824 err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable()
1829 err = new_settings(hdev, sk); set_discoverable()
1838 if (!!cp->val == hci_dev_test_flag(hdev, HCI_DISCOVERABLE) && set_discoverable()
1839 (cp->val == 0x02) == hci_dev_test_flag(hdev, set_discoverable()
1841 cancel_delayed_work(&hdev->discov_off); set_discoverable()
1842 hdev->discov_timeout = timeout; set_discoverable()
1844 if (cp->val && hdev->discov_timeout > 0) { set_discoverable()
1845 int to = msecs_to_jiffies(hdev->discov_timeout * 1000); set_discoverable()
1846 queue_delayed_work(hdev->workqueue, &hdev->discov_off, set_discoverable()
1850 err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev); set_discoverable()
1854 cmd = mgmt_pending_add(sk, MGMT_OP_SET_DISCOVERABLE, hdev, data, len); set_discoverable()
1864 cancel_delayed_work(&hdev->discov_off); set_discoverable()
1865 hdev->discov_timeout = timeout; set_discoverable()
1869 hci_dev_set_flag(hdev, HCI_LIMITED_DISCOVERABLE); set_discoverable()
1871 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); set_discoverable()
1873 hci_req_init(&req, hdev); set_discoverable()
1878 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) set_discoverable()
1888 hci_cp.num_iac = min_t(u8, hdev->num_iac, 2); set_discoverable()
1908 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); set_discoverable()
1921 hci_dev_unlock(hdev); set_discoverable()
1927 struct hci_dev *hdev = req->hdev; write_fast_connectable() local
1931 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) write_fast_connectable()
1934 if (hdev->hci_ver < BLUETOOTH_VER_1_2) write_fast_connectable()
1951 if (__cpu_to_le16(hdev->page_scan_interval) != acp.interval || write_fast_connectable()
1952 __cpu_to_le16(hdev->page_scan_window) != acp.window) write_fast_connectable()
1956 if (hdev->page_scan_type != type) write_fast_connectable()
1960 static void set_connectable_complete(struct hci_dev *hdev, u8 status, set_connectable_complete() argument
1969 hci_dev_lock(hdev); set_connectable_complete()
1971 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev); set_connectable_complete()
1983 conn_changed = !hci_dev_test_and_set_flag(hdev, set_connectable_complete()
1987 conn_changed = hci_dev_test_and_clear_flag(hdev, set_connectable_complete()
1989 discov_changed = hci_dev_test_and_clear_flag(hdev, set_connectable_complete()
1993 send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev); set_connectable_complete()
1996 new_settings(hdev, cmd->sk); set_connectable_complete()
1997 hci_update_page_scan(hdev); set_connectable_complete()
1999 mgmt_update_adv_data(hdev); set_connectable_complete()
2000 hci_update_background_scan(hdev); set_connectable_complete()
2007 hci_dev_unlock(hdev); set_connectable_complete()
2010 static int set_connectable_update_settings(struct hci_dev *hdev, set_connectable_update_settings() argument
2016 if (!!val != hci_dev_test_flag(hdev, HCI_CONNECTABLE)) set_connectable_update_settings()
2020 hci_dev_set_flag(hdev, HCI_CONNECTABLE); set_connectable_update_settings()
2022 hci_dev_clear_flag(hdev, HCI_CONNECTABLE); set_connectable_update_settings()
2023 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); set_connectable_update_settings()
2026 err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev); set_connectable_update_settings()
2031 hci_update_page_scan(hdev); set_connectable_update_settings()
2032 hci_update_background_scan(hdev); set_connectable_update_settings()
2033 return new_settings(hdev, sk); set_connectable_update_settings()
2039 static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data, set_connectable() argument
2048 BT_DBG("request for %s", hdev->name); set_connectable()
2050 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED) && set_connectable()
2051 !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) set_connectable()
2052 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, set_connectable()
2056 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, set_connectable()
2059 hci_dev_lock(hdev); set_connectable()
2061 if (!hdev_is_powered(hdev)) { set_connectable()
2062 err = set_connectable_update_settings(hdev, sk, cp->val); set_connectable()
2066 if (pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || set_connectable()
2067 pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { set_connectable()
2068 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, set_connectable()
2073 cmd = mgmt_pending_add(sk, MGMT_OP_SET_CONNECTABLE, hdev, data, len); set_connectable()
2079 hci_req_init(&req, hdev); set_connectable()
2085 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { set_connectable()
2087 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); set_connectable()
2088 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); set_connectable()
2091 } else if (cp->val != test_bit(HCI_PSCAN, &hdev->flags)) { set_connectable()
2101 if (list_empty(&hdev->whitelist)) set_connectable()
2103 else if (test_bit(HCI_ISCAN, &hdev->flags)) set_connectable()
2108 if (test_bit(HCI_ISCAN, &hdev->flags) && set_connectable()
2109 hdev->discov_timeout > 0) set_connectable()
2110 cancel_delayed_work(&hdev->discov_off); set_connectable()
2118 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || set_connectable()
2119 hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) set_connectable()
2126 err = set_connectable_update_settings(hdev, sk, set_connectable()
2132 hci_dev_unlock(hdev); set_connectable()
2136 static int set_bondable(struct sock *sk, struct hci_dev *hdev, void *data, set_bondable() argument
2143 BT_DBG("request for %s", hdev->name); set_bondable()
2146 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BONDABLE, set_bondable()
2149 hci_dev_lock(hdev); set_bondable()
2152 changed = !hci_dev_test_and_set_flag(hdev, HCI_BONDABLE); set_bondable()
2154 changed = hci_dev_test_and_clear_flag(hdev, HCI_BONDABLE); set_bondable()
2156 err = send_settings_rsp(sk, MGMT_OP_SET_BONDABLE, hdev); set_bondable()
2161 err = new_settings(hdev, sk); set_bondable()
2164 hci_dev_unlock(hdev); set_bondable()
2168 static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data, set_link_security() argument
2176 BT_DBG("request for %s", hdev->name); set_link_security()
2178 status = mgmt_bredr_support(hdev); set_link_security()
2180 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, set_link_security()
2184 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, set_link_security()
2187 hci_dev_lock(hdev); set_link_security()
2189 if (!hdev_is_powered(hdev)) { set_link_security()
2192 if (!!cp->val != hci_dev_test_flag(hdev, HCI_LINK_SECURITY)) { set_link_security()
2193 hci_dev_change_flag(hdev, HCI_LINK_SECURITY); set_link_security()
2197 err = send_settings_rsp(sk, MGMT_OP_SET_LINK_SECURITY, hdev); set_link_security()
2202 err = new_settings(hdev, sk); set_link_security()
2207 if (pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) { set_link_security()
2208 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, set_link_security()
2215 if (test_bit(HCI_AUTH, &hdev->flags) == val) { set_link_security()
2216 err = send_settings_rsp(sk, MGMT_OP_SET_LINK_SECURITY, hdev); set_link_security()
2220 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LINK_SECURITY, hdev, data, len); set_link_security()
2226 err = hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, sizeof(val), &val); set_link_security()
2233 hci_dev_unlock(hdev); set_link_security()
2237 static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) set_ssp() argument
2244 BT_DBG("request for %s", hdev->name); set_ssp()
2246 status = mgmt_bredr_support(hdev); set_ssp()
2248 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, status); set_ssp()
2250 if (!lmp_ssp_capable(hdev)) set_ssp()
2251 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, set_ssp()
2255 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, set_ssp()
2258 hci_dev_lock(hdev); set_ssp()
2260 if (!hdev_is_powered(hdev)) { set_ssp()
2264 changed = !hci_dev_test_and_set_flag(hdev, set_ssp()
2267 changed = hci_dev_test_and_clear_flag(hdev, set_ssp()
2270 changed = hci_dev_test_and_clear_flag(hdev, set_ssp()
2273 hci_dev_clear_flag(hdev, HCI_HS_ENABLED); set_ssp()
2276 err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev); set_ssp()
2281 err = new_settings(hdev, sk); set_ssp()
2286 if (pending_find(MGMT_OP_SET_SSP, hdev)) { set_ssp()
2287 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, set_ssp()
2292 if (!!cp->val == hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { set_ssp()
2293 err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev); set_ssp()
2297 cmd = mgmt_pending_add(sk, MGMT_OP_SET_SSP, hdev, data, len); set_ssp()
2303 if (!cp->val && hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) set_ssp()
2304 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE, set_ssp()
2307 err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &cp->val); set_ssp()
2314 hci_dev_unlock(hdev); set_ssp()
2318 static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) set_hs() argument
2325 BT_DBG("request for %s", hdev->name); set_hs()
2327 status = mgmt_bredr_support(hdev); set_hs()
2329 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, status); set_hs()
2331 if (!lmp_ssp_capable(hdev)) set_hs()
2332 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, set_hs()
2335 if (!hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) set_hs()
2336 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, set_hs()
2340 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, set_hs()
2343 hci_dev_lock(hdev); set_hs()
2345 if (pending_find(MGMT_OP_SET_SSP, hdev)) { set_hs()
2346 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, set_hs()
2352 changed = !hci_dev_test_and_set_flag(hdev, HCI_HS_ENABLED); set_hs()
2354 if (hdev_is_powered(hdev)) { set_hs()
2355 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, set_hs()
2360 changed = hci_dev_test_and_clear_flag(hdev, HCI_HS_ENABLED); set_hs()
2363 err = send_settings_rsp(sk, MGMT_OP_SET_HS, hdev); set_hs()
2368 err = new_settings(hdev, sk); set_hs()
2371 hci_dev_unlock(hdev); set_hs()
2375 static void le_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) le_enable_complete() argument
2377 struct cmd_lookup match = { NULL, hdev }; le_enable_complete()
2379 hci_dev_lock(hdev); le_enable_complete()
2384 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, cmd_status_rsp, le_enable_complete()
2389 mgmt_pending_foreach(MGMT_OP_SET_LE, hdev, settings_rsp, &match); le_enable_complete()
2391 new_settings(hdev, match.sk); le_enable_complete()
2401 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { le_enable_complete()
2404 hci_req_init(&req, hdev); le_enable_complete()
2412 hci_dev_unlock(hdev); le_enable_complete()
2415 static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) set_le() argument
2424 BT_DBG("request for %s", hdev->name); set_le()
2426 if (!lmp_le_capable(hdev)) set_le()
2427 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, set_le()
2431 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, set_le()
2443 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { set_le()
2445 return send_settings_rsp(sk, MGMT_OP_SET_LE, hdev); set_le()
2447 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, set_le()
2451 hci_dev_lock(hdev); set_le()
2454 enabled = lmp_host_le_capable(hdev); set_le()
2456 if (!hdev_is_powered(hdev) || val == enabled) { set_le()
2459 if (val != hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { set_le()
2460 hci_dev_change_flag(hdev, HCI_LE_ENABLED); set_le()
2464 if (!val && hci_dev_test_flag(hdev, HCI_ADVERTISING)) { set_le()
2465 hci_dev_clear_flag(hdev, HCI_ADVERTISING); set_le()
2469 err = send_settings_rsp(sk, MGMT_OP_SET_LE, hdev); set_le()
2474 err = new_settings(hdev, sk); set_le()
2479 if (pending_find(MGMT_OP_SET_LE, hdev) || set_le()
2480 pending_find(MGMT_OP_SET_ADVERTISING, hdev)) { set_le()
2481 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, set_le()
2486 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LE, hdev, data, len); set_le()
2492 hci_req_init(&req, hdev); set_le()
2500 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) set_le()
2512 hci_dev_unlock(hdev); set_le()
2522 static bool pending_eir_or_class(struct hci_dev *hdev) pending_eir_or_class() argument
2526 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { pending_eir_or_class()
2558 static void mgmt_class_complete(struct hci_dev *hdev, u16 mgmt_op, u8 status) mgmt_class_complete() argument
2562 hci_dev_lock(hdev); mgmt_class_complete()
2564 cmd = pending_find(mgmt_op, hdev); mgmt_class_complete()
2569 mgmt_status(status), hdev->dev_class, 3); mgmt_class_complete()
2574 hci_dev_unlock(hdev); mgmt_class_complete()
2577 static void add_uuid_complete(struct hci_dev *hdev, u8 status, u16 opcode) add_uuid_complete() argument
2581 mgmt_class_complete(hdev, MGMT_OP_ADD_UUID, status); add_uuid_complete()
2584 static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) add_uuid() argument
2592 BT_DBG("request for %s", hdev->name); add_uuid()
2594 hci_dev_lock(hdev); add_uuid()
2596 if (pending_eir_or_class(hdev)) { add_uuid()
2597 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_UUID, add_uuid()
2612 list_add_tail(&uuid->list, &hdev->uuids); add_uuid()
2614 hci_req_init(&req, hdev); add_uuid()
2624 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_UUID, 0, add_uuid()
2625 hdev->dev_class, 3); add_uuid()
2629 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_UUID, hdev, data, len); add_uuid()
2638 hci_dev_unlock(hdev); add_uuid()
2642 static bool enable_service_cache(struct hci_dev *hdev) enable_service_cache() argument
2644 if (!hdev_is_powered(hdev)) enable_service_cache()
2647 if (!hci_dev_test_and_set_flag(hdev, HCI_SERVICE_CACHE)) { enable_service_cache()
2648 queue_delayed_work(hdev->workqueue, &hdev->service_cache, enable_service_cache()
2656 static void remove_uuid_complete(struct hci_dev *hdev, u8 status, u16 opcode) remove_uuid_complete() argument
2660 mgmt_class_complete(hdev, MGMT_OP_REMOVE_UUID, status); remove_uuid_complete()
2663 static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data, remove_uuid() argument
2673 BT_DBG("request for %s", hdev->name); remove_uuid()
2675 hci_dev_lock(hdev); remove_uuid()
2677 if (pending_eir_or_class(hdev)) { remove_uuid()
2678 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID, remove_uuid()
2684 hci_uuids_clear(hdev); remove_uuid()
2686 if (enable_service_cache(hdev)) { remove_uuid()
2687 err = mgmt_cmd_complete(sk, hdev->id, remove_uuid()
2689 0, hdev->dev_class, 3); remove_uuid()
2698 list_for_each_entry_safe(match, tmp, &hdev->uuids, list) { remove_uuid()
2708 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID, remove_uuid()
2714 hci_req_init(&req, hdev); remove_uuid()
2724 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_UUID, 0, remove_uuid()
2725 hdev->dev_class, 3); remove_uuid()
2729 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_UUID, hdev, data, len); remove_uuid()
2738 hci_dev_unlock(hdev); remove_uuid()
2742 static void set_class_complete(struct hci_dev *hdev, u8 status, u16 opcode) set_class_complete() argument
2746 mgmt_class_complete(hdev, MGMT_OP_SET_DEV_CLASS, status); set_class_complete()
2749 static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data, set_dev_class() argument
2757 BT_DBG("request for %s", hdev->name); set_dev_class()
2759 if (!lmp_bredr_capable(hdev)) set_dev_class()
2760 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, set_dev_class()
2763 hci_dev_lock(hdev); set_dev_class()
2765 if (pending_eir_or_class(hdev)) { set_dev_class()
2766 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, set_dev_class()
2772 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, set_dev_class()
2777 hdev->major_class = cp->major; set_dev_class()
2778 hdev->minor_class = cp->minor; set_dev_class()
2780 if (!hdev_is_powered(hdev)) { set_dev_class()
2781 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, 0, set_dev_class()
2782 hdev->dev_class, 3); set_dev_class()
2786 hci_req_init(&req, hdev); set_dev_class()
2788 if (hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE)) { set_dev_class()
2789 hci_dev_unlock(hdev); set_dev_class()
2790 cancel_delayed_work_sync(&hdev->service_cache); set_dev_class()
2791 hci_dev_lock(hdev); set_dev_class()
2802 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, 0, set_dev_class()
2803 hdev->dev_class, 3); set_dev_class()
2807 cmd = mgmt_pending_add(sk, MGMT_OP_SET_DEV_CLASS, hdev, data, len); set_dev_class()
2816 hci_dev_unlock(hdev); set_dev_class()
2820 static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data, load_link_keys() argument
2830 BT_DBG("request for %s", hdev->name); load_link_keys()
2832 if (!lmp_bredr_capable(hdev)) load_link_keys()
2833 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, load_link_keys()
2840 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, load_link_keys()
2849 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, load_link_keys()
2854 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, load_link_keys()
2857 BT_DBG("%s debug_keys %u key_count %u", hdev->name, cp->debug_keys, load_link_keys()
2864 return mgmt_cmd_status(sk, hdev->id, load_link_keys()
2869 hci_dev_lock(hdev); load_link_keys()
2871 hci_link_keys_clear(hdev); load_link_keys()
2874 changed = !hci_dev_test_and_set_flag(hdev, HCI_KEEP_DEBUG_KEYS); load_link_keys()
2876 changed = hci_dev_test_and_clear_flag(hdev, load_link_keys()
2880 new_settings(hdev, NULL); load_link_keys()
2891 hci_add_link_key(hdev, NULL, &key->addr.bdaddr, key->val, load_link_keys()
2895 mgmt_cmd_complete(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 0, NULL, 0); load_link_keys()
2897 hci_dev_unlock(hdev); load_link_keys()
2902 static int device_unpaired(struct hci_dev *hdev, bdaddr_t *bdaddr, device_unpaired() argument
2910 return mgmt_event(MGMT_EV_DEVICE_UNPAIRED, hdev, &ev, sizeof(ev), device_unpaired()
2914 static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, unpair_device() argument
2929 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, unpair_device()
2934 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, unpair_device()
2938 hci_dev_lock(hdev); unpair_device()
2940 if (!hdev_is_powered(hdev)) { unpair_device()
2941 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, unpair_device()
2956 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, unpair_device()
2961 err = hci_remove_link_key(hdev, &cp->addr.bdaddr); unpair_device()
2970 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, unpair_device()
2986 hci_conn_params_del(hdev, &cp->addr.bdaddr, addr_type); unpair_device()
2989 hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type); unpair_device()
2991 err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type); unpair_device()
2995 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, unpair_device()
3005 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, 0, unpair_device()
3007 device_unpaired(hdev, &cp->addr.bdaddr, cp->addr.type, sk); unpair_device()
3011 cmd = mgmt_pending_add(sk, MGMT_OP_UNPAIR_DEVICE, hdev, cp, unpair_device()
3022 err = hci_send_cmd(hdev, HCI_OP_DISCONNECT, sizeof(dc), &dc); unpair_device()
3027 hci_dev_unlock(hdev); unpair_device()
3031 static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data, disconnect() argument
3047 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, disconnect()
3051 hci_dev_lock(hdev); disconnect()
3053 if (!test_bit(HCI_UP, &hdev->flags)) { disconnect()
3054 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, disconnect()
3060 if (pending_find(MGMT_OP_DISCONNECT, hdev)) { disconnect()
3061 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, disconnect()
3067 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, disconnect()
3070 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); disconnect()
3073 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, disconnect()
3079 cmd = mgmt_pending_add(sk, MGMT_OP_DISCONNECT, hdev, data, len); disconnect()
3092 hci_dev_unlock(hdev); disconnect()
3115 static int get_connections(struct sock *sk, struct hci_dev *hdev, void *data, get_connections() argument
3126 hci_dev_lock(hdev); get_connections()
3128 if (!hdev_is_powered(hdev)) { get_connections()
3129 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_GET_CONNECTIONS, get_connections()
3135 list_for_each_entry(c, &hdev->conn_hash.list, list) { get_connections()
3148 list_for_each_entry(c, &hdev->conn_hash.list, list) { get_connections()
3163 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONNECTIONS, 0, rp, get_connections()
3169 hci_dev_unlock(hdev); get_connections()
3173 static int send_pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev, send_pin_code_neg_reply() argument
3179 cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_NEG_REPLY, hdev, cp, send_pin_code_neg_reply()
3184 err = hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, send_pin_code_neg_reply()
3192 static int pin_code_reply(struct sock *sk, struct hci_dev *hdev, void *data, pin_code_reply() argument
3203 hci_dev_lock(hdev); pin_code_reply()
3205 if (!hdev_is_powered(hdev)) { pin_code_reply()
3206 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, pin_code_reply()
3211 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr); pin_code_reply()
3213 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, pin_code_reply()
3225 err = send_pin_code_neg_reply(sk, hdev, &ncp); pin_code_reply()
3227 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, pin_code_reply()
3233 cmd = mgmt_pending_add(sk, MGMT_OP_PIN_CODE_REPLY, hdev, data, len); pin_code_reply()
3245 err = hci_send_cmd(hdev, HCI_OP_PIN_CODE_REPLY, sizeof(reply), &reply); pin_code_reply()
3250 hci_dev_unlock(hdev); pin_code_reply()
3254 static int set_io_capability(struct sock *sk, struct hci_dev *hdev, void *data, set_io_capability() argument
3262 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_IO_CAPABILITY, set_io_capability()
3265 hci_dev_lock(hdev); set_io_capability()
3267 hdev->io_capability = cp->io_capability; set_io_capability()
3269 BT_DBG("%s IO capability set to 0x%02x", hdev->name, set_io_capability()
3270 hdev->io_capability); set_io_capability()
3272 hci_dev_unlock(hdev); set_io_capability()
3274 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_IO_CAPABILITY, 0, set_io_capability()
3280 struct hci_dev *hdev = conn->hdev; find_pairing() local
3283 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { find_pairing()
3372 static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, pair_device() argument
3389 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3394 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3398 hci_dev_lock(hdev); pair_device()
3400 if (!hdev_is_powered(hdev)) { pair_device()
3401 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3407 if (hci_bdaddr_is_paired(hdev, &cp->addr.bdaddr, cp->addr.type)) { pair_device()
3408 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3418 conn = hci_connect_acl(hdev, &cp->addr.bdaddr, sec_level, pair_device()
3439 hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type); pair_device()
3441 conn = hci_connect_le(hdev, &cp->addr.bdaddr, addr_type, pair_device()
3458 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3465 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE, pair_device()
3470 cmd = mgmt_pending_add(sk, MGMT_OP_PAIR_DEVICE, hdev, data, len); pair_device()
3502 hci_dev_unlock(hdev); pair_device()
3506 static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data, cancel_pair_device() argument
3516 hci_dev_lock(hdev); cancel_pair_device()
3518 if (!hdev_is_powered(hdev)) { cancel_pair_device()
3519 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, cancel_pair_device()
3524 cmd = pending_find(MGMT_OP_PAIR_DEVICE, hdev); cancel_pair_device()
3526 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, cancel_pair_device()
3534 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, cancel_pair_device()
3542 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 0, cancel_pair_device()
3545 hci_dev_unlock(hdev); cancel_pair_device()
3549 static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, user_pairing_resp() argument
3557 hci_dev_lock(hdev); user_pairing_resp()
3559 if (!hdev_is_powered(hdev)) { user_pairing_resp()
3560 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op, user_pairing_resp()
3567 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &addr->bdaddr); user_pairing_resp()
3569 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &addr->bdaddr); user_pairing_resp()
3572 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op, user_pairing_resp()
3581 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op, user_pairing_resp()
3585 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op, user_pairing_resp()
3592 cmd = mgmt_pending_add(sk, mgmt_op, hdev, addr, sizeof(*addr)); user_pairing_resp()
3606 err = hci_send_cmd(hdev, hci_op, sizeof(cp), &cp); user_pairing_resp()
3608 err = hci_send_cmd(hdev, hci_op, sizeof(addr->bdaddr), user_pairing_resp()
3615 hci_dev_unlock(hdev); user_pairing_resp()
3619 static int pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev, pin_code_neg_reply() argument
3626 return user_pairing_resp(sk, hdev, &cp->addr, pin_code_neg_reply()
3631 static int user_confirm_reply(struct sock *sk, struct hci_dev *hdev, void *data, user_confirm_reply() argument
3639 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_USER_CONFIRM_REPLY, user_confirm_reply()
3642 return user_pairing_resp(sk, hdev, &cp->addr, user_confirm_reply()
3647 static int user_confirm_neg_reply(struct sock *sk, struct hci_dev *hdev, user_confirm_neg_reply() argument
3654 return user_pairing_resp(sk, hdev, &cp->addr, user_confirm_neg_reply()
3659 static int user_passkey_reply(struct sock *sk, struct hci_dev *hdev, void *data, user_passkey_reply() argument
3666 return user_pairing_resp(sk, hdev, &cp->addr, user_passkey_reply()
3671 static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, user_passkey_neg_reply() argument
3678 return user_pairing_resp(sk, hdev, &cp->addr, user_passkey_neg_reply()
3685 struct hci_dev *hdev = req->hdev; update_name() local
3688 memcpy(cp.name, hdev->dev_name, sizeof(cp.name)); update_name()
3693 static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode) set_name_complete() argument
3700 hci_dev_lock(hdev); set_name_complete()
3702 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); set_name_complete()
3709 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, set_name_complete()
3712 mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0, set_name_complete()
3718 hci_dev_unlock(hdev); set_name_complete()
3721 static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data, set_local_name() argument
3731 hci_dev_lock(hdev); set_local_name()
3736 if (!memcmp(hdev->dev_name, cp->name, sizeof(hdev->dev_name)) && set_local_name()
3737 !memcmp(hdev->short_name, cp->short_name, set_local_name()
3738 sizeof(hdev->short_name))) { set_local_name()
3739 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0, set_local_name()
3744 memcpy(hdev->short_name, cp->short_name, sizeof(hdev->short_name)); set_local_name()
3746 if (!hdev_is_powered(hdev)) { set_local_name()
3747 memcpy(hdev->dev_name, cp->name, sizeof(hdev->dev_name)); set_local_name()
3749 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0, set_local_name()
3754 err = mgmt_generic_event(MGMT_EV_LOCAL_NAME_CHANGED, hdev, set_local_name()
3760 cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, hdev, data, len); set_local_name()
3766 memcpy(hdev->dev_name, cp->name, sizeof(hdev->dev_name)); set_local_name()
3768 hci_req_init(&req, hdev); set_local_name()
3770 if (lmp_bredr_capable(hdev)) { set_local_name()
3778 if (lmp_le_capable(hdev)) set_local_name()
3786 hci_dev_unlock(hdev); set_local_name()
3790 static void read_local_oob_data_complete(struct hci_dev *hdev, u8 status, read_local_oob_data_complete() argument
3797 BT_DBG("%s status %u", hdev->name, status); read_local_oob_data_complete()
3799 cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev); read_local_oob_data_complete()
3804 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data_complete()
3815 mgmt_cmd_status(cmd->sk, hdev->id, read_local_oob_data_complete()
3829 mgmt_cmd_status(cmd->sk, hdev->id, read_local_oob_data_complete()
3842 mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data_complete()
3849 static int read_local_oob_data(struct sock *sk, struct hci_dev *hdev, read_local_oob_data() argument
3856 BT_DBG("%s", hdev->name); read_local_oob_data()
3858 hci_dev_lock(hdev); read_local_oob_data()
3860 if (!hdev_is_powered(hdev)) { read_local_oob_data()
3861 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data()
3866 if (!lmp_ssp_capable(hdev)) { read_local_oob_data()
3867 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data()
3872 if (pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev)) { read_local_oob_data()
3873 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, read_local_oob_data()
3878 cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_DATA, hdev, NULL, 0); read_local_oob_data()
3884 hci_req_init(&req, hdev); read_local_oob_data()
3886 if (bredr_sc_enabled(hdev)) read_local_oob_data()
3896 hci_dev_unlock(hdev); read_local_oob_data()
3900 static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev, add_remote_oob_data() argument
3906 BT_DBG("%s ", hdev->name); add_remote_oob_data()
3909 return mgmt_cmd_complete(sk, hdev->id, add_remote_oob_data()
3914 hci_dev_lock(hdev); add_remote_oob_data()
3921 err = mgmt_cmd_complete(sk, hdev->id, add_remote_oob_data()
3928 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, add_remote_oob_data()
3936 err = mgmt_cmd_complete(sk, hdev->id, add_remote_oob_data()
3950 err = mgmt_cmd_complete(sk, hdev->id, add_remote_oob_data()
3985 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, add_remote_oob_data()
3993 err = mgmt_cmd_complete(sk, hdev->id, add_remote_oob_data()
3998 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA, add_remote_oob_data()
4003 hci_dev_unlock(hdev); add_remote_oob_data()
4007 static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev, remove_remote_oob_data() argument
4014 BT_DBG("%s", hdev->name); remove_remote_oob_data()
4017 return mgmt_cmd_complete(sk, hdev->id, remove_remote_oob_data()
4022 hci_dev_lock(hdev); remove_remote_oob_data()
4025 hci_remote_oob_data_clear(hdev); remove_remote_oob_data()
4030 err = hci_remove_remote_oob_data(hdev, &cp->addr.bdaddr, cp->addr.type); remove_remote_oob_data()
4037 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_REMOTE_OOB_DATA, remove_remote_oob_data()
4040 hci_dev_unlock(hdev); remove_remote_oob_data()
4046 struct hci_dev *hdev = req->hdev; trigger_bredr_inquiry() local
4051 *status = mgmt_bredr_support(hdev); trigger_bredr_inquiry()
4055 if (hci_dev_test_flag(hdev, HCI_INQUIRY)) { trigger_bredr_inquiry()
4060 hci_inquiry_cache_flush(hdev); trigger_bredr_inquiry()
4073 struct hci_dev *hdev = req->hdev; trigger_le_scan() local
4079 *status = mgmt_le_support(hdev); trigger_le_scan()
4083 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) { trigger_le_scan()
4087 if (hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { trigger_le_scan()
4099 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) trigger_le_scan()
4133 struct hci_dev *hdev = req->hdev; trigger_discovery() local
4135 switch (hdev->discovery.type) { trigger_discovery()
4143 &hdev->quirks)) { trigger_discovery()
4158 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { trigger_discovery()
4177 static void start_discovery_complete(struct hci_dev *hdev, u8 status, start_discovery_complete() argument
4185 hci_dev_lock(hdev); start_discovery_complete()
4187 cmd = pending_find(MGMT_OP_START_DISCOVERY, hdev); start_discovery_complete()
4189 cmd = pending_find(MGMT_OP_START_SERVICE_DISCOVERY, hdev); start_discovery_complete()
4197 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); start_discovery_complete()
4201 hci_discovery_set_state(hdev, DISCOVERY_FINDING); start_discovery_complete()
4204 * hdev->le_scan_disable that will stop it. start_discovery_complete()
4206 switch (hdev->discovery.type) { start_discovery_complete()
4219 if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) start_discovery_complete()
4222 timeout = msecs_to_jiffies(hdev->discov_interleaved_timeout); start_discovery_complete()
4228 BT_ERR("Invalid discovery type %d", hdev->discovery.type); start_discovery_complete()
4240 &hdev->quirks) && start_discovery_complete()
4241 hdev->discovery.result_filtering) { start_discovery_complete()
4242 hdev->discovery.scan_start = jiffies; start_discovery_complete()
4243 hdev->discovery.scan_duration = timeout; start_discovery_complete()
4246 queue_delayed_work(hdev->workqueue, start_discovery_complete()
4247 &hdev->le_scan_disable, timeout); start_discovery_complete()
4251 hci_dev_unlock(hdev); start_discovery_complete()
4254 static int start_discovery(struct sock *sk, struct hci_dev *hdev, start_discovery() argument
4263 BT_DBG("%s", hdev->name); start_discovery()
4265 hci_dev_lock(hdev); start_discovery()
4267 if (!hdev_is_powered(hdev)) { start_discovery()
4268 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_START_DISCOVERY, start_discovery()
4274 if (hdev->discovery.state != DISCOVERY_STOPPED || start_discovery()
4275 hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) { start_discovery()
4276 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_START_DISCOVERY, start_discovery()
4282 cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, hdev, data, len); start_discovery()
4293 hci_discovery_filter_clear(hdev); start_discovery()
4295 hdev->discovery.type = cp->type; start_discovery()
4296 hdev->discovery.report_invalid_rssi = false; start_discovery()
4298 hci_req_init(&req, hdev); start_discovery()
4301 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_START_DISCOVERY, start_discovery()
4313 hci_discovery_set_state(hdev, DISCOVERY_STARTING); start_discovery()
4316 hci_dev_unlock(hdev); start_discovery()
4327 static int start_service_discovery(struct sock *sk, struct hci_dev *hdev, start_service_discovery() argument
4338 BT_DBG("%s", hdev->name); start_service_discovery()
4340 hci_dev_lock(hdev); start_service_discovery()
4342 if (!hdev_is_powered(hdev)) { start_service_discovery()
4343 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4350 if (hdev->discovery.state != DISCOVERY_STOPPED || start_service_discovery()
4351 hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) { start_service_discovery()
4352 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4363 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4374 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4382 hdev, data, len); start_service_discovery()
4393 hci_discovery_filter_clear(hdev); start_service_discovery()
4395 hdev->discovery.result_filtering = true; start_service_discovery()
4396 hdev->discovery.type = cp->type; start_service_discovery()
4397 hdev->discovery.rssi = cp->rssi; start_service_discovery()
4398 hdev->discovery.uuid_count = uuid_count; start_service_discovery()
4401 hdev->discovery.uuids = kmemdup(cp->uuids, uuid_count * 16, start_service_discovery()
4403 if (!hdev->discovery.uuids) { start_service_discovery()
4404 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4413 hci_req_init(&req, hdev); start_service_discovery()
4416 err = mgmt_cmd_complete(sk, hdev->id, start_service_discovery()
4429 hci_discovery_set_state(hdev, DISCOVERY_STARTING); start_service_discovery()
4432 hci_dev_unlock(hdev); start_service_discovery()
4436 static void stop_discovery_complete(struct hci_dev *hdev, u8 status, u16 opcode) stop_discovery_complete() argument
4442 hci_dev_lock(hdev); stop_discovery_complete()
4444 cmd = pending_find(MGMT_OP_STOP_DISCOVERY, hdev); stop_discovery_complete()
4451 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); stop_discovery_complete()
4453 hci_dev_unlock(hdev); stop_discovery_complete()
4456 static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, stop_discovery() argument
4464 BT_DBG("%s", hdev->name); stop_discovery()
4466 hci_dev_lock(hdev); stop_discovery()
4468 if (!hci_discovery_active(hdev)) { stop_discovery()
4469 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, stop_discovery()
4475 if (hdev->discovery.type != mgmt_cp->type) { stop_discovery()
4476 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, stop_discovery()
4482 cmd = mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, hdev, data, len); stop_discovery()
4490 hci_req_init(&req, hdev); stop_discovery()
4496 hci_discovery_set_state(hdev, DISCOVERY_STOPPING); stop_discovery()
4504 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 0, stop_discovery()
4506 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); stop_discovery()
4510 hci_dev_unlock(hdev); stop_discovery()
4514 static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data, confirm_name() argument
4521 BT_DBG("%s", hdev->name); confirm_name()
4523 hci_dev_lock(hdev); confirm_name()
4525 if (!hci_discovery_active(hdev)) { confirm_name()
4526 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME, confirm_name()
4532 e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr); confirm_name()
4534 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME, confirm_name()
4545 hci_inquiry_cache_update_resolve(hdev, e); confirm_name()
4548 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME, 0, confirm_name()
4552 hci_dev_unlock(hdev); confirm_name()
4556 static int block_device(struct sock *sk, struct hci_dev *hdev, void *data, block_device() argument
4563 BT_DBG("%s", hdev->name); block_device()
4566 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE, block_device()
4570 hci_dev_lock(hdev); block_device()
4572 err = hci_bdaddr_list_add(&hdev->blacklist, &cp->addr.bdaddr, block_device()
4579 mgmt_event(MGMT_EV_DEVICE_BLOCKED, hdev, &cp->addr, sizeof(cp->addr), block_device()
4584 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE, status, block_device()
4587 hci_dev_unlock(hdev); block_device()
4592 static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data, unblock_device() argument
4599 BT_DBG("%s", hdev->name); unblock_device()
4602 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE, unblock_device()
4606 hci_dev_lock(hdev); unblock_device()
4608 err = hci_bdaddr_list_del(&hdev->blacklist, &cp->addr.bdaddr, unblock_device()
4615 mgmt_event(MGMT_EV_DEVICE_UNBLOCKED, hdev, &cp->addr, sizeof(cp->addr), unblock_device()
4620 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE, status, unblock_device()
4623 hci_dev_unlock(hdev); unblock_device()
4628 static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data, set_device_id() argument
4636 BT_DBG("%s", hdev->name); set_device_id()
4641 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEVICE_ID, set_device_id()
4644 hci_dev_lock(hdev); set_device_id()
4646 hdev->devid_source = source; set_device_id()
4647 hdev->devid_vendor = __le16_to_cpu(cp->vendor); set_device_id()
4648 hdev->devid_product = __le16_to_cpu(cp->product); set_device_id()
4649 hdev->devid_version = __le16_to_cpu(cp->version); set_device_id()
4651 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_ID, 0, set_device_id()
4654 hci_req_init(&req, hdev); set_device_id()
4658 hci_dev_unlock(hdev); set_device_id()
4663 static void enable_advertising_instance(struct hci_dev *hdev, u8 status, enable_advertising_instance() argument
4669 static void set_advertising_complete(struct hci_dev *hdev, u8 status, set_advertising_complete() argument
4672 struct cmd_lookup match = { NULL, hdev }; set_advertising_complete()
4675 hci_dev_lock(hdev); set_advertising_complete()
4680 mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, set_advertising_complete()
4685 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) set_advertising_complete()
4686 hci_dev_set_flag(hdev, HCI_ADVERTISING); set_advertising_complete()
4688 hci_dev_clear_flag(hdev, HCI_ADVERTISING); set_advertising_complete()
4690 mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, settings_rsp, set_advertising_complete()
4693 new_settings(hdev, match.sk); set_advertising_complete()
4701 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || set_advertising_complete()
4702 !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) set_advertising_complete()
4705 hci_req_init(&req, hdev); set_advertising_complete()
4714 hci_dev_unlock(hdev); set_advertising_complete()
4717 static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data, set_advertising() argument
4726 BT_DBG("request for %s", hdev->name); set_advertising()
4728 status = mgmt_le_support(hdev); set_advertising()
4730 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, set_advertising()
4734 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, set_advertising()
4737 hci_dev_lock(hdev); set_advertising()
4746 if (!hdev_is_powered(hdev) || set_advertising()
4747 (val == hci_dev_test_flag(hdev, HCI_ADVERTISING) && set_advertising()
4748 (cp->val == 0x02) == hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE)) || set_advertising()
4749 hci_conn_num(hdev, LE_LINK) > 0 || set_advertising()
4750 (hci_dev_test_flag(hdev, HCI_LE_SCAN) && set_advertising()
4751 hdev->le_scan_type == LE_SCAN_ACTIVE)) { set_advertising()
4755 changed = !hci_dev_test_and_set_flag(hdev, HCI_ADVERTISING); set_advertising()
4757 hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); set_advertising()
4759 hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); set_advertising()
4761 changed = hci_dev_test_and_clear_flag(hdev, HCI_ADVERTISING); set_advertising()
4762 hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); set_advertising()
4765 err = send_settings_rsp(sk, MGMT_OP_SET_ADVERTISING, hdev); set_advertising()
4770 err = new_settings(hdev, sk); set_advertising()
4775 if (pending_find(MGMT_OP_SET_ADVERTISING, hdev) || set_advertising()
4776 pending_find(MGMT_OP_SET_LE, hdev)) { set_advertising()
4777 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, set_advertising()
4782 cmd = mgmt_pending_add(sk, MGMT_OP_SET_ADVERTISING, hdev, data, len); set_advertising()
4788 hci_req_init(&req, hdev); set_advertising()
4791 hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); set_advertising()
4793 hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); set_advertising()
4809 hci_dev_unlock(hdev); set_advertising()
4813 static int set_static_address(struct sock *sk, struct hci_dev *hdev, set_static_address() argument
4819 BT_DBG("%s", hdev->name); set_static_address()
4821 if (!lmp_le_capable(hdev)) set_static_address()
4822 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS, set_static_address()
4825 if (hdev_is_powered(hdev)) set_static_address()
4826 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS, set_static_address()
4831 return mgmt_cmd_status(sk, hdev->id, set_static_address()
4837 return mgmt_cmd_status(sk, hdev->id, set_static_address()
4842 hci_dev_lock(hdev); set_static_address()
4844 bacpy(&hdev->static_addr, &cp->bdaddr); set_static_address()
4846 err = send_settings_rsp(sk, MGMT_OP_SET_STATIC_ADDRESS, hdev); set_static_address()
4850 err = new_settings(hdev, sk); set_static_address()
4853 hci_dev_unlock(hdev); set_static_address()
4857 static int set_scan_params(struct sock *sk, struct hci_dev *hdev, set_scan_params() argument
4864 BT_DBG("%s", hdev->name); set_scan_params()
4866 if (!lmp_le_capable(hdev)) set_scan_params()
4867 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, set_scan_params()
4873 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, set_scan_params()
4879 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, set_scan_params()
4883 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, set_scan_params()
4886 hci_dev_lock(hdev); set_scan_params()
4888 hdev->le_scan_interval = interval; set_scan_params()
4889 hdev->le_scan_window = window; set_scan_params()
4891 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 0, set_scan_params()
4897 if (hci_dev_test_flag(hdev, HCI_LE_SCAN) && set_scan_params()
4898 hdev->discovery.state == DISCOVERY_STOPPED) { set_scan_params()
4901 hci_req_init(&req, hdev); set_scan_params()
4909 hci_dev_unlock(hdev); set_scan_params()
4914 static void fast_connectable_complete(struct hci_dev *hdev, u8 status, fast_connectable_complete() argument
4921 hci_dev_lock(hdev); fast_connectable_complete()
4923 cmd = pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev); fast_connectable_complete()
4928 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, fast_connectable_complete()
4934 hci_dev_set_flag(hdev, HCI_FAST_CONNECTABLE); fast_connectable_complete()
4936 hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE); fast_connectable_complete()
4938 send_settings_rsp(cmd->sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev); fast_connectable_complete()
4939 new_settings(hdev, cmd->sk); fast_connectable_complete()
4945 hci_dev_unlock(hdev); fast_connectable_complete()
4948 static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev, set_fast_connectable() argument
4956 BT_DBG("%s", hdev->name); set_fast_connectable()
4958 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) || set_fast_connectable()
4959 hdev->hci_ver < BLUETOOTH_VER_1_2) set_fast_connectable()
4960 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, set_fast_connectable()
4964 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, set_fast_connectable()
4967 hci_dev_lock(hdev); set_fast_connectable()
4969 if (pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) { set_fast_connectable()
4970 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, set_fast_connectable()
4975 if (!!cp->val == hci_dev_test_flag(hdev, HCI_FAST_CONNECTABLE)) { set_fast_connectable()
4977 hdev); set_fast_connectable()
4981 if (!hdev_is_powered(hdev)) { set_fast_connectable()
4982 hci_dev_change_flag(hdev, HCI_FAST_CONNECTABLE); set_fast_connectable()
4984 hdev); set_fast_connectable()
4985 new_settings(hdev, sk); set_fast_connectable()
4989 cmd = mgmt_pending_add(sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev, set_fast_connectable()
4996 hci_req_init(&req, hdev); set_fast_connectable()
5002 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, set_fast_connectable()
5008 hci_dev_unlock(hdev); set_fast_connectable()
5013 static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode) set_bredr_complete() argument
5019 hci_dev_lock(hdev); set_bredr_complete()
5021 cmd = pending_find(MGMT_OP_SET_BREDR, hdev); set_bredr_complete()
5031 hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED); set_bredr_complete()
5035 send_settings_rsp(cmd->sk, MGMT_OP_SET_BREDR, hdev); set_bredr_complete()
5036 new_settings(hdev, cmd->sk); set_bredr_complete()
5042 hci_dev_unlock(hdev); set_bredr_complete()
5045 static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) set_bredr() argument
5052 BT_DBG("request for %s", hdev->name); set_bredr()
5054 if (!lmp_bredr_capable(hdev) || !lmp_le_capable(hdev)) set_bredr()
5055 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5058 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) set_bredr()
5059 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5063 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5066 hci_dev_lock(hdev); set_bredr()
5068 if (cp->val == hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { set_bredr()
5069 err = send_settings_rsp(sk, MGMT_OP_SET_BREDR, hdev); set_bredr()
5073 if (!hdev_is_powered(hdev)) { set_bredr()
5075 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); set_bredr()
5076 hci_dev_clear_flag(hdev, HCI_SSP_ENABLED); set_bredr()
5077 hci_dev_clear_flag(hdev, HCI_LINK_SECURITY); set_bredr()
5078 hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE); set_bredr()
5079 hci_dev_clear_flag(hdev, HCI_HS_ENABLED); set_bredr()
5082 hci_dev_change_flag(hdev, HCI_BREDR_ENABLED); set_bredr()
5084 err = send_settings_rsp(sk, MGMT_OP_SET_BREDR, hdev); set_bredr()
5088 err = new_settings(hdev, sk); set_bredr()
5094 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5112 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && set_bredr()
5113 (bacmp(&hdev->static_addr, BDADDR_ANY) || set_bredr()
5114 hci_dev_test_flag(hdev, HCI_SC_ENABLED))) { set_bredr()
5115 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5121 if (pending_find(MGMT_OP_SET_BREDR, hdev)) { set_bredr()
5122 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, set_bredr()
5127 cmd = mgmt_pending_add(sk, MGMT_OP_SET_BREDR, hdev, data, len); set_bredr()
5136 hci_dev_set_flag(hdev, HCI_BREDR_ENABLED); set_bredr()
5138 hci_req_init(&req, hdev); set_bredr()
5153 hci_dev_unlock(hdev); set_bredr()
5157 static void sc_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) sc_enable_complete() argument
5162 BT_DBG("%s status %u", hdev->name, status); sc_enable_complete()
5164 hci_dev_lock(hdev); sc_enable_complete()
5166 cmd = pending_find(MGMT_OP_SET_SECURE_CONN, hdev); sc_enable_complete()
5180 hci_dev_clear_flag(hdev, HCI_SC_ENABLED); sc_enable_complete()
5181 hci_dev_clear_flag(hdev, HCI_SC_ONLY); sc_enable_complete()
5184 hci_dev_set_flag(hdev, HCI_SC_ENABLED); sc_enable_complete()
5185 hci_dev_clear_flag(hdev, HCI_SC_ONLY); sc_enable_complete()
5188 hci_dev_set_flag(hdev, HCI_SC_ENABLED); sc_enable_complete()
5189 hci_dev_set_flag(hdev, HCI_SC_ONLY); sc_enable_complete()
5193 send_settings_rsp(cmd->sk, MGMT_OP_SET_SECURE_CONN, hdev); sc_enable_complete()
5194 new_settings(hdev, cmd->sk); sc_enable_complete()
5199 hci_dev_unlock(hdev); sc_enable_complete()
5202 static int set_secure_conn(struct sock *sk, struct hci_dev *hdev, set_secure_conn() argument
5211 BT_DBG("request for %s", hdev->name); set_secure_conn()
5213 if (!lmp_sc_capable(hdev) && set_secure_conn()
5214 !hci_dev_test_flag(hdev, HCI_LE_ENABLED)) set_secure_conn()
5215 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, set_secure_conn()
5218 if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && set_secure_conn()
5219 lmp_sc_capable(hdev) && set_secure_conn()
5220 !hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) set_secure_conn()
5221 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, set_secure_conn()
5225 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, set_secure_conn()
5228 hci_dev_lock(hdev); set_secure_conn()
5230 if (!hdev_is_powered(hdev) || !lmp_sc_capable(hdev) || set_secure_conn()
5231 !hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { set_secure_conn()
5235 changed = !hci_dev_test_and_set_flag(hdev, set_secure_conn()
5238 hci_dev_set_flag(hdev, HCI_SC_ONLY); set_secure_conn()
5240 hci_dev_clear_flag(hdev, HCI_SC_ONLY); set_secure_conn()
5242 changed = hci_dev_test_and_clear_flag(hdev, set_secure_conn()
5244 hci_dev_clear_flag(hdev, HCI_SC_ONLY); set_secure_conn()
5247 err = send_settings_rsp(sk, MGMT_OP_SET_SECURE_CONN, hdev); set_secure_conn()
5252 err = new_settings(hdev, sk); set_secure_conn()
5257 if (pending_find(MGMT_OP_SET_SECURE_CONN, hdev)) { set_secure_conn()
5258 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, set_secure_conn()
5265 if (val == hci_dev_test_flag(hdev, HCI_SC_ENABLED) && set_secure_conn()
5266 (cp->val == 0x02) == hci_dev_test_flag(hdev, HCI_SC_ONLY)) { set_secure_conn()
5267 err = send_settings_rsp(sk, MGMT_OP_SET_SECURE_CONN, hdev); set_secure_conn()
5271 cmd = mgmt_pending_add(sk, MGMT_OP_SET_SECURE_CONN, hdev, data, len); set_secure_conn()
5277 hci_req_init(&req, hdev); set_secure_conn()
5286 hci_dev_unlock(hdev); set_secure_conn()
5290 static int set_debug_keys(struct sock *sk, struct hci_dev *hdev, set_debug_keys() argument
5297 BT_DBG("request for %s", hdev->name); set_debug_keys()
5300 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEBUG_KEYS, set_debug_keys()
5303 hci_dev_lock(hdev); set_debug_keys()
5306 changed = !hci_dev_test_and_set_flag(hdev, HCI_KEEP_DEBUG_KEYS); set_debug_keys()
5308 changed = hci_dev_test_and_clear_flag(hdev, set_debug_keys()
5312 use_changed = !hci_dev_test_and_set_flag(hdev, set_debug_keys()
5315 use_changed = hci_dev_test_and_clear_flag(hdev, set_debug_keys()
5318 if (hdev_is_powered(hdev) && use_changed && set_debug_keys()
5319 hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { set_debug_keys()
5321 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE, set_debug_keys()
5325 err = send_settings_rsp(sk, MGMT_OP_SET_DEBUG_KEYS, hdev); set_debug_keys()
5330 err = new_settings(hdev, sk); set_debug_keys()
5333 hci_dev_unlock(hdev); set_debug_keys()
5337 static int set_privacy(struct sock *sk, struct hci_dev *hdev, void *cp_data, set_privacy() argument
5344 BT_DBG("request for %s", hdev->name); set_privacy()
5346 if (!lmp_le_capable(hdev)) set_privacy()
5347 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, set_privacy()
5351 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, set_privacy()
5354 if (hdev_is_powered(hdev)) set_privacy()
5355 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, set_privacy()
5358 hci_dev_lock(hdev); set_privacy()
5363 hci_dev_set_flag(hdev, HCI_RPA_RESOLVING); set_privacy()
5366 changed = !hci_dev_test_and_set_flag(hdev, HCI_PRIVACY); set_privacy()
5367 memcpy(hdev->irk, cp->irk, sizeof(hdev->irk)); set_privacy()
5368 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); set_privacy()
5370 changed = hci_dev_test_and_clear_flag(hdev, HCI_PRIVACY); set_privacy()
5371 memset(hdev->irk, 0, sizeof(hdev->irk)); set_privacy()
5372 hci_dev_clear_flag(hdev, HCI_RPA_EXPIRED); set_privacy()
5375 err = send_settings_rsp(sk, MGMT_OP_SET_PRIVACY, hdev); set_privacy()
5380 err = new_settings(hdev, sk); set_privacy()
5383 hci_dev_unlock(hdev); set_privacy()
5403 static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data, load_irks() argument
5412 BT_DBG("request for %s", hdev->name); load_irks()
5414 if (!lmp_le_capable(hdev)) load_irks()
5415 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, load_irks()
5421 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, load_irks()
5429 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, load_irks()
5433 BT_DBG("%s irk_count %u", hdev->name, irk_count); load_irks()
5439 return mgmt_cmd_status(sk, hdev->id, load_irks()
5444 hci_dev_lock(hdev); load_irks()
5446 hci_smp_irks_clear(hdev); load_irks()
5457 hci_add_irk(hdev, &irk->addr.bdaddr, addr_type, irk->val, load_irks()
5461 hci_dev_set_flag(hdev, HCI_RPA_RESOLVING); load_irks()
5463 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_LOAD_IRKS, 0, NULL, 0); load_irks()
5465 hci_dev_unlock(hdev); load_irks()
5489 static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev, load_long_term_keys() argument
5498 BT_DBG("request for %s", hdev->name); load_long_term_keys()
5500 if (!lmp_le_capable(hdev)) load_long_term_keys()
5501 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, load_long_term_keys()
5507 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, load_long_term_keys()
5516 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, load_long_term_keys()
5520 BT_DBG("%s key_count %u", hdev->name, key_count); load_long_term_keys()
5526 return mgmt_cmd_status(sk, hdev->id, load_long_term_keys()
5531 hci_dev_lock(hdev); load_long_term_keys()
5533 hci_smp_ltks_clear(hdev); load_long_term_keys()
5568 hci_add_ltk(hdev, &key->addr.bdaddr, addr_type, type, load_long_term_keys()
5573 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, 0, load_long_term_keys()
5576 hci_dev_unlock(hdev); load_long_term_keys()
5608 static void conn_info_refresh_complete(struct hci_dev *hdev, u8 hci_status, conn_info_refresh_complete() argument
5619 hci_dev_lock(hdev); conn_info_refresh_complete()
5630 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_RSSI); conn_info_refresh_complete()
5632 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_TX_POWER); conn_info_refresh_complete()
5644 conn = hci_conn_hash_lookup_handle(hdev, handle); conn_info_refresh_complete()
5650 cmd = pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn); conn_info_refresh_complete()
5658 hci_dev_unlock(hdev); conn_info_refresh_complete()
5661 static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data, get_conn_info() argument
5670 BT_DBG("%s", hdev->name); get_conn_info()
5677 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, get_conn_info()
5681 hci_dev_lock(hdev); get_conn_info()
5683 if (!hdev_is_powered(hdev)) { get_conn_info()
5684 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, get_conn_info()
5691 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, get_conn_info()
5694 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); get_conn_info()
5697 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, get_conn_info()
5703 if (pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn)) { get_conn_info()
5704 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, get_conn_info()
5710 * calculate conn info age as random value between min/max set in hdev. get_conn_info()
5712 conn_info_age = hdev->conn_info_min_age + get_conn_info()
5713 prandom_u32_max(hdev->conn_info_max_age - get_conn_info()
5714 hdev->conn_info_min_age); get_conn_info()
5727 hci_req_init(&req, hdev); get_conn_info()
5755 cmd = mgmt_pending_add(sk, MGMT_OP_GET_CONN_INFO, hdev, get_conn_info()
5773 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, get_conn_info()
5778 hci_dev_unlock(hdev); get_conn_info()
5786 struct hci_dev *hdev; clock_info_cmd_complete() local
5795 hdev = hci_dev_get(cmd->index); clock_info_cmd_complete()
5796 if (hdev) { clock_info_cmd_complete()
5797 rp.local_clock = cpu_to_le32(hdev->clock); clock_info_cmd_complete()
5798 hci_dev_put(hdev); clock_info_cmd_complete()
5818 static void get_clock_info_complete(struct hci_dev *hdev, u8 status, u16 opcode) get_clock_info_complete() argument
5824 BT_DBG("%s status %u", hdev->name, status); get_clock_info_complete()
5826 hci_dev_lock(hdev); get_clock_info_complete()
5828 hci_cp = hci_sent_cmd_data(hdev, HCI_OP_READ_CLOCK); get_clock_info_complete()
5834 conn = hci_conn_hash_lookup_handle(hdev, handle); get_clock_info_complete()
5839 cmd = pending_find_data(MGMT_OP_GET_CLOCK_INFO, hdev, conn); get_clock_info_complete()
5847 hci_dev_unlock(hdev); get_clock_info_complete()
5850 static int get_clock_info(struct sock *sk, struct hci_dev *hdev, void *data, get_clock_info() argument
5861 BT_DBG("%s", hdev->name); get_clock_info()
5868 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CLOCK_INFO, get_clock_info()
5872 hci_dev_lock(hdev); get_clock_info()
5874 if (!hdev_is_powered(hdev)) { get_clock_info()
5875 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CLOCK_INFO, get_clock_info()
5882 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, get_clock_info()
5885 err = mgmt_cmd_complete(sk, hdev->id, get_clock_info()
5895 cmd = mgmt_pending_add(sk, MGMT_OP_GET_CLOCK_INFO, hdev, data, len); get_clock_info()
5903 hci_req_init(&req, hdev); get_clock_info()
5922 hci_dev_unlock(hdev); get_clock_info()
5926 static bool is_connected(struct hci_dev *hdev, bdaddr_t *addr, u8 type) is_connected() argument
5930 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, addr); is_connected()
5943 /* This function requires the caller holds hdev->lock */ hci_conn_params_set()
5947 struct hci_dev *hdev = req->hdev; hci_conn_params_set() local
5950 params = hci_conn_params_add(hdev, addr, addr_type); hci_conn_params_set()
5965 list_add(&params->action, &hdev->pend_le_reports); hci_conn_params_set()
5970 if (!is_connected(hdev, addr, addr_type)) { hci_conn_params_set()
5971 list_add(&params->action, &hdev->pend_le_conns); hci_conn_params_set()
5985 static void device_added(struct sock *sk, struct hci_dev *hdev, device_added() argument
5994 mgmt_event(MGMT_EV_DEVICE_ADDED, hdev, &ev, sizeof(ev), sk); device_added()
5997 static void add_device_complete(struct hci_dev *hdev, u8 status, u16 opcode) add_device_complete() argument
6003 hci_dev_lock(hdev); add_device_complete()
6005 cmd = pending_find(MGMT_OP_ADD_DEVICE, hdev); add_device_complete()
6013 hci_dev_unlock(hdev); add_device_complete()
6016 static int add_device(struct sock *sk, struct hci_dev *hdev, add_device() argument
6025 BT_DBG("%s", hdev->name); add_device()
6029 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE, add_device()
6034 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE, add_device()
6038 hci_req_init(&req, hdev); add_device()
6040 hci_dev_lock(hdev); add_device()
6042 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_DEVICE, hdev, data, len); add_device()
6059 err = hci_bdaddr_list_add(&hdev->whitelist, &cp->addr.bdaddr, add_device()
6092 device_added(sk, hdev, &cp->addr.bdaddr, cp->addr.type, cp->action); add_device()
6105 hci_dev_unlock(hdev); add_device()
6109 static void device_removed(struct sock *sk, struct hci_dev *hdev, device_removed() argument
6117 mgmt_event(MGMT_EV_DEVICE_REMOVED, hdev, &ev, sizeof(ev), sk); device_removed()
6120 static void remove_device_complete(struct hci_dev *hdev, u8 status, u16 opcode) remove_device_complete() argument
6126 hci_dev_lock(hdev); remove_device_complete()
6128 cmd = pending_find(MGMT_OP_REMOVE_DEVICE, hdev); remove_device_complete()
6136 hci_dev_unlock(hdev); remove_device_complete()
6139 static int remove_device(struct sock *sk, struct hci_dev *hdev, remove_device() argument
6147 BT_DBG("%s", hdev->name); remove_device()
6149 hci_req_init(&req, hdev); remove_device()
6151 hci_dev_lock(hdev); remove_device()
6153 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_DEVICE, hdev, data, len); remove_device()
6173 err = hci_bdaddr_list_del(&hdev->whitelist, remove_device()
6185 device_removed(sk, hdev, &cp->addr.bdaddr, remove_device()
6195 params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr, remove_device()
6216 device_removed(sk, hdev, &cp->addr.bdaddr, cp->addr.type); remove_device()
6228 list_for_each_entry_safe(b, btmp, &hdev->whitelist, list) { remove_device()
6229 device_removed(sk, hdev, &b->bdaddr, b->bdaddr_type); remove_device()
6236 list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) { remove_device()
6239 device_removed(sk, hdev, &p->addr, p->addr_type); remove_device()
6262 hci_dev_unlock(hdev); remove_device()
6266 static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data, load_conn_param() argument
6275 if (!lmp_le_capable(hdev)) load_conn_param()
6276 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, load_conn_param()
6283 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, load_conn_param()
6292 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, load_conn_param()
6296 BT_DBG("%s param_count %u", hdev->name, param_count); load_conn_param()
6298 hci_dev_lock(hdev); load_conn_param()
6300 hci_conn_params_clear_disabled(hdev); load_conn_param()
6333 hci_param = hci_conn_params_add(hdev, &param->addr.bdaddr, load_conn_param()
6346 hci_dev_unlock(hdev); load_conn_param()
6348 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, 0, load_conn_param()
6352 static int set_external_config(struct sock *sk, struct hci_dev *hdev, set_external_config() argument
6359 BT_DBG("%s", hdev->name); set_external_config()
6361 if (hdev_is_powered(hdev)) set_external_config()
6362 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, set_external_config()
6366 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, set_external_config()
6369 if (!test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks)) set_external_config()
6370 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, set_external_config()
6373 hci_dev_lock(hdev); set_external_config()
6376 changed = !hci_dev_test_and_set_flag(hdev, HCI_EXT_CONFIGURED); set_external_config()
6378 changed = hci_dev_test_and_clear_flag(hdev, HCI_EXT_CONFIGURED); set_external_config()
6380 err = send_options_rsp(sk, MGMT_OP_SET_EXTERNAL_CONFIG, hdev); set_external_config()
6387 err = new_options(hdev, sk); set_external_config()
6389 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) == is_configured(hdev)) { set_external_config()
6390 mgmt_index_removed(hdev); set_external_config()
6392 if (hci_dev_test_and_change_flag(hdev, HCI_UNCONFIGURED)) { set_external_config()
6393 hci_dev_set_flag(hdev, HCI_CONFIG); set_external_config()
6394 hci_dev_set_flag(hdev, HCI_AUTO_OFF); set_external_config()
6396 queue_work(hdev->req_workqueue, &hdev->power_on); set_external_config()
6398 set_bit(HCI_RAW, &hdev->flags); set_external_config()
6399 mgmt_index_added(hdev); set_external_config()
6404 hci_dev_unlock(hdev); set_external_config()
6408 static int set_public_address(struct sock *sk, struct hci_dev *hdev, set_public_address() argument
6415 BT_DBG("%s", hdev->name); set_public_address()
6417 if (hdev_is_powered(hdev)) set_public_address()
6418 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, set_public_address()
6422 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, set_public_address()
6425 if (!hdev->set_bdaddr) set_public_address()
6426 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, set_public_address()
6429 hci_dev_lock(hdev); set_public_address()
6431 changed = !!bacmp(&hdev->public_addr, &cp->bdaddr); set_public_address()
6432 bacpy(&hdev->public_addr, &cp->bdaddr); set_public_address()
6434 err = send_options_rsp(sk, MGMT_OP_SET_PUBLIC_ADDRESS, hdev); set_public_address()
6441 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) set_public_address()
6442 err = new_options(hdev, sk); set_public_address()
6444 if (is_configured(hdev)) { set_public_address()
6445 mgmt_index_removed(hdev); set_public_address()
6447 hci_dev_clear_flag(hdev, HCI_UNCONFIGURED); set_public_address()
6449 hci_dev_set_flag(hdev, HCI_CONFIG); set_public_address()
6450 hci_dev_set_flag(hdev, HCI_AUTO_OFF); set_public_address()
6452 queue_work(hdev->req_workqueue, &hdev->power_on); set_public_address()
6456 hci_dev_unlock(hdev); set_public_address()
6471 static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status, read_local_oob_ext_data_complete() argument
6481 BT_DBG("%s status %u", hdev->name, status); read_local_oob_ext_data_complete()
6483 cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev); read_local_oob_ext_data_complete()
6523 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { read_local_oob_ext_data_complete()
6546 hdev->dev_class, 3); read_local_oob_ext_data_complete()
6566 err = mgmt_cmd_complete(cmd->sk, hdev->id, read_local_oob_ext_data_complete()
6574 err = mgmt_limited_event(MGMT_EV_LOCAL_OOB_DATA_UPDATED, hdev, read_local_oob_ext_data_complete()
6582 static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk, read_local_ssp_oob_req() argument
6589 cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev, read_local_ssp_oob_req()
6594 hci_req_init(&req, hdev); read_local_ssp_oob_req()
6596 if (bredr_sc_enabled(hdev)) read_local_ssp_oob_req()
6610 static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev, read_local_oob_ext_data() argument
6620 BT_DBG("%s", hdev->name); read_local_oob_ext_data()
6622 if (hdev_is_powered(hdev)) { read_local_oob_ext_data()
6625 status = mgmt_bredr_support(hdev); read_local_oob_ext_data()
6632 status = mgmt_le_support(hdev); read_local_oob_ext_data()
6656 hci_dev_lock(hdev); read_local_oob_ext_data()
6661 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { BIT()
6662 err = read_local_ssp_oob_req(hdev, sk, cp); BIT()
6663 hci_dev_unlock(hdev); BIT()
6672 hdev->dev_class, 3);
6676 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) && BIT()
6677 smp_generate_oob(hdev, hash, rand) < 0) { BIT()
6678 hci_dev_unlock(hdev); BIT()
6693 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) {
6694 hci_dev_unlock(hdev);
6699 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
6700 !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
6701 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
6702 bacmp(&hdev->static_addr, BDADDR_ANY))) {
6703 memcpy(addr, &hdev->static_addr, 6);
6706 memcpy(addr, &hdev->bdaddr, 6);
6713 if (hci_dev_test_flag(hdev, HCI_ADVERTISING))
6721 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED)) {
6731 flags = get_adv_discov_flags(hdev);
6733 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
6741 hci_dev_unlock(hdev);
6751 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_EXT_DATA,
6756 err = mgmt_limited_event(MGMT_EV_LOCAL_OOB_DATA_UPDATED, hdev,
6766 static u32 get_supported_adv_flags(struct hci_dev *hdev) get_supported_adv_flags() argument
6775 if (hdev->adv_tx_power != HCI_TX_POWER_INVALID) get_supported_adv_flags()
6781 static int read_adv_features(struct sock *sk, struct hci_dev *hdev, read_adv_features() argument
6790 BT_DBG("%s", hdev->name); read_adv_features()
6792 if (!lmp_le_capable(hdev)) read_adv_features()
6793 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_ADV_FEATURES, read_adv_features()
6796 hci_dev_lock(hdev); read_adv_features()
6803 instance = hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE); read_adv_features()
6809 hci_dev_unlock(hdev); read_adv_features()
6813 supported_flags = get_supported_adv_flags(hdev); read_adv_features()
6830 hci_dev_unlock(hdev); read_adv_features()
6832 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_ADV_FEATURES, read_adv_features()
6840 static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data, tlv_data_is_valid() argument
6883 static void add_advertising_complete(struct hci_dev *hdev, u8 status, add_advertising_complete() argument
6891 hci_dev_lock(hdev); add_advertising_complete()
6893 cmd = pending_find(MGMT_OP_ADD_ADVERTISING, hdev); add_advertising_complete()
6896 hci_dev_clear_flag(hdev, HCI_ADVERTISING_INSTANCE); add_advertising_complete()
6897 memset(&hdev->adv_instance, 0, sizeof(hdev->adv_instance)); add_advertising_complete()
6898 advertising_removed(cmd ? cmd->sk : NULL, hdev, 1); add_advertising_complete()
6916 hci_dev_unlock(hdev); add_advertising_complete()
6921 struct hci_dev *hdev = container_of(work, struct hci_dev, adv_timeout_expired() local
6924 hdev->adv_instance.timeout = 0; adv_timeout_expired()
6926 hci_dev_lock(hdev); adv_timeout_expired()
6927 clear_adv_instance(hdev); adv_timeout_expired()
6928 hci_dev_unlock(hdev); adv_timeout_expired()
6931 static int add_advertising(struct sock *sk, struct hci_dev *hdev, add_advertising() argument
6944 BT_DBG("%s", hdev->name); add_advertising()
6946 status = mgmt_le_support(hdev); add_advertising()
6948 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
6957 supported_flags = get_supported_adv_flags(hdev); add_advertising()
6959 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
6962 hci_dev_lock(hdev); add_advertising()
6964 if (timeout && !hdev_is_powered(hdev)) { add_advertising()
6965 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
6970 if (pending_find(MGMT_OP_ADD_ADVERTISING, hdev) || add_advertising()
6971 pending_find(MGMT_OP_REMOVE_ADVERTISING, hdev) || add_advertising()
6972 pending_find(MGMT_OP_SET_LE, hdev)) { add_advertising()
6973 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
6978 if (!tlv_data_is_valid(hdev, flags, cp->data, cp->adv_data_len, true) || add_advertising()
6979 !tlv_data_is_valid(hdev, flags, cp->data + cp->adv_data_len, add_advertising()
6981 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
6986 INIT_DELAYED_WORK(&hdev->adv_instance.timeout_exp, adv_timeout_expired); add_advertising()
6988 hdev->adv_instance.flags = flags; add_advertising()
6989 hdev->adv_instance.adv_data_len = cp->adv_data_len; add_advertising()
6990 hdev->adv_instance.scan_rsp_len = cp->scan_rsp_len; add_advertising()
6993 memcpy(hdev->adv_instance.adv_data, cp->data, cp->adv_data_len); add_advertising()
6996 memcpy(hdev->adv_instance.scan_rsp_data, add_advertising()
6999 if (hdev->adv_instance.timeout) add_advertising()
7000 cancel_delayed_work(&hdev->adv_instance.timeout_exp); add_advertising()
7002 hdev->adv_instance.timeout = timeout; add_advertising()
7005 queue_delayed_work(hdev->workqueue, add_advertising()
7006 &hdev->adv_instance.timeout_exp, add_advertising()
7009 if (!hci_dev_test_and_set_flag(hdev, HCI_ADVERTISING_INSTANCE)) add_advertising()
7010 advertising_added(sk, hdev, 1); add_advertising()
7015 if (!hdev_is_powered(hdev) || add_advertising()
7016 hci_dev_test_flag(hdev, HCI_ADVERTISING)) { add_advertising()
7018 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_ADVERTISING, add_advertising()
7026 cmd = mgmt_pending_add(sk, MGMT_OP_ADD_ADVERTISING, hdev, data, add_advertising()
7033 hci_req_init(&req, hdev); add_advertising()
7044 hci_dev_unlock(hdev); add_advertising()
7049 static void remove_advertising_complete(struct hci_dev *hdev, u8 status, remove_advertising_complete() argument
7057 hci_dev_lock(hdev); remove_advertising_complete()
7063 cmd = pending_find(MGMT_OP_REMOVE_ADVERTISING, hdev); remove_advertising_complete()
7074 hci_dev_unlock(hdev); remove_advertising_complete()
7077 static int remove_advertising(struct sock *sk, struct hci_dev *hdev, remove_advertising() argument
7086 BT_DBG("%s", hdev->name); remove_advertising()
7092 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_ADVERTISING, remove_advertising()
7095 hci_dev_lock(hdev); remove_advertising()
7097 if (pending_find(MGMT_OP_ADD_ADVERTISING, hdev) || remove_advertising()
7098 pending_find(MGMT_OP_REMOVE_ADVERTISING, hdev) || remove_advertising()
7099 pending_find(MGMT_OP_SET_LE, hdev)) { remove_advertising()
7100 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_ADVERTISING, remove_advertising()
7105 if (!hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) { remove_advertising()
7106 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_ADVERTISING, remove_advertising()
7111 if (hdev->adv_instance.timeout) remove_advertising()
7112 cancel_delayed_work(&hdev->adv_instance.timeout_exp); remove_advertising()
7114 memset(&hdev->adv_instance, 0, sizeof(hdev->adv_instance)); remove_advertising()
7116 advertising_removed(sk, hdev, 1); remove_advertising()
7118 hci_dev_clear_flag(hdev, HCI_ADVERTISING_INSTANCE); remove_advertising()
7123 if (!hdev_is_powered(hdev) || remove_advertising()
7124 hci_dev_test_flag(hdev, HCI_ADVERTISING)) { remove_advertising()
7126 err = mgmt_cmd_complete(sk, hdev->id, remove_advertising()
7132 cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_ADVERTISING, hdev, data, remove_advertising()
7139 hci_req_init(&req, hdev); remove_advertising()
7147 hci_dev_unlock(hdev); remove_advertising()
7241 void mgmt_index_added(struct hci_dev *hdev) mgmt_index_added() argument
7245 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) mgmt_index_added()
7248 switch (hdev->dev_type) { mgmt_index_added()
7250 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { mgmt_index_added()
7251 mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev, mgmt_index_added()
7255 mgmt_index_event(MGMT_EV_INDEX_ADDED, hdev, NULL, 0, mgmt_index_added()
7267 ev.bus = hdev->bus; mgmt_index_added()
7269 mgmt_index_event(MGMT_EV_EXT_INDEX_ADDED, hdev, &ev, sizeof(ev), mgmt_index_added()
7273 void mgmt_index_removed(struct hci_dev *hdev) mgmt_index_removed() argument
7278 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) mgmt_index_removed()
7281 switch (hdev->dev_type) { mgmt_index_removed()
7283 mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status); mgmt_index_removed()
7285 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { mgmt_index_removed()
7286 mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, mgmt_index_removed()
7290 mgmt_index_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, mgmt_index_removed()
7302 ev.bus = hdev->bus; mgmt_index_removed()
7304 mgmt_index_event(MGMT_EV_EXT_INDEX_REMOVED, hdev, &ev, sizeof(ev), mgmt_index_removed()
7308 /* This function requires the caller holds hdev->lock */ restart_le_actions()
7311 struct hci_dev *hdev = req->hdev; restart_le_actions() local
7314 list_for_each_entry(p, &hdev->le_conn_params, list) { restart_le_actions()
7323 list_add(&p->action, &hdev->pend_le_conns); restart_le_actions()
7326 list_add(&p->action, &hdev->pend_le_reports); restart_le_actions()
7336 static void powered_complete(struct hci_dev *hdev, u8 status, u16 opcode) powered_complete() argument
7338 struct cmd_lookup match = { NULL, hdev }; powered_complete()
7348 smp_register(hdev); powered_complete()
7351 hci_dev_lock(hdev); powered_complete()
7353 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match); powered_complete()
7355 new_settings(hdev, match.sk); powered_complete()
7357 hci_dev_unlock(hdev); powered_complete()
7363 static int powered_update_hci(struct hci_dev *hdev) powered_update_hci() argument
7368 hci_req_init(&req, hdev); powered_update_hci()
7370 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED) && powered_update_hci()
7371 !lmp_host_ssp_capable(hdev)) { powered_update_hci()
7376 if (bredr_sc_enabled(hdev) && !lmp_host_sc_capable(hdev)) { powered_update_hci()
7384 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED) && powered_update_hci()
7385 lmp_bredr_capable(hdev)) { powered_update_hci()
7394 if (cp.le != lmp_host_le_capable(hdev) || powered_update_hci()
7395 cp.simul != lmp_host_le_br_capable(hdev)) powered_update_hci()
7400 if (lmp_le_capable(hdev)) { powered_update_hci()
7405 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { powered_update_hci()
7410 if (hci_dev_test_flag(hdev, HCI_ADVERTISING) || powered_update_hci()
7411 hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) powered_update_hci()
7417 link_sec = hci_dev_test_flag(hdev, HCI_LINK_SECURITY); powered_update_hci()
7418 if (link_sec != test_bit(HCI_AUTH, &hdev->flags)) powered_update_hci()
7422 if (lmp_bredr_capable(hdev)) { powered_update_hci()
7423 if (hci_dev_test_flag(hdev, HCI_FAST_CONNECTABLE)) powered_update_hci()
7436 int mgmt_powered(struct hci_dev *hdev, u8 powered) mgmt_powered() argument
7438 struct cmd_lookup match = { NULL, hdev }; mgmt_powered()
7442 if (!hci_dev_test_flag(hdev, HCI_MGMT)) mgmt_powered()
7446 if (powered_update_hci(hdev) == 0) mgmt_powered()
7449 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, mgmt_powered()
7454 mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match); mgmt_powered()
7456 /* If the power off is because of hdev unregistration let mgmt_powered()
7463 if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) mgmt_powered()
7468 mgmt_pending_foreach(0, hdev, cmd_complete_rsp, &status); mgmt_powered()
7470 if (memcmp(hdev->dev_class, zero_cod, sizeof(zero_cod)) != 0) mgmt_powered()
7471 mgmt_generic_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev, mgmt_powered()
7475 err = new_settings(hdev, match.sk); mgmt_powered()
7483 void mgmt_set_powered_failed(struct hci_dev *hdev, int err) mgmt_set_powered_failed() argument
7488 cmd = pending_find(MGMT_OP_SET_POWERED, hdev); mgmt_set_powered_failed()
7497 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status); mgmt_set_powered_failed()
7502 void mgmt_discoverable_timeout(struct hci_dev *hdev) mgmt_discoverable_timeout() argument
7506 hci_dev_lock(hdev); mgmt_discoverable_timeout()
7513 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); mgmt_discoverable_timeout()
7514 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); mgmt_discoverable_timeout()
7516 hci_req_init(&req, hdev); mgmt_discoverable_timeout()
7517 if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { mgmt_discoverable_timeout()
7527 if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) mgmt_discoverable_timeout()
7532 hdev->discov_timeout = 0; mgmt_discoverable_timeout()
7534 new_settings(hdev, NULL); mgmt_discoverable_timeout()
7536 hci_dev_unlock(hdev); mgmt_discoverable_timeout()
7539 void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, mgmt_new_link_key() argument
7553 mgmt_event(MGMT_EV_NEW_LINK_KEY, hdev, &ev, sizeof(ev), NULL); mgmt_new_link_key()
7575 void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent) mgmt_new_ltk() argument
7610 mgmt_event(MGMT_EV_NEW_LONG_TERM_KEY, hdev, &ev, sizeof(ev), NULL); mgmt_new_ltk()
7613 void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk) mgmt_new_irk() argument
7640 mgmt_event(MGMT_EV_NEW_IRK, hdev, &ev, sizeof(ev), NULL); mgmt_new_irk()
7643 void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, mgmt_new_csrk() argument
7670 mgmt_event(MGMT_EV_NEW_CSRK, hdev, &ev, sizeof(ev), NULL); mgmt_new_csrk()
7673 void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_new_conn_param() argument
7691 mgmt_event(MGMT_EV_NEW_CONN_PARAM, hdev, &ev, sizeof(ev), NULL); mgmt_new_conn_param()
7694 void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn, mgmt_device_connected() argument
7727 mgmt_event(MGMT_EV_DEVICE_CONNECTED, hdev, buf, mgmt_device_connected()
7745 struct hci_dev *hdev = data; unpair_device_rsp() local
7748 device_unpaired(hdev, &cp->addr.bdaddr, cp->addr.type, cmd->sk); unpair_device_rsp()
7754 bool mgmt_powering_down(struct hci_dev *hdev) mgmt_powering_down() argument
7759 cmd = pending_find(MGMT_OP_SET_POWERED, hdev); mgmt_powering_down()
7770 void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_device_disconnected() argument
7780 if (mgmt_powering_down(hdev) && hci_conn_count(hdev) == 1) { mgmt_device_disconnected()
7781 cancel_delayed_work(&hdev->power_off); mgmt_device_disconnected()
7782 queue_work(hdev->req_workqueue, &hdev->power_off.work); mgmt_device_disconnected()
7791 mgmt_pending_foreach(MGMT_OP_DISCONNECT, hdev, disconnect_rsp, &sk); mgmt_device_disconnected()
7797 mgmt_event(MGMT_EV_DEVICE_DISCONNECTED, hdev, &ev, sizeof(ev), sk); mgmt_device_disconnected()
7802 mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp, mgmt_device_disconnected()
7803 hdev); mgmt_device_disconnected()
7806 void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_disconnect_failed() argument
7813 mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp, mgmt_disconnect_failed()
7814 hdev); mgmt_disconnect_failed()
7816 cmd = pending_find(MGMT_OP_DISCONNECT, hdev); mgmt_disconnect_failed()
7832 void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, mgmt_connect_failed() argument
7840 if (mgmt_powering_down(hdev) && hci_conn_count(hdev) == 1) { mgmt_connect_failed()
7841 cancel_delayed_work(&hdev->power_off); mgmt_connect_failed()
7842 queue_work(hdev->req_workqueue, &hdev->power_off.work); mgmt_connect_failed()
7849 mgmt_event(MGMT_EV_CONNECT_FAILED, hdev, &ev, sizeof(ev), NULL); mgmt_connect_failed()
7852 void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure) mgmt_pin_code_request() argument
7860 mgmt_event(MGMT_EV_PIN_CODE_REQUEST, hdev, &ev, sizeof(ev), NULL); mgmt_pin_code_request()
7863 void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_pin_code_reply_complete() argument
7868 cmd = pending_find(MGMT_OP_PIN_CODE_REPLY, hdev); mgmt_pin_code_reply_complete()
7876 void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_pin_code_neg_reply_complete() argument
7881 cmd = pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, hdev); mgmt_pin_code_neg_reply_complete()
7889 int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_confirm_request() argument
7895 BT_DBG("%s", hdev->name); mgmt_user_confirm_request()
7902 return mgmt_event(MGMT_EV_USER_CONFIRM_REQUEST, hdev, &ev, sizeof(ev), mgmt_user_confirm_request()
7906 int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_passkey_request() argument
7911 BT_DBG("%s", hdev->name); mgmt_user_passkey_request()
7916 return mgmt_event(MGMT_EV_USER_PASSKEY_REQUEST, hdev, &ev, sizeof(ev), mgmt_user_passkey_request()
7920 static int user_pairing_resp_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, user_pairing_resp_complete() argument
7926 cmd = pending_find(opcode, hdev); user_pairing_resp_complete()
7936 int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_confirm_reply_complete() argument
7939 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type, mgmt_user_confirm_reply_complete()
7943 int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_confirm_neg_reply_complete() argument
7946 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type, mgmt_user_confirm_neg_reply_complete()
7951 int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_passkey_reply_complete() argument
7954 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type, mgmt_user_passkey_reply_complete()
7958 int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_passkey_neg_reply_complete() argument
7961 return user_pairing_resp_complete(hdev, bdaddr, link_type, addr_type, mgmt_user_passkey_neg_reply_complete()
7966 int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, mgmt_user_passkey_notify() argument
7972 BT_DBG("%s", hdev->name); mgmt_user_passkey_notify()
7979 return mgmt_event(MGMT_EV_PASSKEY_NOTIFY, hdev, &ev, sizeof(ev), NULL); mgmt_user_passkey_notify()
7994 mgmt_event(MGMT_EV_AUTH_FAILED, conn->hdev, &ev, sizeof(ev), mgmt_auth_failed()
8003 void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status) mgmt_auth_enable_complete() argument
8005 struct cmd_lookup match = { NULL, hdev }; mgmt_auth_enable_complete()
8010 mgmt_pending_foreach(MGMT_OP_SET_LINK_SECURITY, hdev, mgmt_auth_enable_complete()
8015 if (test_bit(HCI_AUTH, &hdev->flags)) mgmt_auth_enable_complete()
8016 changed = !hci_dev_test_and_set_flag(hdev, HCI_LINK_SECURITY); mgmt_auth_enable_complete()
8018 changed = hci_dev_test_and_clear_flag(hdev, HCI_LINK_SECURITY); mgmt_auth_enable_complete()
8020 mgmt_pending_foreach(MGMT_OP_SET_LINK_SECURITY, hdev, settings_rsp, mgmt_auth_enable_complete()
8024 new_settings(hdev, match.sk); mgmt_auth_enable_complete()
8032 struct hci_dev *hdev = req->hdev; clear_eir() local
8035 if (!lmp_ext_inq_capable(hdev)) clear_eir()
8038 memset(hdev->eir, 0, sizeof(hdev->eir)); clear_eir()
8045 void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status) mgmt_ssp_enable_complete() argument
8047 struct cmd_lookup match = { NULL, hdev }; mgmt_ssp_enable_complete()
8054 if (enable && hci_dev_test_and_clear_flag(hdev, mgmt_ssp_enable_complete()
8056 hci_dev_clear_flag(hdev, HCI_HS_ENABLED); mgmt_ssp_enable_complete()
8057 new_settings(hdev, NULL); mgmt_ssp_enable_complete()
8060 mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, cmd_status_rsp, mgmt_ssp_enable_complete()
8066 changed = !hci_dev_test_and_set_flag(hdev, HCI_SSP_ENABLED); mgmt_ssp_enable_complete()
8068 changed = hci_dev_test_and_clear_flag(hdev, HCI_SSP_ENABLED); mgmt_ssp_enable_complete()
8070 changed = hci_dev_test_and_clear_flag(hdev, mgmt_ssp_enable_complete()
8073 hci_dev_clear_flag(hdev, HCI_HS_ENABLED); mgmt_ssp_enable_complete()
8076 mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, settings_rsp, &match); mgmt_ssp_enable_complete()
8079 new_settings(hdev, match.sk); mgmt_ssp_enable_complete()
8084 hci_req_init(&req, hdev); mgmt_ssp_enable_complete()
8086 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { mgmt_ssp_enable_complete()
8087 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) mgmt_ssp_enable_complete()
8108 void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, mgmt_set_class_of_dev_complete() argument
8111 struct cmd_lookup match = { NULL, hdev, mgmt_status(status) }; mgmt_set_class_of_dev_complete()
8113 mgmt_pending_foreach(MGMT_OP_SET_DEV_CLASS, hdev, sk_lookup, &match); mgmt_set_class_of_dev_complete()
8114 mgmt_pending_foreach(MGMT_OP_ADD_UUID, hdev, sk_lookup, &match); mgmt_set_class_of_dev_complete()
8115 mgmt_pending_foreach(MGMT_OP_REMOVE_UUID, hdev, sk_lookup, &match); mgmt_set_class_of_dev_complete()
8118 mgmt_generic_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev, mgmt_set_class_of_dev_complete()
8125 void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status) mgmt_set_local_name_complete() argument
8135 memcpy(ev.short_name, hdev->short_name, HCI_MAX_SHORT_NAME_LENGTH); mgmt_set_local_name_complete()
8137 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); mgmt_set_local_name_complete()
8139 memcpy(hdev->dev_name, name, sizeof(hdev->dev_name)); mgmt_set_local_name_complete()
8144 if (pending_find(MGMT_OP_SET_POWERED, hdev)) mgmt_set_local_name_complete()
8148 mgmt_generic_event(MGMT_EV_LOCAL_NAME_CHANGED, hdev, &ev, sizeof(ev), mgmt_set_local_name_complete()
8219 static void restart_le_scan(struct hci_dev *hdev) restart_le_scan() argument
8222 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) restart_le_scan()
8226 hdev->discovery.scan_start + restart_le_scan()
8227 hdev->discovery.scan_duration)) restart_le_scan()
8230 queue_delayed_work(hdev->workqueue, &hdev->le_scan_restart, restart_le_scan()
8234 static bool is_filter_match(struct hci_dev *hdev, s8 rssi, u8 *eir, is_filter_match() argument
8246 if (hdev->discovery.rssi != HCI_RSSI_INVALID && is_filter_match()
8248 (rssi < hdev->discovery.rssi && is_filter_match()
8249 !test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks)))) is_filter_match()
8252 if (hdev->discovery.uuid_count != 0) { is_filter_match()
8256 if (!eir_has_uuids(eir, eir_len, hdev->discovery.uuid_count, is_filter_match()
8257 hdev->discovery.uuids) && is_filter_match()
8259 hdev->discovery.uuid_count, is_filter_match()
8260 hdev->discovery.uuids)) is_filter_match()
8267 if (test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks)) { is_filter_match()
8268 restart_le_scan(hdev); is_filter_match()
8271 if (hdev->discovery.rssi != HCI_RSSI_INVALID && is_filter_match()
8272 rssi < hdev->discovery.rssi) is_filter_match()
8279 void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, mgmt_device_found() argument
8291 if (!hci_discovery_active(hdev)) { mgmt_device_found()
8294 if (link_type == LE_LINK && list_empty(&hdev->pend_le_reports)) mgmt_device_found()
8298 if (hdev->discovery.result_filtering) { mgmt_device_found()
8300 if (!is_filter_match(hdev, rssi, eir, eir_len, scan_rsp, mgmt_device_found()
8321 if (rssi == HCI_RSSI_INVALID && !hdev->discovery.report_invalid_rssi && mgmt_device_found()
8345 mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, ev_size, NULL); mgmt_device_found()
8348 void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, mgmt_remote_name() argument
8368 mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, sizeof(*ev) + eir_len, NULL); mgmt_remote_name()
8371 void mgmt_discovering(struct hci_dev *hdev, u8 discovering) mgmt_discovering() argument
8375 BT_DBG("%s discovering %u", hdev->name, discovering); mgmt_discovering()
8378 ev.type = hdev->discovery.type; mgmt_discovering()
8381 mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL); mgmt_discovering()
8384 static void adv_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) adv_enable_complete() argument
8386 BT_DBG("%s status %u", hdev->name, status); adv_enable_complete()
8389 void mgmt_reenable_advertising(struct hci_dev *hdev) mgmt_reenable_advertising() argument
8393 if (!hci_dev_test_flag(hdev, HCI_ADVERTISING) && mgmt_reenable_advertising()
8394 !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) mgmt_reenable_advertising()
8397 hci_req_init(&req, hdev); mgmt_reenable_advertising()
828 pending_find_data(u16 opcode, struct hci_dev *hdev, const void *data) pending_find_data() argument
H A Dhci_event.c44 static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_inquiry_cancel() argument
48 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_inquiry_cancel()
53 clear_bit(HCI_INQUIRY, &hdev->flags); hci_cc_inquiry_cancel()
55 wake_up_bit(&hdev->flags, HCI_INQUIRY); hci_cc_inquiry_cancel()
57 hci_dev_lock(hdev); hci_cc_inquiry_cancel()
58 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_cc_inquiry_cancel()
59 hci_dev_unlock(hdev); hci_cc_inquiry_cancel()
61 hci_conn_check_pending(hdev); hci_cc_inquiry_cancel()
64 static void hci_cc_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_periodic_inq() argument
68 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_periodic_inq()
73 hci_dev_set_flag(hdev, HCI_PERIODIC_INQ); hci_cc_periodic_inq()
76 static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_exit_periodic_inq() argument
80 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_exit_periodic_inq()
85 hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); hci_cc_exit_periodic_inq()
87 hci_conn_check_pending(hdev); hci_cc_exit_periodic_inq()
90 static void hci_cc_remote_name_req_cancel(struct hci_dev *hdev, hci_cc_remote_name_req_cancel() argument
93 BT_DBG("%s", hdev->name); hci_cc_remote_name_req_cancel()
96 static void hci_cc_role_discovery(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_role_discovery() argument
101 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_role_discovery()
106 hci_dev_lock(hdev); hci_cc_role_discovery()
108 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_role_discovery()
112 hci_dev_unlock(hdev); hci_cc_role_discovery()
115 static void hci_cc_read_link_policy(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_link_policy() argument
120 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_link_policy()
125 hci_dev_lock(hdev); hci_cc_read_link_policy()
127 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_read_link_policy()
131 hci_dev_unlock(hdev); hci_cc_read_link_policy()
134 static void hci_cc_write_link_policy(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_link_policy() argument
140 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_write_link_policy()
145 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LINK_POLICY); hci_cc_write_link_policy()
149 hci_dev_lock(hdev); hci_cc_write_link_policy()
151 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_write_link_policy()
155 hci_dev_unlock(hdev); hci_cc_write_link_policy()
158 static void hci_cc_read_def_link_policy(struct hci_dev *hdev, hci_cc_read_def_link_policy() argument
163 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_def_link_policy()
168 hdev->link_policy = __le16_to_cpu(rp->policy); hci_cc_read_def_link_policy()
171 static void hci_cc_write_def_link_policy(struct hci_dev *hdev, hci_cc_write_def_link_policy() argument
177 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_def_link_policy()
182 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_DEF_LINK_POLICY); hci_cc_write_def_link_policy()
186 hdev->link_policy = get_unaligned_le16(sent); hci_cc_write_def_link_policy()
189 static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_reset() argument
193 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_reset()
195 clear_bit(HCI_RESET, &hdev->flags); hci_cc_reset()
201 hci_dev_clear_volatile_flags(hdev); hci_cc_reset()
203 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_cc_reset()
205 hdev->inq_tx_power = HCI_TX_POWER_INVALID; hci_cc_reset()
206 hdev->adv_tx_power = HCI_TX_POWER_INVALID; hci_cc_reset()
208 memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); hci_cc_reset()
209 hdev->adv_data_len = 0; hci_cc_reset()
211 memset(hdev->scan_rsp_data, 0, sizeof(hdev->scan_rsp_data)); hci_cc_reset()
212 hdev->scan_rsp_data_len = 0; hci_cc_reset()
214 hdev->le_scan_type = LE_SCAN_PASSIVE; hci_cc_reset()
216 hdev->ssp_debug_mode = 0; hci_cc_reset()
218 hci_bdaddr_list_clear(&hdev->le_white_list); hci_cc_reset()
221 static void hci_cc_read_stored_link_key(struct hci_dev *hdev, hci_cc_read_stored_link_key() argument
227 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_stored_link_key()
229 sent = hci_sent_cmd_data(hdev, HCI_OP_READ_STORED_LINK_KEY); hci_cc_read_stored_link_key()
234 hdev->stored_max_keys = rp->max_keys; hci_cc_read_stored_link_key()
235 hdev->stored_num_keys = rp->num_keys; hci_cc_read_stored_link_key()
239 static void hci_cc_delete_stored_link_key(struct hci_dev *hdev, hci_cc_delete_stored_link_key() argument
244 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_delete_stored_link_key()
249 if (rp->num_keys <= hdev->stored_num_keys) hci_cc_delete_stored_link_key()
250 hdev->stored_num_keys -= rp->num_keys; hci_cc_delete_stored_link_key()
252 hdev->stored_num_keys = 0; hci_cc_delete_stored_link_key()
255 static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_local_name() argument
260 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_local_name()
262 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LOCAL_NAME); hci_cc_write_local_name()
266 hci_dev_lock(hdev); hci_cc_write_local_name()
268 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_write_local_name()
269 mgmt_set_local_name_complete(hdev, sent, status); hci_cc_write_local_name()
271 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); hci_cc_write_local_name()
273 hci_dev_unlock(hdev); hci_cc_write_local_name()
276 static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_local_name() argument
280 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_name()
285 if (hci_dev_test_flag(hdev, HCI_SETUP) || hci_cc_read_local_name()
286 hci_dev_test_flag(hdev, HCI_CONFIG)) hci_cc_read_local_name()
287 memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH); hci_cc_read_local_name()
290 static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_auth_enable() argument
295 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_auth_enable()
297 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_AUTH_ENABLE); hci_cc_write_auth_enable()
301 hci_dev_lock(hdev); hci_cc_write_auth_enable()
307 set_bit(HCI_AUTH, &hdev->flags); hci_cc_write_auth_enable()
309 clear_bit(HCI_AUTH, &hdev->flags); hci_cc_write_auth_enable()
312 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_write_auth_enable()
313 mgmt_auth_enable_complete(hdev, status); hci_cc_write_auth_enable()
315 hci_dev_unlock(hdev); hci_cc_write_auth_enable()
318 static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_encrypt_mode() argument
324 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_encrypt_mode()
329 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_ENCRYPT_MODE); hci_cc_write_encrypt_mode()
336 set_bit(HCI_ENCRYPT, &hdev->flags); hci_cc_write_encrypt_mode()
338 clear_bit(HCI_ENCRYPT, &hdev->flags); hci_cc_write_encrypt_mode()
341 static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_scan_enable() argument
347 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_scan_enable()
349 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SCAN_ENABLE); hci_cc_write_scan_enable()
355 hci_dev_lock(hdev); hci_cc_write_scan_enable()
358 hdev->discov_timeout = 0; hci_cc_write_scan_enable()
363 set_bit(HCI_ISCAN, &hdev->flags); hci_cc_write_scan_enable()
365 clear_bit(HCI_ISCAN, &hdev->flags); hci_cc_write_scan_enable()
368 set_bit(HCI_PSCAN, &hdev->flags); hci_cc_write_scan_enable()
370 clear_bit(HCI_PSCAN, &hdev->flags); hci_cc_write_scan_enable()
373 hci_dev_unlock(hdev); hci_cc_write_scan_enable()
376 static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_class_of_dev() argument
380 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_class_of_dev()
385 memcpy(hdev->dev_class, rp->dev_class, 3); hci_cc_read_class_of_dev()
387 BT_DBG("%s class 0x%.2x%.2x%.2x", hdev->name, hci_cc_read_class_of_dev()
388 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); hci_cc_read_class_of_dev()
391 static void hci_cc_write_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_class_of_dev() argument
396 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_class_of_dev()
398 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV); hci_cc_write_class_of_dev()
402 hci_dev_lock(hdev); hci_cc_write_class_of_dev()
405 memcpy(hdev->dev_class, sent, 3); hci_cc_write_class_of_dev()
407 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_write_class_of_dev()
408 mgmt_set_class_of_dev_complete(hdev, sent, status); hci_cc_write_class_of_dev()
410 hci_dev_unlock(hdev); hci_cc_write_class_of_dev()
413 static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_voice_setting() argument
418 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_voice_setting()
425 if (hdev->voice_setting == setting) hci_cc_read_voice_setting()
428 hdev->voice_setting = setting; hci_cc_read_voice_setting()
430 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); hci_cc_read_voice_setting()
432 if (hdev->notify) hci_cc_read_voice_setting()
433 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); hci_cc_read_voice_setting()
436 static void hci_cc_write_voice_setting(struct hci_dev *hdev, hci_cc_write_voice_setting() argument
443 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_voice_setting()
448 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING); hci_cc_write_voice_setting()
454 if (hdev->voice_setting == setting) hci_cc_write_voice_setting()
457 hdev->voice_setting = setting; hci_cc_write_voice_setting()
459 BT_DBG("%s voice setting 0x%4.4x", hdev->name, setting); hci_cc_write_voice_setting()
461 if (hdev->notify) hci_cc_write_voice_setting()
462 hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); hci_cc_write_voice_setting()
465 static void hci_cc_read_num_supported_iac(struct hci_dev *hdev, hci_cc_read_num_supported_iac() argument
470 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_num_supported_iac()
475 hdev->num_iac = rp->num_iac; hci_cc_read_num_supported_iac()
477 BT_DBG("%s num iac %d", hdev->name, hdev->num_iac); hci_cc_read_num_supported_iac()
480 static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_ssp_mode() argument
485 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_ssp_mode()
487 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SSP_MODE); hci_cc_write_ssp_mode()
491 hci_dev_lock(hdev); hci_cc_write_ssp_mode()
495 hdev->features[1][0] |= LMP_HOST_SSP; hci_cc_write_ssp_mode()
497 hdev->features[1][0] &= ~LMP_HOST_SSP; hci_cc_write_ssp_mode()
500 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_write_ssp_mode()
501 mgmt_ssp_enable_complete(hdev, sent->mode, status); hci_cc_write_ssp_mode()
504 hci_dev_set_flag(hdev, HCI_SSP_ENABLED); hci_cc_write_ssp_mode()
506 hci_dev_clear_flag(hdev, HCI_SSP_ENABLED); hci_cc_write_ssp_mode()
509 hci_dev_unlock(hdev); hci_cc_write_ssp_mode()
512 static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_sc_support() argument
517 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_sc_support()
519 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SC_SUPPORT); hci_cc_write_sc_support()
523 hci_dev_lock(hdev); hci_cc_write_sc_support()
527 hdev->features[1][0] |= LMP_HOST_SC; hci_cc_write_sc_support()
529 hdev->features[1][0] &= ~LMP_HOST_SC; hci_cc_write_sc_support()
532 if (!hci_dev_test_flag(hdev, HCI_MGMT) && !status) { hci_cc_write_sc_support()
534 hci_dev_set_flag(hdev, HCI_SC_ENABLED); hci_cc_write_sc_support()
536 hci_dev_clear_flag(hdev, HCI_SC_ENABLED); hci_cc_write_sc_support()
539 hci_dev_unlock(hdev); hci_cc_write_sc_support()
542 static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_local_version() argument
546 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_version()
551 if (hci_dev_test_flag(hdev, HCI_SETUP) || hci_cc_read_local_version()
552 hci_dev_test_flag(hdev, HCI_CONFIG)) { hci_cc_read_local_version()
553 hdev->hci_ver = rp->hci_ver; hci_cc_read_local_version()
554 hdev->hci_rev = __le16_to_cpu(rp->hci_rev); hci_cc_read_local_version()
555 hdev->lmp_ver = rp->lmp_ver; hci_cc_read_local_version()
556 hdev->manufacturer = __le16_to_cpu(rp->manufacturer); hci_cc_read_local_version()
557 hdev->lmp_subver = __le16_to_cpu(rp->lmp_subver); hci_cc_read_local_version()
561 static void hci_cc_read_local_commands(struct hci_dev *hdev, hci_cc_read_local_commands() argument
566 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_commands()
571 if (hci_dev_test_flag(hdev, HCI_SETUP) || hci_cc_read_local_commands()
572 hci_dev_test_flag(hdev, HCI_CONFIG)) hci_cc_read_local_commands()
573 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); hci_cc_read_local_commands()
576 static void hci_cc_read_local_features(struct hci_dev *hdev, hci_cc_read_local_features() argument
581 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_features()
586 memcpy(hdev->features, rp->features, 8); hci_cc_read_local_features()
591 if (hdev->features[0][0] & LMP_3SLOT) hci_cc_read_local_features()
592 hdev->pkt_type |= (HCI_DM3 | HCI_DH3); hci_cc_read_local_features()
594 if (hdev->features[0][0] & LMP_5SLOT) hci_cc_read_local_features()
595 hdev->pkt_type |= (HCI_DM5 | HCI_DH5); hci_cc_read_local_features()
597 if (hdev->features[0][1] & LMP_HV2) { hci_cc_read_local_features()
598 hdev->pkt_type |= (HCI_HV2); hci_cc_read_local_features()
599 hdev->esco_type |= (ESCO_HV2); hci_cc_read_local_features()
602 if (hdev->features[0][1] & LMP_HV3) { hci_cc_read_local_features()
603 hdev->pkt_type |= (HCI_HV3); hci_cc_read_local_features()
604 hdev->esco_type |= (ESCO_HV3); hci_cc_read_local_features()
607 if (lmp_esco_capable(hdev)) hci_cc_read_local_features()
608 hdev->esco_type |= (ESCO_EV3); hci_cc_read_local_features()
610 if (hdev->features[0][4] & LMP_EV4) hci_cc_read_local_features()
611 hdev->esco_type |= (ESCO_EV4); hci_cc_read_local_features()
613 if (hdev->features[0][4] & LMP_EV5) hci_cc_read_local_features()
614 hdev->esco_type |= (ESCO_EV5); hci_cc_read_local_features()
616 if (hdev->features[0][5] & LMP_EDR_ESCO_2M) hci_cc_read_local_features()
617 hdev->esco_type |= (ESCO_2EV3); hci_cc_read_local_features()
619 if (hdev->features[0][5] & LMP_EDR_ESCO_3M) hci_cc_read_local_features()
620 hdev->esco_type |= (ESCO_3EV3); hci_cc_read_local_features()
622 if (hdev->features[0][5] & LMP_EDR_3S_ESCO) hci_cc_read_local_features()
623 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); hci_cc_read_local_features()
626 static void hci_cc_read_local_ext_features(struct hci_dev *hdev, hci_cc_read_local_ext_features() argument
631 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_ext_features()
636 if (hdev->max_page < rp->max_page) hci_cc_read_local_ext_features()
637 hdev->max_page = rp->max_page; hci_cc_read_local_ext_features()
640 memcpy(hdev->features[rp->page], rp->features, 8); hci_cc_read_local_ext_features()
643 static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, hci_cc_read_flow_control_mode() argument
648 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_flow_control_mode()
653 hdev->flow_ctl_mode = rp->mode; hci_cc_read_flow_control_mode()
656 static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_buffer_size() argument
660 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_buffer_size()
665 hdev->acl_mtu = __le16_to_cpu(rp->acl_mtu); hci_cc_read_buffer_size()
666 hdev->sco_mtu = rp->sco_mtu; hci_cc_read_buffer_size()
667 hdev->acl_pkts = __le16_to_cpu(rp->acl_max_pkt); hci_cc_read_buffer_size()
668 hdev->sco_pkts = __le16_to_cpu(rp->sco_max_pkt); hci_cc_read_buffer_size()
670 if (test_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks)) { hci_cc_read_buffer_size()
671 hdev->sco_mtu = 64; hci_cc_read_buffer_size()
672 hdev->sco_pkts = 8; hci_cc_read_buffer_size()
675 hdev->acl_cnt = hdev->acl_pkts; hci_cc_read_buffer_size()
676 hdev->sco_cnt = hdev->sco_pkts; hci_cc_read_buffer_size()
678 BT_DBG("%s acl mtu %d:%d sco mtu %d:%d", hdev->name, hdev->acl_mtu, hci_cc_read_buffer_size()
679 hdev->acl_pkts, hdev->sco_mtu, hdev->sco_pkts); hci_cc_read_buffer_size()
682 static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_bd_addr() argument
686 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_bd_addr()
691 if (test_bit(HCI_INIT, &hdev->flags)) hci_cc_read_bd_addr()
692 bacpy(&hdev->bdaddr, &rp->bdaddr); hci_cc_read_bd_addr()
694 if (hci_dev_test_flag(hdev, HCI_SETUP)) hci_cc_read_bd_addr()
695 bacpy(&hdev->setup_addr, &rp->bdaddr); hci_cc_read_bd_addr()
698 static void hci_cc_read_page_scan_activity(struct hci_dev *hdev, hci_cc_read_page_scan_activity() argument
703 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_page_scan_activity()
708 if (test_bit(HCI_INIT, &hdev->flags)) { hci_cc_read_page_scan_activity()
709 hdev->page_scan_interval = __le16_to_cpu(rp->interval); hci_cc_read_page_scan_activity()
710 hdev->page_scan_window = __le16_to_cpu(rp->window); hci_cc_read_page_scan_activity()
714 static void hci_cc_write_page_scan_activity(struct hci_dev *hdev, hci_cc_write_page_scan_activity() argument
720 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_page_scan_activity()
725 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY); hci_cc_write_page_scan_activity()
729 hdev->page_scan_interval = __le16_to_cpu(sent->interval); hci_cc_write_page_scan_activity()
730 hdev->page_scan_window = __le16_to_cpu(sent->window); hci_cc_write_page_scan_activity()
733 static void hci_cc_read_page_scan_type(struct hci_dev *hdev, hci_cc_read_page_scan_type() argument
738 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_page_scan_type()
743 if (test_bit(HCI_INIT, &hdev->flags)) hci_cc_read_page_scan_type()
744 hdev->page_scan_type = rp->type; hci_cc_read_page_scan_type()
747 static void hci_cc_write_page_scan_type(struct hci_dev *hdev, hci_cc_write_page_scan_type() argument
753 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_page_scan_type()
758 type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE); hci_cc_write_page_scan_type()
760 hdev->page_scan_type = *type; hci_cc_write_page_scan_type()
763 static void hci_cc_read_data_block_size(struct hci_dev *hdev, hci_cc_read_data_block_size() argument
768 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_data_block_size()
773 hdev->block_mtu = __le16_to_cpu(rp->max_acl_len); hci_cc_read_data_block_size()
774 hdev->block_len = __le16_to_cpu(rp->block_len); hci_cc_read_data_block_size()
775 hdev->num_blocks = __le16_to_cpu(rp->num_blocks); hci_cc_read_data_block_size()
777 hdev->block_cnt = hdev->num_blocks; hci_cc_read_data_block_size()
779 BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, hci_cc_read_data_block_size()
780 hdev->block_cnt, hdev->block_len); hci_cc_read_data_block_size()
783 static void hci_cc_read_clock(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_clock() argument
789 BT_DBG("%s", hdev->name); hci_cc_read_clock()
797 hci_dev_lock(hdev); hci_cc_read_clock()
799 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_CLOCK); hci_cc_read_clock()
804 hdev->clock = le32_to_cpu(rp->clock); hci_cc_read_clock()
808 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_read_clock()
815 hci_dev_unlock(hdev); hci_cc_read_clock()
818 static void hci_cc_read_local_amp_info(struct hci_dev *hdev, hci_cc_read_local_amp_info() argument
823 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_amp_info()
828 hdev->amp_status = rp->amp_status; hci_cc_read_local_amp_info()
829 hdev->amp_total_bw = __le32_to_cpu(rp->total_bw); hci_cc_read_local_amp_info()
830 hdev->amp_max_bw = __le32_to_cpu(rp->max_bw); hci_cc_read_local_amp_info()
831 hdev->amp_min_latency = __le32_to_cpu(rp->min_latency); hci_cc_read_local_amp_info()
832 hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu); hci_cc_read_local_amp_info()
833 hdev->amp_type = rp->amp_type; hci_cc_read_local_amp_info()
834 hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap); hci_cc_read_local_amp_info()
835 hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size); hci_cc_read_local_amp_info()
836 hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); hci_cc_read_local_amp_info()
837 hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); hci_cc_read_local_amp_info()
840 a2mp_send_getinfo_rsp(hdev); hci_cc_read_local_amp_info()
843 static void hci_cc_read_local_amp_assoc(struct hci_dev *hdev, hci_cc_read_local_amp_assoc() argument
847 struct amp_assoc *assoc = &hdev->loc_assoc; hci_cc_read_local_amp_assoc()
850 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_amp_assoc()
865 amp_read_loc_assoc_frag(hdev, rp->phy_handle); hci_cc_read_local_amp_assoc()
876 a2mp_send_getampassoc_rsp(hdev, rp->status); hci_cc_read_local_amp_assoc()
877 a2mp_send_create_phy_link_req(hdev, rp->status); hci_cc_read_local_amp_assoc()
880 static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, hci_cc_read_inq_rsp_tx_power() argument
885 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_inq_rsp_tx_power()
890 hdev->inq_tx_power = rp->tx_power; hci_cc_read_inq_rsp_tx_power()
893 static void hci_cc_pin_code_reply(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_pin_code_reply() argument
899 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_pin_code_reply()
901 hci_dev_lock(hdev); hci_cc_pin_code_reply()
903 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_pin_code_reply()
904 mgmt_pin_code_reply_complete(hdev, &rp->bdaddr, rp->status); hci_cc_pin_code_reply()
909 cp = hci_sent_cmd_data(hdev, HCI_OP_PIN_CODE_REPLY); hci_cc_pin_code_reply()
913 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); hci_cc_pin_code_reply()
918 hci_dev_unlock(hdev); hci_cc_pin_code_reply()
921 static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_pin_code_neg_reply() argument
925 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_pin_code_neg_reply()
927 hci_dev_lock(hdev); hci_cc_pin_code_neg_reply()
929 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_pin_code_neg_reply()
930 mgmt_pin_code_neg_reply_complete(hdev, &rp->bdaddr, hci_cc_pin_code_neg_reply()
933 hci_dev_unlock(hdev); hci_cc_pin_code_neg_reply()
936 static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, hci_cc_le_read_buffer_size() argument
941 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_buffer_size()
946 hdev->le_mtu = __le16_to_cpu(rp->le_mtu); hci_cc_le_read_buffer_size()
947 hdev->le_pkts = rp->le_max_pkt; hci_cc_le_read_buffer_size()
949 hdev->le_cnt = hdev->le_pkts; hci_cc_le_read_buffer_size()
951 BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); hci_cc_le_read_buffer_size()
954 static void hci_cc_le_read_local_features(struct hci_dev *hdev, hci_cc_le_read_local_features() argument
959 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_local_features()
964 memcpy(hdev->le_features, rp->features, 8); hci_cc_le_read_local_features()
967 static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, hci_cc_le_read_adv_tx_power() argument
972 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_adv_tx_power()
977 hdev->adv_tx_power = rp->tx_power; hci_cc_le_read_adv_tx_power()
980 static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_user_confirm_reply() argument
984 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_user_confirm_reply()
986 hci_dev_lock(hdev); hci_cc_user_confirm_reply()
988 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_user_confirm_reply()
989 mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0, hci_cc_user_confirm_reply()
992 hci_dev_unlock(hdev); hci_cc_user_confirm_reply()
995 static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev, hci_cc_user_confirm_neg_reply() argument
1000 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_user_confirm_neg_reply()
1002 hci_dev_lock(hdev); hci_cc_user_confirm_neg_reply()
1004 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_user_confirm_neg_reply()
1005 mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr, hci_cc_user_confirm_neg_reply()
1008 hci_dev_unlock(hdev); hci_cc_user_confirm_neg_reply()
1011 static void hci_cc_user_passkey_reply(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_user_passkey_reply() argument
1015 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_user_passkey_reply()
1017 hci_dev_lock(hdev); hci_cc_user_passkey_reply()
1019 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_user_passkey_reply()
1020 mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, hci_cc_user_passkey_reply()
1023 hci_dev_unlock(hdev); hci_cc_user_passkey_reply()
1026 static void hci_cc_user_passkey_neg_reply(struct hci_dev *hdev, hci_cc_user_passkey_neg_reply() argument
1031 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_user_passkey_neg_reply()
1033 hci_dev_lock(hdev); hci_cc_user_passkey_neg_reply()
1035 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cc_user_passkey_neg_reply()
1036 mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr, hci_cc_user_passkey_neg_reply()
1039 hci_dev_unlock(hdev); hci_cc_user_passkey_neg_reply()
1042 static void hci_cc_read_local_oob_data(struct hci_dev *hdev, hci_cc_read_local_oob_data() argument
1047 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_oob_data()
1050 static void hci_cc_read_local_oob_ext_data(struct hci_dev *hdev, hci_cc_read_local_oob_ext_data() argument
1055 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_local_oob_ext_data()
1058 static void hci_cc_le_set_random_addr(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_le_set_random_addr() argument
1063 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_set_random_addr()
1068 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_RANDOM_ADDR); hci_cc_le_set_random_addr()
1072 hci_dev_lock(hdev); hci_cc_le_set_random_addr()
1074 bacpy(&hdev->random_addr, sent); hci_cc_le_set_random_addr()
1076 hci_dev_unlock(hdev); hci_cc_le_set_random_addr()
1079 static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_le_set_adv_enable() argument
1083 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_set_adv_enable()
1088 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_ENABLE); hci_cc_le_set_adv_enable()
1092 hci_dev_lock(hdev); hci_cc_le_set_adv_enable()
1100 hci_dev_set_flag(hdev, HCI_LE_ADV); hci_cc_le_set_adv_enable()
1102 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); hci_cc_le_set_adv_enable()
1104 queue_delayed_work(hdev->workqueue, hci_cc_le_set_adv_enable()
1108 hci_dev_clear_flag(hdev, HCI_LE_ADV); hci_cc_le_set_adv_enable()
1111 hci_dev_unlock(hdev); hci_cc_le_set_adv_enable()
1114 static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_le_set_scan_param() argument
1119 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_set_scan_param()
1124 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_PARAM); hci_cc_le_set_scan_param()
1128 hci_dev_lock(hdev); hci_cc_le_set_scan_param()
1130 hdev->le_scan_type = cp->type; hci_cc_le_set_scan_param()
1132 hci_dev_unlock(hdev); hci_cc_le_set_scan_param()
1135 static bool has_pending_adv_report(struct hci_dev *hdev) has_pending_adv_report() argument
1137 struct discovery_state *d = &hdev->discovery; has_pending_adv_report()
1142 static void clear_pending_adv_report(struct hci_dev *hdev) clear_pending_adv_report() argument
1144 struct discovery_state *d = &hdev->discovery; clear_pending_adv_report()
1150 static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr, store_pending_adv_report() argument
1154 struct discovery_state *d = &hdev->discovery; store_pending_adv_report()
1164 static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, hci_cc_le_set_scan_enable() argument
1170 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_set_scan_enable()
1175 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE); hci_cc_le_set_scan_enable()
1179 hci_dev_lock(hdev); hci_cc_le_set_scan_enable()
1183 hci_dev_set_flag(hdev, HCI_LE_SCAN); hci_cc_le_set_scan_enable()
1184 if (hdev->le_scan_type == LE_SCAN_ACTIVE) hci_cc_le_set_scan_enable()
1185 clear_pending_adv_report(hdev); hci_cc_le_set_scan_enable()
1193 if (has_pending_adv_report(hdev)) { hci_cc_le_set_scan_enable()
1194 struct discovery_state *d = &hdev->discovery; hci_cc_le_set_scan_enable()
1196 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, hci_cc_le_set_scan_enable()
1206 cancel_delayed_work(&hdev->le_scan_disable); hci_cc_le_set_scan_enable()
1208 hci_dev_clear_flag(hdev, HCI_LE_SCAN); hci_cc_le_set_scan_enable()
1217 if (hci_dev_test_and_clear_flag(hdev, HCI_LE_SCAN_INTERRUPTED)) hci_cc_le_set_scan_enable()
1218 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_cc_le_set_scan_enable()
1219 else if (!hci_dev_test_flag(hdev, HCI_LE_ADV) && hci_cc_le_set_scan_enable()
1220 hdev->discovery.state == DISCOVERY_FINDING) hci_cc_le_set_scan_enable()
1221 mgmt_reenable_advertising(hdev); hci_cc_le_set_scan_enable()
1230 hci_dev_unlock(hdev); hci_cc_le_set_scan_enable()
1233 static void hci_cc_le_read_white_list_size(struct hci_dev *hdev, hci_cc_le_read_white_list_size() argument
1238 BT_DBG("%s status 0x%2.2x size %u", hdev->name, rp->status, rp->size); hci_cc_le_read_white_list_size()
1243 hdev->le_white_list_size = rp->size; hci_cc_le_read_white_list_size()
1246 static void hci_cc_le_clear_white_list(struct hci_dev *hdev, hci_cc_le_clear_white_list() argument
1251 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_clear_white_list()
1256 hci_bdaddr_list_clear(&hdev->le_white_list); hci_cc_le_clear_white_list()
1259 static void hci_cc_le_add_to_white_list(struct hci_dev *hdev, hci_cc_le_add_to_white_list() argument
1265 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_add_to_white_list()
1270 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_ADD_TO_WHITE_LIST); hci_cc_le_add_to_white_list()
1274 hci_bdaddr_list_add(&hdev->le_white_list, &sent->bdaddr, hci_cc_le_add_to_white_list()
1278 static void hci_cc_le_del_from_white_list(struct hci_dev *hdev, hci_cc_le_del_from_white_list() argument
1284 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_del_from_white_list()
1289 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_DEL_FROM_WHITE_LIST); hci_cc_le_del_from_white_list()
1293 hci_bdaddr_list_del(&hdev->le_white_list, &sent->bdaddr, hci_cc_le_del_from_white_list()
1297 static void hci_cc_le_read_supported_states(struct hci_dev *hdev, hci_cc_le_read_supported_states() argument
1302 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_supported_states()
1307 memcpy(hdev->le_states, rp->le_states, 8); hci_cc_le_read_supported_states()
1310 static void hci_cc_le_read_def_data_len(struct hci_dev *hdev, hci_cc_le_read_def_data_len() argument
1315 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_def_data_len()
1320 hdev->le_def_tx_len = le16_to_cpu(rp->tx_len); hci_cc_le_read_def_data_len()
1321 hdev->le_def_tx_time = le16_to_cpu(rp->tx_time); hci_cc_le_read_def_data_len()
1324 static void hci_cc_le_write_def_data_len(struct hci_dev *hdev, hci_cc_le_write_def_data_len() argument
1330 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_le_write_def_data_len()
1335 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_WRITE_DEF_DATA_LEN); hci_cc_le_write_def_data_len()
1339 hdev->le_def_tx_len = le16_to_cpu(sent->tx_len); hci_cc_le_write_def_data_len()
1340 hdev->le_def_tx_time = le16_to_cpu(sent->tx_time); hci_cc_le_write_def_data_len()
1343 static void hci_cc_le_read_max_data_len(struct hci_dev *hdev, hci_cc_le_read_max_data_len() argument
1348 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_le_read_max_data_len()
1353 hdev->le_max_tx_len = le16_to_cpu(rp->tx_len); hci_cc_le_read_max_data_len()
1354 hdev->le_max_tx_time = le16_to_cpu(rp->tx_time); hci_cc_le_read_max_data_len()
1355 hdev->le_max_rx_len = le16_to_cpu(rp->rx_len); hci_cc_le_read_max_data_len()
1356 hdev->le_max_rx_time = le16_to_cpu(rp->rx_time); hci_cc_le_read_max_data_len()
1359 static void hci_cc_write_le_host_supported(struct hci_dev *hdev, hci_cc_write_le_host_supported() argument
1365 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_le_host_supported()
1370 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED); hci_cc_write_le_host_supported()
1374 hci_dev_lock(hdev); hci_cc_write_le_host_supported()
1377 hdev->features[1][0] |= LMP_HOST_LE; hci_cc_write_le_host_supported()
1378 hci_dev_set_flag(hdev, HCI_LE_ENABLED); hci_cc_write_le_host_supported()
1380 hdev->features[1][0] &= ~LMP_HOST_LE; hci_cc_write_le_host_supported()
1381 hci_dev_clear_flag(hdev, HCI_LE_ENABLED); hci_cc_write_le_host_supported()
1382 hci_dev_clear_flag(hdev, HCI_ADVERTISING); hci_cc_write_le_host_supported()
1386 hdev->features[1][0] |= LMP_HOST_LE_BREDR; hci_cc_write_le_host_supported()
1388 hdev->features[1][0] &= ~LMP_HOST_LE_BREDR; hci_cc_write_le_host_supported()
1390 hci_dev_unlock(hdev); hci_cc_write_le_host_supported()
1393 static void hci_cc_set_adv_param(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_set_adv_param() argument
1398 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_set_adv_param()
1403 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_PARAM); hci_cc_set_adv_param()
1407 hci_dev_lock(hdev); hci_cc_set_adv_param()
1408 hdev->adv_addr_type = cp->own_address_type; hci_cc_set_adv_param()
1409 hci_dev_unlock(hdev); hci_cc_set_adv_param()
1412 static void hci_cc_write_remote_amp_assoc(struct hci_dev *hdev, hci_cc_write_remote_amp_assoc() argument
1418 hdev->name, rp->status, rp->phy_handle); hci_cc_write_remote_amp_assoc()
1423 amp_write_rem_assoc_continue(hdev, rp->phy_handle); hci_cc_write_remote_amp_assoc()
1426 static void hci_cc_read_rssi(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_rssi() argument
1431 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_rssi()
1436 hci_dev_lock(hdev); hci_cc_read_rssi()
1438 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_read_rssi()
1442 hci_dev_unlock(hdev); hci_cc_read_rssi()
1445 static void hci_cc_read_tx_power(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_read_tx_power() argument
1451 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); hci_cc_read_tx_power()
1456 sent = hci_sent_cmd_data(hdev, HCI_OP_READ_TX_POWER); hci_cc_read_tx_power()
1460 hci_dev_lock(hdev); hci_cc_read_tx_power()
1462 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); hci_cc_read_tx_power()
1476 hci_dev_unlock(hdev); hci_cc_read_tx_power()
1479 static void hci_cc_write_ssp_debug_mode(struct hci_dev *hdev, struct sk_buff *skb) hci_cc_write_ssp_debug_mode() argument
1484 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cc_write_ssp_debug_mode()
1489 mode = hci_sent_cmd_data(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE); hci_cc_write_ssp_debug_mode()
1491 hdev->ssp_debug_mode = *mode; hci_cc_write_ssp_debug_mode()
1494 static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) hci_cs_inquiry() argument
1496 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_inquiry()
1499 hci_conn_check_pending(hdev); hci_cs_inquiry()
1503 set_bit(HCI_INQUIRY, &hdev->flags); hci_cs_inquiry()
1506 static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) hci_cs_create_conn() argument
1511 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_create_conn()
1513 cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_CONN); hci_cs_create_conn()
1517 hci_dev_lock(hdev); hci_cs_create_conn()
1519 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); hci_cs_create_conn()
1521 BT_DBG("%s bdaddr %pMR hcon %p", hdev->name, &cp->bdaddr, conn); hci_cs_create_conn()
1534 conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr, hci_cs_create_conn()
1541 hci_dev_unlock(hdev); hci_cs_create_conn()
1544 static void hci_cs_add_sco(struct hci_dev *hdev, __u8 status) hci_cs_add_sco() argument
1550 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_add_sco()
1555 cp = hci_sent_cmd_data(hdev, HCI_OP_ADD_SCO); hci_cs_add_sco()
1561 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); hci_cs_add_sco()
1563 hci_dev_lock(hdev); hci_cs_add_sco()
1565 acl = hci_conn_hash_lookup_handle(hdev, handle); hci_cs_add_sco()
1576 hci_dev_unlock(hdev); hci_cs_add_sco()
1579 static void hci_cs_auth_requested(struct hci_dev *hdev, __u8 status) hci_cs_auth_requested() argument
1584 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_auth_requested()
1589 cp = hci_sent_cmd_data(hdev, HCI_OP_AUTH_REQUESTED); hci_cs_auth_requested()
1593 hci_dev_lock(hdev); hci_cs_auth_requested()
1595 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_auth_requested()
1603 hci_dev_unlock(hdev); hci_cs_auth_requested()
1606 static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status) hci_cs_set_conn_encrypt() argument
1611 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_set_conn_encrypt()
1616 cp = hci_sent_cmd_data(hdev, HCI_OP_SET_CONN_ENCRYPT); hci_cs_set_conn_encrypt()
1620 hci_dev_lock(hdev); hci_cs_set_conn_encrypt()
1622 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_set_conn_encrypt()
1630 hci_dev_unlock(hdev); hci_cs_set_conn_encrypt()
1633 static int hci_outgoing_auth_needed(struct hci_dev *hdev, hci_outgoing_auth_needed() argument
1655 static int hci_resolve_name(struct hci_dev *hdev, hci_resolve_name() argument
1667 return hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); hci_resolve_name()
1670 static bool hci_resolve_next_name(struct hci_dev *hdev) hci_resolve_next_name() argument
1672 struct discovery_state *discov = &hdev->discovery; hci_resolve_next_name()
1678 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); hci_resolve_next_name()
1682 if (hci_resolve_name(hdev, e) == 0) { hci_resolve_next_name()
1690 static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, hci_check_pending_name() argument
1693 struct discovery_state *discov = &hdev->discovery; hci_check_pending_name()
1704 mgmt_device_connected(hdev, conn, 0, name, name_len); hci_check_pending_name()
1715 e = hci_inquiry_cache_lookup_resolve(hdev, bdaddr, NAME_PENDING); hci_check_pending_name()
1726 mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, hci_check_pending_name()
1732 if (hci_resolve_next_name(hdev)) hci_check_pending_name()
1736 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_check_pending_name()
1739 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) hci_cs_remote_name_req() argument
1744 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_remote_name_req()
1751 cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ); hci_cs_remote_name_req()
1755 hci_dev_lock(hdev); hci_cs_remote_name_req()
1757 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); hci_cs_remote_name_req()
1759 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_cs_remote_name_req()
1760 hci_check_pending_name(hdev, conn, &cp->bdaddr, NULL, 0); hci_cs_remote_name_req()
1765 if (!hci_outgoing_auth_needed(hdev, conn)) hci_cs_remote_name_req()
1774 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, hci_cs_remote_name_req()
1779 hci_dev_unlock(hdev); hci_cs_remote_name_req()
1782 static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status) hci_cs_read_remote_features() argument
1787 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_read_remote_features()
1792 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_FEATURES); hci_cs_read_remote_features()
1796 hci_dev_lock(hdev); hci_cs_read_remote_features()
1798 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_read_remote_features()
1806 hci_dev_unlock(hdev); hci_cs_read_remote_features()
1809 static void hci_cs_read_remote_ext_features(struct hci_dev *hdev, __u8 status) hci_cs_read_remote_ext_features() argument
1814 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_read_remote_ext_features()
1819 cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES); hci_cs_read_remote_ext_features()
1823 hci_dev_lock(hdev); hci_cs_read_remote_ext_features()
1825 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_read_remote_ext_features()
1833 hci_dev_unlock(hdev); hci_cs_read_remote_ext_features()
1836 static void hci_cs_setup_sync_conn(struct hci_dev *hdev, __u8 status) hci_cs_setup_sync_conn() argument
1842 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_setup_sync_conn()
1847 cp = hci_sent_cmd_data(hdev, HCI_OP_SETUP_SYNC_CONN); hci_cs_setup_sync_conn()
1853 BT_DBG("%s handle 0x%4.4x", hdev->name, handle); hci_cs_setup_sync_conn()
1855 hci_dev_lock(hdev); hci_cs_setup_sync_conn()
1857 acl = hci_conn_hash_lookup_handle(hdev, handle); hci_cs_setup_sync_conn()
1868 hci_dev_unlock(hdev); hci_cs_setup_sync_conn()
1871 static void hci_cs_sniff_mode(struct hci_dev *hdev, __u8 status) hci_cs_sniff_mode() argument
1876 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_sniff_mode()
1881 cp = hci_sent_cmd_data(hdev, HCI_OP_SNIFF_MODE); hci_cs_sniff_mode()
1885 hci_dev_lock(hdev); hci_cs_sniff_mode()
1887 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_sniff_mode()
1895 hci_dev_unlock(hdev); hci_cs_sniff_mode()
1898 static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status) hci_cs_exit_sniff_mode() argument
1903 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_exit_sniff_mode()
1908 cp = hci_sent_cmd_data(hdev, HCI_OP_EXIT_SNIFF_MODE); hci_cs_exit_sniff_mode()
1912 hci_dev_lock(hdev); hci_cs_exit_sniff_mode()
1914 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_exit_sniff_mode()
1922 hci_dev_unlock(hdev); hci_cs_exit_sniff_mode()
1925 static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) hci_cs_disconnect() argument
1933 cp = hci_sent_cmd_data(hdev, HCI_OP_DISCONNECT); hci_cs_disconnect()
1937 hci_dev_lock(hdev); hci_cs_disconnect()
1939 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_disconnect()
1941 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, hci_cs_disconnect()
1944 hci_dev_unlock(hdev); hci_cs_disconnect()
1947 static void hci_cs_create_phylink(struct hci_dev *hdev, u8 status) hci_cs_create_phylink() argument
1951 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_create_phylink()
1953 cp = hci_sent_cmd_data(hdev, HCI_OP_CREATE_PHY_LINK); hci_cs_create_phylink()
1957 hci_dev_lock(hdev); hci_cs_create_phylink()
1962 hcon = hci_conn_hash_lookup_handle(hdev, cp->phy_handle); hci_cs_create_phylink()
1966 amp_write_remote_assoc(hdev, cp->phy_handle); hci_cs_create_phylink()
1969 hci_dev_unlock(hdev); hci_cs_create_phylink()
1972 static void hci_cs_accept_phylink(struct hci_dev *hdev, u8 status) hci_cs_accept_phylink() argument
1976 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_accept_phylink()
1981 cp = hci_sent_cmd_data(hdev, HCI_OP_ACCEPT_PHY_LINK); hci_cs_accept_phylink()
1985 amp_write_remote_assoc(hdev, cp->phy_handle); hci_cs_accept_phylink()
1988 static void hci_cs_le_create_conn(struct hci_dev *hdev, u8 status) hci_cs_le_create_conn() argument
1993 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_le_create_conn()
2002 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CONN); hci_cs_le_create_conn()
2006 hci_dev_lock(hdev); hci_cs_le_create_conn()
2008 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->peer_addr); hci_cs_le_create_conn()
2018 bacpy(&conn->init_addr, &hdev->random_addr); hci_cs_le_create_conn()
2020 bacpy(&conn->init_addr, &hdev->bdaddr); hci_cs_le_create_conn()
2031 queue_delayed_work(conn->hdev->workqueue, hci_cs_le_create_conn()
2036 hci_dev_unlock(hdev); hci_cs_le_create_conn()
2039 static void hci_cs_le_read_remote_features(struct hci_dev *hdev, u8 status) hci_cs_le_read_remote_features() argument
2044 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_le_read_remote_features()
2049 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_READ_REMOTE_FEATURES); hci_cs_le_read_remote_features()
2053 hci_dev_lock(hdev); hci_cs_le_read_remote_features()
2055 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_le_read_remote_features()
2063 hci_dev_unlock(hdev); hci_cs_le_read_remote_features()
2066 static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status) hci_cs_le_start_enc() argument
2071 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_le_start_enc()
2076 hci_dev_lock(hdev); hci_cs_le_start_enc()
2078 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_START_ENC); hci_cs_le_start_enc()
2082 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); hci_cs_le_start_enc()
2093 hci_dev_unlock(hdev); hci_cs_le_start_enc()
2096 static void hci_cs_switch_role(struct hci_dev *hdev, u8 status) hci_cs_switch_role() argument
2101 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_cs_switch_role()
2106 cp = hci_sent_cmd_data(hdev, HCI_OP_SWITCH_ROLE); hci_cs_switch_role()
2110 hci_dev_lock(hdev); hci_cs_switch_role()
2112 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); hci_cs_switch_role()
2116 hci_dev_unlock(hdev); hci_cs_switch_role()
2119 static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_inquiry_complete_evt() argument
2122 struct discovery_state *discov = &hdev->discovery; hci_inquiry_complete_evt()
2125 BT_DBG("%s status 0x%2.2x", hdev->name, status); hci_inquiry_complete_evt()
2127 hci_conn_check_pending(hdev); hci_inquiry_complete_evt()
2129 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) hci_inquiry_complete_evt()
2133 wake_up_bit(&hdev->flags, HCI_INQUIRY); hci_inquiry_complete_evt()
2135 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_inquiry_complete_evt()
2138 hci_dev_lock(hdev); hci_inquiry_complete_evt()
2151 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) || hci_inquiry_complete_evt()
2152 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) hci_inquiry_complete_evt()
2153 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_inquiry_complete_evt()
2157 e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, NAME_NEEDED); hci_inquiry_complete_evt()
2158 if (e && hci_resolve_name(hdev, e) == 0) { hci_inquiry_complete_evt()
2160 hci_discovery_set_state(hdev, DISCOVERY_RESOLVING); hci_inquiry_complete_evt()
2169 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN) || hci_inquiry_complete_evt()
2170 !test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks)) hci_inquiry_complete_evt()
2171 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_inquiry_complete_evt()
2175 hci_dev_unlock(hdev); hci_inquiry_complete_evt()
2178 static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_inquiry_result_evt() argument
2184 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); hci_inquiry_result_evt()
2189 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) hci_inquiry_result_evt()
2192 hci_dev_lock(hdev); hci_inquiry_result_evt()
2206 flags = hci_inquiry_cache_update(hdev, &data, false); hci_inquiry_result_evt()
2208 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, hci_inquiry_result_evt()
2213 hci_dev_unlock(hdev); hci_inquiry_result_evt()
2216 static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_conn_complete_evt() argument
2221 BT_DBG("%s", hdev->name); hci_conn_complete_evt()
2223 hci_dev_lock(hdev); hci_conn_complete_evt()
2225 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); hci_conn_complete_evt()
2230 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); hci_conn_complete_evt()
2245 !hci_find_link_key(hdev, &ev->bdaddr)) hci_conn_complete_evt()
2255 if (test_bit(HCI_AUTH, &hdev->flags)) hci_conn_complete_evt()
2258 if (test_bit(HCI_ENCRYPT, &hdev->flags)) hci_conn_complete_evt()
2265 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, hci_conn_complete_evt()
2268 hci_update_page_scan(hdev); hci_conn_complete_evt()
2272 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) { hci_conn_complete_evt()
2276 hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), hci_conn_complete_evt()
2282 mgmt_connect_failed(hdev, &conn->dst, conn->type, hci_conn_complete_evt()
2296 hci_dev_unlock(hdev); hci_conn_complete_evt()
2298 hci_conn_check_pending(hdev); hci_conn_complete_evt()
2301 static void hci_reject_conn(struct hci_dev *hdev, bdaddr_t *bdaddr) hci_reject_conn() argument
2307 hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp); hci_reject_conn()
2310 static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_conn_request_evt() argument
2313 int mask = hdev->link_mode; hci_conn_request_evt()
2318 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, hci_conn_request_evt()
2321 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, hci_conn_request_evt()
2325 hci_reject_conn(hdev, &ev->bdaddr); hci_conn_request_evt()
2329 if (hci_bdaddr_list_lookup(&hdev->blacklist, &ev->bdaddr, hci_conn_request_evt()
2331 hci_reject_conn(hdev, &ev->bdaddr); hci_conn_request_evt()
2339 if (hci_dev_test_flag(hdev, HCI_MGMT) && hci_conn_request_evt()
2340 !hci_dev_test_flag(hdev, HCI_CONNECTABLE) && hci_conn_request_evt()
2341 !hci_bdaddr_list_lookup(&hdev->whitelist, &ev->bdaddr, hci_conn_request_evt()
2343 hci_reject_conn(hdev, &ev->bdaddr); hci_conn_request_evt()
2349 hci_dev_lock(hdev); hci_conn_request_evt()
2351 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); hci_conn_request_evt()
2355 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, hci_conn_request_evt()
2358 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr, hci_conn_request_evt()
2362 hci_dev_unlock(hdev); hci_conn_request_evt()
2369 hci_dev_unlock(hdev); hci_conn_request_evt()
2372 (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { hci_conn_request_evt()
2378 if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) hci_conn_request_evt()
2383 hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); hci_conn_request_evt()
2394 cp.content_format = cpu_to_le16(hdev->voice_setting); hci_conn_request_evt()
2397 hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, sizeof(cp), hci_conn_request_evt()
2421 static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_disconn_complete_evt() argument
2430 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_disconn_complete_evt()
2432 hci_dev_lock(hdev); hci_disconn_complete_evt()
2434 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_disconn_complete_evt()
2439 mgmt_disconnect_failed(hdev, &conn->dst, conn->type, hci_disconn_complete_evt()
2447 mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type, hci_disconn_complete_evt()
2452 hci_remove_link_key(hdev, &conn->dst); hci_disconn_complete_evt()
2454 hci_update_page_scan(hdev); hci_disconn_complete_evt()
2457 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); hci_disconn_complete_evt()
2468 list_add(&params->action, &hdev->pend_le_conns); hci_disconn_complete_evt()
2469 hci_update_background_scan(hdev); hci_disconn_complete_evt()
2493 mgmt_reenable_advertising(hdev); hci_disconn_complete_evt()
2496 hci_dev_unlock(hdev); hci_disconn_complete_evt()
2499 static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_auth_complete_evt() argument
2504 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_auth_complete_evt()
2506 hci_dev_lock(hdev); hci_auth_complete_evt()
2508 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_auth_complete_evt()
2532 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), hci_auth_complete_evt()
2552 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), hci_auth_complete_evt()
2561 hci_dev_unlock(hdev); hci_auth_complete_evt()
2564 static void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_remote_name_evt() argument
2569 BT_DBG("%s", hdev->name); hci_remote_name_evt()
2571 hci_conn_check_pending(hdev); hci_remote_name_evt()
2573 hci_dev_lock(hdev); hci_remote_name_evt()
2575 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_remote_name_evt()
2577 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_remote_name_evt()
2581 hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, hci_remote_name_evt()
2584 hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); hci_remote_name_evt()
2590 if (!hci_outgoing_auth_needed(hdev, conn)) hci_remote_name_evt()
2599 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); hci_remote_name_evt()
2603 hci_dev_unlock(hdev); hci_remote_name_evt()
2606 static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_encrypt_change_evt() argument
2611 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_encrypt_change_evt()
2613 hci_dev_lock(hdev); hci_encrypt_change_evt()
2615 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_encrypt_change_evt()
2643 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); hci_encrypt_change_evt()
2661 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && hci_encrypt_change_evt()
2675 hci_dev_unlock(hdev); hci_encrypt_change_evt()
2678 static void hci_change_link_key_complete_evt(struct hci_dev *hdev, hci_change_link_key_complete_evt() argument
2684 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_change_link_key_complete_evt()
2686 hci_dev_lock(hdev); hci_change_link_key_complete_evt()
2688 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_change_link_key_complete_evt()
2698 hci_dev_unlock(hdev); hci_change_link_key_complete_evt()
2701 static void hci_remote_features_evt(struct hci_dev *hdev, hci_remote_features_evt() argument
2707 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_remote_features_evt()
2709 hci_dev_lock(hdev); hci_remote_features_evt()
2711 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_remote_features_evt()
2721 if (!ev->status && lmp_ext_feat_capable(hdev) && hci_remote_features_evt()
2726 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES, hci_remote_features_evt()
2736 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); hci_remote_features_evt()
2738 mgmt_device_connected(hdev, conn, 0, NULL, 0); hci_remote_features_evt()
2740 if (!hci_outgoing_auth_needed(hdev, conn)) { hci_remote_features_evt()
2747 hci_dev_unlock(hdev); hci_remote_features_evt()
2750 static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, hci_cmd_complete_evt() argument
2764 hci_cc_inquiry_cancel(hdev, skb); hci_cmd_complete_evt()
2768 hci_cc_periodic_inq(hdev, skb); hci_cmd_complete_evt()
2772 hci_cc_exit_periodic_inq(hdev, skb); hci_cmd_complete_evt()
2776 hci_cc_remote_name_req_cancel(hdev, skb); hci_cmd_complete_evt()
2780 hci_cc_role_discovery(hdev, skb); hci_cmd_complete_evt()
2784 hci_cc_read_link_policy(hdev, skb); hci_cmd_complete_evt()
2788 hci_cc_write_link_policy(hdev, skb); hci_cmd_complete_evt()
2792 hci_cc_read_def_link_policy(hdev, skb); hci_cmd_complete_evt()
2796 hci_cc_write_def_link_policy(hdev, skb); hci_cmd_complete_evt()
2800 hci_cc_reset(hdev, skb); hci_cmd_complete_evt()
2804 hci_cc_read_stored_link_key(hdev, skb); hci_cmd_complete_evt()
2808 hci_cc_delete_stored_link_key(hdev, skb); hci_cmd_complete_evt()
2812 hci_cc_write_local_name(hdev, skb); hci_cmd_complete_evt()
2816 hci_cc_read_local_name(hdev, skb); hci_cmd_complete_evt()
2820 hci_cc_write_auth_enable(hdev, skb); hci_cmd_complete_evt()
2824 hci_cc_write_encrypt_mode(hdev, skb); hci_cmd_complete_evt()
2828 hci_cc_write_scan_enable(hdev, skb); hci_cmd_complete_evt()
2832 hci_cc_read_class_of_dev(hdev, skb); hci_cmd_complete_evt()
2836 hci_cc_write_class_of_dev(hdev, skb); hci_cmd_complete_evt()
2840 hci_cc_read_voice_setting(hdev, skb); hci_cmd_complete_evt()
2844 hci_cc_write_voice_setting(hdev, skb); hci_cmd_complete_evt()
2848 hci_cc_read_num_supported_iac(hdev, skb); hci_cmd_complete_evt()
2852 hci_cc_write_ssp_mode(hdev, skb); hci_cmd_complete_evt()
2856 hci_cc_write_sc_support(hdev, skb); hci_cmd_complete_evt()
2860 hci_cc_read_local_version(hdev, skb); hci_cmd_complete_evt()
2864 hci_cc_read_local_commands(hdev, skb); hci_cmd_complete_evt()
2868 hci_cc_read_local_features(hdev, skb); hci_cmd_complete_evt()
2872 hci_cc_read_local_ext_features(hdev, skb); hci_cmd_complete_evt()
2876 hci_cc_read_buffer_size(hdev, skb); hci_cmd_complete_evt()
2880 hci_cc_read_bd_addr(hdev, skb); hci_cmd_complete_evt()
2884 hci_cc_read_page_scan_activity(hdev, skb); hci_cmd_complete_evt()
2888 hci_cc_write_page_scan_activity(hdev, skb); hci_cmd_complete_evt()
2892 hci_cc_read_page_scan_type(hdev, skb); hci_cmd_complete_evt()
2896 hci_cc_write_page_scan_type(hdev, skb); hci_cmd_complete_evt()
2900 hci_cc_read_data_block_size(hdev, skb); hci_cmd_complete_evt()
2904 hci_cc_read_flow_control_mode(hdev, skb); hci_cmd_complete_evt()
2908 hci_cc_read_local_amp_info(hdev, skb); hci_cmd_complete_evt()
2912 hci_cc_read_clock(hdev, skb); hci_cmd_complete_evt()
2916 hci_cc_read_local_amp_assoc(hdev, skb); hci_cmd_complete_evt()
2920 hci_cc_read_inq_rsp_tx_power(hdev, skb); hci_cmd_complete_evt()
2924 hci_cc_pin_code_reply(hdev, skb); hci_cmd_complete_evt()
2928 hci_cc_pin_code_neg_reply(hdev, skb); hci_cmd_complete_evt()
2932 hci_cc_read_local_oob_data(hdev, skb); hci_cmd_complete_evt()
2936 hci_cc_read_local_oob_ext_data(hdev, skb); hci_cmd_complete_evt()
2940 hci_cc_le_read_buffer_size(hdev, skb); hci_cmd_complete_evt()
2944 hci_cc_le_read_local_features(hdev, skb); hci_cmd_complete_evt()
2948 hci_cc_le_read_adv_tx_power(hdev, skb); hci_cmd_complete_evt()
2952 hci_cc_user_confirm_reply(hdev, skb); hci_cmd_complete_evt()
2956 hci_cc_user_confirm_neg_reply(hdev, skb); hci_cmd_complete_evt()
2960 hci_cc_user_passkey_reply(hdev, skb); hci_cmd_complete_evt()
2964 hci_cc_user_passkey_neg_reply(hdev, skb); hci_cmd_complete_evt()
2968 hci_cc_le_set_random_addr(hdev, skb); hci_cmd_complete_evt()
2972 hci_cc_le_set_adv_enable(hdev, skb); hci_cmd_complete_evt()
2976 hci_cc_le_set_scan_param(hdev, skb); hci_cmd_complete_evt()
2980 hci_cc_le_set_scan_enable(hdev, skb); hci_cmd_complete_evt()
2984 hci_cc_le_read_white_list_size(hdev, skb); hci_cmd_complete_evt()
2988 hci_cc_le_clear_white_list(hdev, skb); hci_cmd_complete_evt()
2992 hci_cc_le_add_to_white_list(hdev, skb); hci_cmd_complete_evt()
2996 hci_cc_le_del_from_white_list(hdev, skb); hci_cmd_complete_evt()
3000 hci_cc_le_read_supported_states(hdev, skb); hci_cmd_complete_evt()
3004 hci_cc_le_read_def_data_len(hdev, skb); hci_cmd_complete_evt()
3008 hci_cc_le_write_def_data_len(hdev, skb); hci_cmd_complete_evt()
3012 hci_cc_le_read_max_data_len(hdev, skb); hci_cmd_complete_evt()
3016 hci_cc_write_le_host_supported(hdev, skb); hci_cmd_complete_evt()
3020 hci_cc_set_adv_param(hdev, skb); hci_cmd_complete_evt()
3024 hci_cc_write_remote_amp_assoc(hdev, skb); hci_cmd_complete_evt()
3028 hci_cc_read_rssi(hdev, skb); hci_cmd_complete_evt()
3032 hci_cc_read_tx_power(hdev, skb); hci_cmd_complete_evt()
3036 hci_cc_write_ssp_debug_mode(hdev, skb); hci_cmd_complete_evt()
3040 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); hci_cmd_complete_evt()
3045 cancel_delayed_work(&hdev->cmd_timer); hci_cmd_complete_evt()
3047 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) hci_cmd_complete_evt()
3048 atomic_set(&hdev->cmd_cnt, 1); hci_cmd_complete_evt()
3050 hci_req_cmd_complete(hdev, *opcode, *status, req_complete, hci_cmd_complete_evt()
3053 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) hci_cmd_complete_evt()
3054 queue_work(hdev->workqueue, &hdev->cmd_work); hci_cmd_complete_evt()
3057 static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, hci_cmd_status_evt() argument
3071 hci_cs_inquiry(hdev, ev->status); hci_cmd_status_evt()
3075 hci_cs_create_conn(hdev, ev->status); hci_cmd_status_evt()
3079 hci_cs_disconnect(hdev, ev->status); hci_cmd_status_evt()
3083 hci_cs_add_sco(hdev, ev->status); hci_cmd_status_evt()
3087 hci_cs_auth_requested(hdev, ev->status); hci_cmd_status_evt()
3091 hci_cs_set_conn_encrypt(hdev, ev->status); hci_cmd_status_evt()
3095 hci_cs_remote_name_req(hdev, ev->status); hci_cmd_status_evt()
3099 hci_cs_read_remote_features(hdev, ev->status); hci_cmd_status_evt()
3103 hci_cs_read_remote_ext_features(hdev, ev->status); hci_cmd_status_evt()
3107 hci_cs_setup_sync_conn(hdev, ev->status); hci_cmd_status_evt()
3111 hci_cs_create_phylink(hdev, ev->status); hci_cmd_status_evt()
3115 hci_cs_accept_phylink(hdev, ev->status); hci_cmd_status_evt()
3119 hci_cs_sniff_mode(hdev, ev->status); hci_cmd_status_evt()
3123 hci_cs_exit_sniff_mode(hdev, ev->status); hci_cmd_status_evt()
3127 hci_cs_switch_role(hdev, ev->status); hci_cmd_status_evt()
3131 hci_cs_le_create_conn(hdev, ev->status); hci_cmd_status_evt()
3135 hci_cs_le_read_remote_features(hdev, ev->status); hci_cmd_status_evt()
3139 hci_cs_le_start_enc(hdev, ev->status); hci_cmd_status_evt()
3143 BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode); hci_cmd_status_evt()
3148 cancel_delayed_work(&hdev->cmd_timer); hci_cmd_status_evt()
3150 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) hci_cmd_status_evt()
3151 atomic_set(&hdev->cmd_cnt, 1); hci_cmd_status_evt()
3160 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->req.event)) hci_cmd_status_evt()
3161 hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete, hci_cmd_status_evt()
3164 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) hci_cmd_status_evt()
3165 queue_work(hdev->workqueue, &hdev->cmd_work); hci_cmd_status_evt()
3168 static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_hardware_error_evt() argument
3172 hdev->hw_error_code = ev->code; hci_hardware_error_evt()
3174 queue_work(hdev->req_workqueue, &hdev->error_reset); hci_hardware_error_evt()
3177 static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_role_change_evt() argument
3182 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_role_change_evt()
3184 hci_dev_lock(hdev); hci_role_change_evt()
3186 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_role_change_evt()
3196 hci_dev_unlock(hdev); hci_role_change_evt()
3199 static void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_num_comp_pkts_evt() argument
3204 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { hci_num_comp_pkts_evt()
3205 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode); hci_num_comp_pkts_evt()
3211 BT_DBG("%s bad parameters", hdev->name); hci_num_comp_pkts_evt()
3215 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl); hci_num_comp_pkts_evt()
3225 conn = hci_conn_hash_lookup_handle(hdev, handle); hci_num_comp_pkts_evt()
3233 hdev->acl_cnt += count; hci_num_comp_pkts_evt()
3234 if (hdev->acl_cnt > hdev->acl_pkts) hci_num_comp_pkts_evt()
3235 hdev->acl_cnt = hdev->acl_pkts; hci_num_comp_pkts_evt()
3239 if (hdev->le_pkts) { hci_num_comp_pkts_evt()
3240 hdev->le_cnt += count; hci_num_comp_pkts_evt()
3241 if (hdev->le_cnt > hdev->le_pkts) hci_num_comp_pkts_evt()
3242 hdev->le_cnt = hdev->le_pkts; hci_num_comp_pkts_evt()
3244 hdev->acl_cnt += count; hci_num_comp_pkts_evt()
3245 if (hdev->acl_cnt > hdev->acl_pkts) hci_num_comp_pkts_evt()
3246 hdev->acl_cnt = hdev->acl_pkts; hci_num_comp_pkts_evt()
3251 hdev->sco_cnt += count; hci_num_comp_pkts_evt()
3252 if (hdev->sco_cnt > hdev->sco_pkts) hci_num_comp_pkts_evt()
3253 hdev->sco_cnt = hdev->sco_pkts; hci_num_comp_pkts_evt()
3262 queue_work(hdev->workqueue, &hdev->tx_work); hci_num_comp_pkts_evt()
3265 static struct hci_conn *__hci_conn_lookup_handle(struct hci_dev *hdev, __hci_conn_lookup_handle() argument
3270 switch (hdev->dev_type) { __hci_conn_lookup_handle()
3272 return hci_conn_hash_lookup_handle(hdev, handle); __hci_conn_lookup_handle()
3274 chan = hci_chan_lookup_handle(hdev, handle); __hci_conn_lookup_handle()
3279 BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type); __hci_conn_lookup_handle()
3286 static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_num_comp_blocks_evt() argument
3291 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { hci_num_comp_blocks_evt()
3292 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode); hci_num_comp_blocks_evt()
3298 BT_DBG("%s bad parameters", hdev->name); hci_num_comp_blocks_evt()
3302 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, hci_num_comp_blocks_evt()
3313 conn = __hci_conn_lookup_handle(hdev, handle); hci_num_comp_blocks_evt()
3322 hdev->block_cnt += block_count; hci_num_comp_blocks_evt()
3323 if (hdev->block_cnt > hdev->num_blocks) hci_num_comp_blocks_evt()
3324 hdev->block_cnt = hdev->num_blocks; hci_num_comp_blocks_evt()
3333 queue_work(hdev->workqueue, &hdev->tx_work); hci_num_comp_blocks_evt()
3336 static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_mode_change_evt() argument
3341 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_mode_change_evt()
3343 hci_dev_lock(hdev); hci_mode_change_evt()
3345 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_mode_change_evt()
3361 hci_dev_unlock(hdev); hci_mode_change_evt()
3364 static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_pin_code_request_evt() argument
3369 BT_DBG("%s", hdev->name); hci_pin_code_request_evt()
3371 hci_dev_lock(hdev); hci_pin_code_request_evt()
3373 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_pin_code_request_evt()
3383 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && hci_pin_code_request_evt()
3385 hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, hci_pin_code_request_evt()
3387 } else if (hci_dev_test_flag(hdev, HCI_MGMT)) { hci_pin_code_request_evt()
3395 mgmt_pin_code_request(hdev, &ev->bdaddr, secure); hci_pin_code_request_evt()
3399 hci_dev_unlock(hdev); hci_pin_code_request_evt()
3434 static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_link_key_request_evt() argument
3441 BT_DBG("%s", hdev->name); hci_link_key_request_evt()
3443 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_link_key_request_evt()
3446 hci_dev_lock(hdev); hci_link_key_request_evt()
3448 key = hci_find_link_key(hdev, &ev->bdaddr); hci_link_key_request_evt()
3450 BT_DBG("%s link key not found for %pMR", hdev->name, hci_link_key_request_evt()
3455 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type, hci_link_key_request_evt()
3458 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_link_key_request_evt()
3465 BT_DBG("%s ignoring unauthenticated key", hdev->name); hci_link_key_request_evt()
3473 hdev->name); hci_link_key_request_evt()
3483 hci_send_cmd(hdev, HCI_OP_LINK_KEY_REPLY, sizeof(cp), &cp); hci_link_key_request_evt()
3485 hci_dev_unlock(hdev); hci_link_key_request_evt()
3490 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); hci_link_key_request_evt()
3491 hci_dev_unlock(hdev); hci_link_key_request_evt()
3494 static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_link_key_notify_evt() argument
3502 BT_DBG("%s", hdev->name); hci_link_key_notify_evt()
3504 hci_dev_lock(hdev); hci_link_key_notify_evt()
3506 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_link_key_notify_evt()
3517 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_link_key_notify_evt()
3520 key = hci_add_link_key(hdev, conn, &ev->bdaddr, ev->link_key, hci_link_key_notify_evt()
3531 mgmt_new_link_key(hdev, key, persistent); hci_link_key_notify_evt()
3539 !hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS)) { hci_link_key_notify_evt()
3551 hci_dev_unlock(hdev); hci_link_key_notify_evt()
3554 static void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_clock_offset_evt() argument
3559 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_clock_offset_evt()
3561 hci_dev_lock(hdev); hci_clock_offset_evt()
3563 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_clock_offset_evt()
3567 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); hci_clock_offset_evt()
3574 hci_dev_unlock(hdev); hci_clock_offset_evt()
3577 static void hci_pkt_type_change_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_pkt_type_change_evt() argument
3582 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_pkt_type_change_evt()
3584 hci_dev_lock(hdev); hci_pkt_type_change_evt()
3586 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_pkt_type_change_evt()
3590 hci_dev_unlock(hdev); hci_pkt_type_change_evt()
3593 static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_pscan_rep_mode_evt() argument
3598 BT_DBG("%s", hdev->name); hci_pscan_rep_mode_evt()
3600 hci_dev_lock(hdev); hci_pscan_rep_mode_evt()
3602 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); hci_pscan_rep_mode_evt()
3608 hci_dev_unlock(hdev); hci_pscan_rep_mode_evt()
3611 static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, hci_inquiry_result_with_rssi_evt() argument
3617 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); hci_inquiry_result_with_rssi_evt()
3622 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) hci_inquiry_result_with_rssi_evt()
3625 hci_dev_lock(hdev); hci_inquiry_result_with_rssi_evt()
3643 flags = hci_inquiry_cache_update(hdev, &data, false); hci_inquiry_result_with_rssi_evt()
3645 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, hci_inquiry_result_with_rssi_evt()
3664 flags = hci_inquiry_cache_update(hdev, &data, false); hci_inquiry_result_with_rssi_evt()
3666 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, hci_inquiry_result_with_rssi_evt()
3672 hci_dev_unlock(hdev); hci_inquiry_result_with_rssi_evt()
3675 static void hci_remote_ext_features_evt(struct hci_dev *hdev, hci_remote_ext_features_evt() argument
3681 BT_DBG("%s", hdev->name); hci_remote_ext_features_evt()
3683 hci_dev_lock(hdev); hci_remote_ext_features_evt()
3685 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_remote_ext_features_evt()
3695 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); hci_remote_ext_features_evt()
3725 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); hci_remote_ext_features_evt()
3727 mgmt_device_connected(hdev, conn, 0, NULL, 0); hci_remote_ext_features_evt()
3729 if (!hci_outgoing_auth_needed(hdev, conn)) { hci_remote_ext_features_evt()
3736 hci_dev_unlock(hdev); hci_remote_ext_features_evt()
3739 static void hci_sync_conn_complete_evt(struct hci_dev *hdev, hci_sync_conn_complete_evt() argument
3745 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_sync_conn_complete_evt()
3747 hci_dev_lock(hdev); hci_sync_conn_complete_evt()
3749 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); hci_sync_conn_complete_evt()
3754 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr); hci_sync_conn_complete_evt()
3778 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | hci_sync_conn_complete_evt()
3779 (hdev->esco_type & EDR_ESCO_MASK); hci_sync_conn_complete_evt()
3795 hci_dev_unlock(hdev); hci_sync_conn_complete_evt()
3815 static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, hci_extended_inquiry_result_evt() argument
3823 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); hci_extended_inquiry_result_evt()
3828 if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) hci_extended_inquiry_result_evt()
3831 hci_dev_lock(hdev); hci_extended_inquiry_result_evt()
3846 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_extended_inquiry_result_evt()
3853 flags = hci_inquiry_cache_update(hdev, &data, name_known); hci_extended_inquiry_result_evt()
3857 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, hci_extended_inquiry_result_evt()
3862 hci_dev_unlock(hdev); hci_extended_inquiry_result_evt()
3865 static void hci_key_refresh_complete_evt(struct hci_dev *hdev, hci_key_refresh_complete_evt() argument
3871 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, hci_key_refresh_complete_evt()
3874 hci_dev_lock(hdev); hci_key_refresh_complete_evt()
3876 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_key_refresh_complete_evt()
3912 hci_dev_unlock(hdev); hci_key_refresh_complete_evt()
3935 struct hci_dev *hdev = conn->hdev; bredr_oob_data_present() local
3938 data = hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR); bredr_oob_data_present()
3942 if (bredr_sc_enabled(hdev)) { bredr_oob_data_present()
3949 if (!hci_dev_test_flag(hdev, HCI_SC_ONLY)) bredr_oob_data_present()
3975 static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_io_capa_request_evt() argument
3980 BT_DBG("%s", hdev->name); hci_io_capa_request_evt()
3982 hci_dev_lock(hdev); hci_io_capa_request_evt()
3984 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_io_capa_request_evt()
3990 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_io_capa_request_evt()
3996 if (hci_dev_test_flag(hdev, HCI_BONDABLE) || hci_io_capa_request_evt()
4022 if (!hci_dev_test_flag(hdev, HCI_BONDABLE)) hci_io_capa_request_evt()
4028 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY, hci_io_capa_request_evt()
4036 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_NEG_REPLY, hci_io_capa_request_evt()
4041 hci_dev_unlock(hdev); hci_io_capa_request_evt()
4044 static void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_io_capa_reply_evt() argument
4049 BT_DBG("%s", hdev->name); hci_io_capa_reply_evt()
4051 hci_dev_lock(hdev); hci_io_capa_reply_evt()
4053 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_io_capa_reply_evt()
4061 hci_dev_unlock(hdev); hci_io_capa_reply_evt()
4064 static void hci_user_confirm_request_evt(struct hci_dev *hdev, hci_user_confirm_request_evt() argument
4071 BT_DBG("%s", hdev->name); hci_user_confirm_request_evt()
4073 hci_dev_lock(hdev); hci_user_confirm_request_evt()
4075 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_user_confirm_request_evt()
4078 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_user_confirm_request_evt()
4093 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY, hci_user_confirm_request_evt()
4117 hdev->auto_accept_delay); hci_user_confirm_request_evt()
4119 if (hdev->auto_accept_delay > 0) { hci_user_confirm_request_evt()
4120 int delay = msecs_to_jiffies(hdev->auto_accept_delay); hci_user_confirm_request_evt()
4121 queue_delayed_work(conn->hdev->workqueue, hci_user_confirm_request_evt()
4126 hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY, hci_user_confirm_request_evt()
4132 mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, hci_user_confirm_request_evt()
4136 hci_dev_unlock(hdev); hci_user_confirm_request_evt()
4139 static void hci_user_passkey_request_evt(struct hci_dev *hdev, hci_user_passkey_request_evt() argument
4144 BT_DBG("%s", hdev->name); hci_user_passkey_request_evt()
4146 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_user_passkey_request_evt()
4147 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); hci_user_passkey_request_evt()
4150 static void hci_user_passkey_notify_evt(struct hci_dev *hdev, hci_user_passkey_notify_evt() argument
4156 BT_DBG("%s", hdev->name); hci_user_passkey_notify_evt()
4158 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_user_passkey_notify_evt()
4165 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_user_passkey_notify_evt()
4166 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, hci_user_passkey_notify_evt()
4171 static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_keypress_notify_evt() argument
4176 BT_DBG("%s", hdev->name); hci_keypress_notify_evt()
4178 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_keypress_notify_evt()
4203 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_keypress_notify_evt()
4204 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, hci_keypress_notify_evt()
4209 static void hci_simple_pair_complete_evt(struct hci_dev *hdev, hci_simple_pair_complete_evt() argument
4215 BT_DBG("%s", hdev->name); hci_simple_pair_complete_evt()
4217 hci_dev_lock(hdev); hci_simple_pair_complete_evt()
4219 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_simple_pair_complete_evt()
4237 hci_dev_unlock(hdev); hci_simple_pair_complete_evt()
4240 static void hci_remote_host_features_evt(struct hci_dev *hdev, hci_remote_host_features_evt() argument
4247 BT_DBG("%s", hdev->name); hci_remote_host_features_evt()
4249 hci_dev_lock(hdev); hci_remote_host_features_evt()
4251 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); hci_remote_host_features_evt()
4255 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); hci_remote_host_features_evt()
4259 hci_dev_unlock(hdev); hci_remote_host_features_evt()
4262 static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, hci_remote_oob_data_request_evt() argument
4268 BT_DBG("%s", hdev->name); hci_remote_oob_data_request_evt()
4270 hci_dev_lock(hdev); hci_remote_oob_data_request_evt()
4272 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_remote_oob_data_request_evt()
4275 data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); hci_remote_oob_data_request_evt()
4280 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY, hci_remote_oob_data_request_evt()
4285 if (bredr_sc_enabled(hdev)) { hci_remote_oob_data_request_evt()
4289 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { hci_remote_oob_data_request_evt()
4299 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY, hci_remote_oob_data_request_evt()
4308 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, hci_remote_oob_data_request_evt()
4313 hci_dev_unlock(hdev); hci_remote_oob_data_request_evt()
4316 static void hci_phy_link_complete_evt(struct hci_dev *hdev, hci_phy_link_complete_evt() argument
4322 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, hci_phy_link_complete_evt()
4325 hci_dev_lock(hdev); hci_phy_link_complete_evt()
4327 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); hci_phy_link_complete_evt()
4329 hci_dev_unlock(hdev); hci_phy_link_complete_evt()
4335 hci_dev_unlock(hdev); hci_phy_link_complete_evt()
4353 hci_dev_unlock(hdev); hci_phy_link_complete_evt()
4356 static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_loglink_complete_evt() argument
4364 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, hci_loglink_complete_evt()
4367 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); hci_loglink_complete_evt()
4386 bredr_chan->conn->mtu = hdev->block_mtu; hci_loglink_complete_evt()
4394 static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev, hci_disconn_loglink_complete_evt() argument
4400 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, hci_disconn_loglink_complete_evt()
4406 hci_dev_lock(hdev); hci_disconn_loglink_complete_evt()
4408 hchan = hci_chan_lookup_handle(hdev, le16_to_cpu(ev->handle)); hci_disconn_loglink_complete_evt()
4415 hci_dev_unlock(hdev); hci_disconn_loglink_complete_evt()
4418 static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, hci_disconn_phylink_complete_evt() argument
4424 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_disconn_phylink_complete_evt()
4429 hci_dev_lock(hdev); hci_disconn_phylink_complete_evt()
4431 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); hci_disconn_phylink_complete_evt()
4437 hci_dev_unlock(hdev); hci_disconn_phylink_complete_evt()
4440 static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_le_conn_complete_evt() argument
4448 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_le_conn_complete_evt()
4450 hci_dev_lock(hdev); hci_le_conn_complete_evt()
4455 hci_dev_clear_flag(hdev, HCI_LE_ADV); hci_le_conn_complete_evt()
4457 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); hci_le_conn_complete_evt()
4459 conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr, ev->role); hci_le_conn_complete_evt()
4478 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { hci_le_conn_complete_evt()
4480 bacpy(&conn->init_addr, &hdev->rpa); hci_le_conn_complete_evt()
4482 hci_copy_identity_address(hdev, hci_le_conn_complete_evt()
4495 conn->resp_addr_type = hdev->adv_addr_type; hci_le_conn_complete_evt()
4496 if (hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) hci_le_conn_complete_evt()
4497 bacpy(&conn->resp_addr, &hdev->random_addr); hci_le_conn_complete_evt()
4499 bacpy(&conn->resp_addr, &hdev->bdaddr); hci_le_conn_complete_evt()
4509 conn->le_conn_min_interval = hdev->le_conn_min_interval; hci_le_conn_complete_evt()
4510 conn->le_conn_max_interval = hdev->le_conn_max_interval; hci_le_conn_complete_evt()
4522 irk = hci_get_irk(hdev, &conn->dst, conn->dst_type); hci_le_conn_complete_evt()
4539 if (hci_bdaddr_list_lookup(&hdev->blacklist, &conn->dst, addr_type)) { hci_le_conn_complete_evt()
4545 mgmt_device_connected(hdev, conn, 0, NULL, 0); hci_le_conn_complete_evt()
4569 (hdev->le_features[0] & HCI_LE_SLAVE_FEATURES)) { hci_le_conn_complete_evt()
4574 hci_send_cmd(hdev, HCI_OP_LE_READ_REMOTE_FEATURES, hci_le_conn_complete_evt()
4586 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, hci_le_conn_complete_evt()
4598 hci_update_background_scan(hdev); hci_le_conn_complete_evt()
4599 hci_dev_unlock(hdev); hci_le_conn_complete_evt()
4602 static void hci_le_conn_update_complete_evt(struct hci_dev *hdev, hci_le_conn_update_complete_evt() argument
4608 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_le_conn_update_complete_evt()
4613 hci_dev_lock(hdev); hci_le_conn_update_complete_evt()
4615 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_le_conn_update_complete_evt()
4622 hci_dev_unlock(hdev); hci_le_conn_update_complete_evt()
4625 /* This function requires the caller holds hdev->lock */ check_pending_le_conn()
4626 static struct hci_conn *check_pending_le_conn(struct hci_dev *hdev, check_pending_le_conn() argument
4638 if (hci_bdaddr_list_lookup(&hdev->blacklist, addr, addr_type)) check_pending_le_conn()
4644 if (hdev->conn_hash.le_num_slave > 0) check_pending_le_conn()
4650 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, check_pending_le_conn()
4676 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, check_pending_le_conn()
4705 static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr, process_adv_report() argument
4709 struct discovery_state *d = &hdev->discovery; process_adv_report()
4730 if (!hci_dev_test_flag(hdev, HCI_PRIVACY)) process_adv_report()
4737 if (!smp_irk_matches(hdev, hdev->irk, direct_addr)) process_adv_report()
4742 irk = hci_get_irk(hdev, bdaddr, bdaddr_type); process_adv_report()
4749 conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type); process_adv_report()
4762 if (hdev->le_scan_type == LE_SCAN_PASSIVE) { process_adv_report()
4766 if (!hci_pend_le_action_lookup(&hdev->pend_le_reports, process_adv_report()
4774 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, process_adv_report()
4804 if (!has_pending_adv_report(hdev)) { process_adv_report()
4809 store_pending_adv_report(hdev, bdaddr, bdaddr_type, process_adv_report()
4814 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, process_adv_report()
4830 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, process_adv_report()
4840 store_pending_adv_report(hdev, bdaddr, bdaddr_type, process_adv_report()
4848 clear_pending_adv_report(hdev); process_adv_report()
4849 mgmt_device_found(hdev, bdaddr, LE_LINK, bdaddr_type, NULL, process_adv_report()
4858 mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, process_adv_report()
4861 clear_pending_adv_report(hdev); process_adv_report()
4864 static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_le_adv_report_evt() argument
4869 hci_dev_lock(hdev); hci_le_adv_report_evt()
4876 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, hci_le_adv_report_evt()
4883 hci_dev_unlock(hdev); hci_le_adv_report_evt()
4886 static void hci_le_remote_feat_complete_evt(struct hci_dev *hdev, hci_le_remote_feat_complete_evt() argument
4892 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); hci_le_remote_feat_complete_evt()
4894 hci_dev_lock(hdev); hci_le_remote_feat_complete_evt()
4896 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_le_remote_feat_complete_evt()
4913 if ((hdev->le_features[0] & HCI_LE_SLAVE_FEATURES) && hci_le_remote_feat_complete_evt()
4925 hci_dev_unlock(hdev); hci_le_remote_feat_complete_evt()
4928 static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_le_ltk_request_evt() argument
4936 BT_DBG("%s handle 0x%4.4x", hdev->name, __le16_to_cpu(ev->handle)); hci_le_ltk_request_evt()
4938 hci_dev_lock(hdev); hci_le_ltk_request_evt()
4940 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); hci_le_ltk_request_evt()
4944 ltk = hci_find_ltk(hdev, &conn->dst, conn->dst_type, conn->role); hci_le_ltk_request_evt()
4965 hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); hci_le_ltk_request_evt()
4981 hci_dev_unlock(hdev); hci_le_ltk_request_evt()
4987 hci_send_cmd(hdev, HCI_OP_LE_LTK_NEG_REPLY, sizeof(neg), &neg); hci_le_ltk_request_evt()
4988 hci_dev_unlock(hdev); hci_le_ltk_request_evt()
4991 static void send_conn_param_neg_reply(struct hci_dev *hdev, u16 handle, send_conn_param_neg_reply() argument
4999 hci_send_cmd(hdev, HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY, sizeof(cp), send_conn_param_neg_reply()
5003 static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev, hci_le_remote_conn_param_req_evt() argument
5017 hcon = hci_conn_hash_lookup_handle(hdev, handle); hci_le_remote_conn_param_req_evt()
5019 return send_conn_param_neg_reply(hdev, handle, hci_le_remote_conn_param_req_evt()
5023 return send_conn_param_neg_reply(hdev, handle, hci_le_remote_conn_param_req_evt()
5030 hci_dev_lock(hdev); hci_le_remote_conn_param_req_evt()
5032 params = hci_conn_params_lookup(hdev, &hcon->dst, hci_le_remote_conn_param_req_evt()
5044 hci_dev_unlock(hdev); hci_le_remote_conn_param_req_evt()
5046 mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type, hci_le_remote_conn_param_req_evt()
5058 hci_send_cmd(hdev, HCI_OP_LE_CONN_PARAM_REQ_REPLY, sizeof(cp), &cp); hci_le_remote_conn_param_req_evt()
5061 static void hci_le_direct_adv_report_evt(struct hci_dev *hdev, hci_le_direct_adv_report_evt() argument
5067 hci_dev_lock(hdev); hci_le_direct_adv_report_evt()
5072 process_adv_report(hdev, ev->evt_type, &ev->bdaddr, hci_le_direct_adv_report_evt()
5079 hci_dev_unlock(hdev); hci_le_direct_adv_report_evt()
5082 static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_le_meta_evt() argument
5090 hci_le_conn_complete_evt(hdev, skb); hci_le_meta_evt()
5094 hci_le_conn_update_complete_evt(hdev, skb); hci_le_meta_evt()
5098 hci_le_adv_report_evt(hdev, skb); hci_le_meta_evt()
5102 hci_le_remote_feat_complete_evt(hdev, skb); hci_le_meta_evt()
5106 hci_le_ltk_request_evt(hdev, skb); hci_le_meta_evt()
5110 hci_le_remote_conn_param_req_evt(hdev, skb); hci_le_meta_evt()
5114 hci_le_direct_adv_report_evt(hdev, skb); hci_le_meta_evt()
5122 static void hci_chan_selected_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_chan_selected_evt() argument
5127 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); hci_chan_selected_evt()
5131 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); hci_chan_selected_evt()
5135 amp_read_loc_assoc_final_data(hdev, hcon); hci_chan_selected_evt()
5138 static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode, hci_get_cmd_complete() argument
5183 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) hci_event_packet() argument
5192 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->req.event == event) { hci_event_packet()
5193 struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data; hci_event_packet()
5195 hci_req_cmd_complete(hdev, opcode, status, &req_complete, hci_event_packet()
5213 hci_inquiry_complete_evt(hdev, skb); hci_event_packet()
5217 hci_inquiry_result_evt(hdev, skb); hci_event_packet()
5221 hci_conn_complete_evt(hdev, skb); hci_event_packet()
5225 hci_conn_request_evt(hdev, skb); hci_event_packet()
5229 hci_disconn_complete_evt(hdev, skb); hci_event_packet()
5233 hci_auth_complete_evt(hdev, skb); hci_event_packet()
5237 hci_remote_name_evt(hdev, skb); hci_event_packet()
5241 hci_encrypt_change_evt(hdev, skb); hci_event_packet()
5245 hci_change_link_key_complete_evt(hdev, skb); hci_event_packet()
5249 hci_remote_features_evt(hdev, skb); hci_event_packet()
5253 hci_cmd_complete_evt(hdev, skb, &opcode, &status, hci_event_packet()
5258 hci_cmd_status_evt(hdev, skb, &opcode, &status, &req_complete, hci_event_packet()
5263 hci_hardware_error_evt(hdev, skb); hci_event_packet()
5267 hci_role_change_evt(hdev, skb); hci_event_packet()
5271 hci_num_comp_pkts_evt(hdev, skb); hci_event_packet()
5275 hci_mode_change_evt(hdev, skb); hci_event_packet()
5279 hci_pin_code_request_evt(hdev, skb); hci_event_packet()
5283 hci_link_key_request_evt(hdev, skb); hci_event_packet()
5287 hci_link_key_notify_evt(hdev, skb); hci_event_packet()
5291 hci_clock_offset_evt(hdev, skb); hci_event_packet()
5295 hci_pkt_type_change_evt(hdev, skb); hci_event_packet()
5299 hci_pscan_rep_mode_evt(hdev, skb); hci_event_packet()
5303 hci_inquiry_result_with_rssi_evt(hdev, skb); hci_event_packet()
5307 hci_remote_ext_features_evt(hdev, skb); hci_event_packet()
5311 hci_sync_conn_complete_evt(hdev, skb); hci_event_packet()
5315 hci_extended_inquiry_result_evt(hdev, skb); hci_event_packet()
5319 hci_key_refresh_complete_evt(hdev, skb); hci_event_packet()
5323 hci_io_capa_request_evt(hdev, skb); hci_event_packet()
5327 hci_io_capa_reply_evt(hdev, skb); hci_event_packet()
5331 hci_user_confirm_request_evt(hdev, skb); hci_event_packet()
5335 hci_user_passkey_request_evt(hdev, skb); hci_event_packet()
5339 hci_user_passkey_notify_evt(hdev, skb); hci_event_packet()
5343 hci_keypress_notify_evt(hdev, skb); hci_event_packet()
5347 hci_simple_pair_complete_evt(hdev, skb); hci_event_packet()
5351 hci_remote_host_features_evt(hdev, skb); hci_event_packet()
5355 hci_le_meta_evt(hdev, skb); hci_event_packet()
5359 hci_chan_selected_evt(hdev, skb); hci_event_packet()
5363 hci_remote_oob_data_request_evt(hdev, skb); hci_event_packet()
5367 hci_phy_link_complete_evt(hdev, skb); hci_event_packet()
5371 hci_loglink_complete_evt(hdev, skb); hci_event_packet()
5375 hci_disconn_loglink_complete_evt(hdev, skb); hci_event_packet()
5379 hci_disconn_phylink_complete_evt(hdev, skb); hci_event_packet()
5383 hci_num_comp_blocks_evt(hdev, skb); hci_event_packet()
5387 BT_DBG("%s event 0x%2.2x", hdev->name, event); hci_event_packet()
5392 req_complete(hdev, status, opcode); hci_event_packet()
5394 if (!hci_get_cmd_complete(hdev, opcode, req_evt, orig_skb)) { hci_event_packet()
5398 req_complete_skb(hdev, status, opcode, orig_skb); hci_event_packet()
5403 hdev->stat.evt_rx++; hci_event_packet()
H A Dhci_core.c70 static void hci_notify(struct hci_dev *hdev, int event) hci_notify() argument
72 hci_sock_dev_event(hdev, event); hci_notify()
80 struct hci_dev *hdev = file->private_data; dut_mode_read() local
83 buf[0] = hci_dev_test_flag(hdev, HCI_DUT_MODE) ? 'Y': 'N'; dut_mode_read()
92 struct hci_dev *hdev = file->private_data; dut_mode_write() local
99 if (!test_bit(HCI_UP, &hdev->flags)) dut_mode_write()
109 if (enable == hci_dev_test_flag(hdev, HCI_DUT_MODE)) dut_mode_write()
112 hci_req_lock(hdev); dut_mode_write()
114 skb = __hci_cmd_sync(hdev, HCI_OP_ENABLE_DUT_MODE, 0, NULL, dut_mode_write()
117 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, dut_mode_write()
119 hci_req_unlock(hdev); dut_mode_write()
130 hci_dev_change_flag(hdev, HCI_DUT_MODE); dut_mode_write()
144 static void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode, hci_req_sync_complete() argument
147 BT_DBG("%s result 0x%2.2x", hdev->name, result); hci_req_sync_complete()
149 if (hdev->req_status == HCI_REQ_PEND) { hci_req_sync_complete()
150 hdev->req_result = result; hci_req_sync_complete()
151 hdev->req_status = HCI_REQ_DONE; hci_req_sync_complete()
153 hdev->req_skb = skb_get(skb); hci_req_sync_complete()
154 wake_up_interruptible(&hdev->req_wait_q); hci_req_sync_complete()
158 static void hci_req_cancel(struct hci_dev *hdev, int err) hci_req_cancel() argument
160 BT_DBG("%s err 0x%2.2x", hdev->name, err); hci_req_cancel()
162 if (hdev->req_status == HCI_REQ_PEND) { hci_req_cancel()
163 hdev->req_result = err; hci_req_cancel()
164 hdev->req_status = HCI_REQ_CANCELED; hci_req_cancel()
165 wake_up_interruptible(&hdev->req_wait_q); hci_req_cancel()
169 struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, __hci_cmd_sync_ev() argument
177 BT_DBG("%s", hdev->name); __hci_cmd_sync_ev()
179 hci_req_init(&req, hdev); __hci_cmd_sync_ev()
183 hdev->req_status = HCI_REQ_PEND; __hci_cmd_sync_ev()
185 add_wait_queue(&hdev->req_wait_q, &wait); __hci_cmd_sync_ev()
190 remove_wait_queue(&hdev->req_wait_q, &wait); __hci_cmd_sync_ev()
197 remove_wait_queue(&hdev->req_wait_q, &wait); __hci_cmd_sync_ev()
202 switch (hdev->req_status) { __hci_cmd_sync_ev()
204 err = -bt_to_errno(hdev->req_result); __hci_cmd_sync_ev()
208 err = -hdev->req_result; __hci_cmd_sync_ev()
216 hdev->req_status = hdev->req_result = 0; __hci_cmd_sync_ev()
217 skb = hdev->req_skb; __hci_cmd_sync_ev()
218 hdev->req_skb = NULL; __hci_cmd_sync_ev()
220 BT_DBG("%s end: err %d", hdev->name, err); __hci_cmd_sync_ev()
234 struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, __hci_cmd_sync() argument
237 return __hci_cmd_sync_ev(hdev, opcode, plen, param, 0, timeout); __hci_cmd_sync()
242 static int __hci_req_sync(struct hci_dev *hdev, __hci_req_sync() argument
251 BT_DBG("%s start", hdev->name); __hci_req_sync()
253 hci_req_init(&req, hdev); __hci_req_sync()
255 hdev->req_status = HCI_REQ_PEND; __hci_req_sync()
259 add_wait_queue(&hdev->req_wait_q, &wait); __hci_req_sync()
264 hdev->req_status = 0; __hci_req_sync()
266 remove_wait_queue(&hdev->req_wait_q, &wait); __hci_req_sync()
282 remove_wait_queue(&hdev->req_wait_q, &wait); __hci_req_sync()
287 switch (hdev->req_status) { __hci_req_sync()
289 err = -bt_to_errno(hdev->req_result); __hci_req_sync()
293 err = -hdev->req_result; __hci_req_sync()
301 hdev->req_status = hdev->req_result = 0; __hci_req_sync()
303 BT_DBG("%s end: err %d", hdev->name, err); __hci_req_sync()
308 static int hci_req_sync(struct hci_dev *hdev, hci_req_sync() argument
315 if (!test_bit(HCI_UP, &hdev->flags)) hci_req_sync()
319 hci_req_lock(hdev); hci_req_sync()
320 ret = __hci_req_sync(hdev, req, opt, timeout); hci_req_sync()
321 hci_req_unlock(hdev); hci_req_sync()
328 BT_DBG("%s %ld", req->hdev->name, opt); hci_reset_req()
331 set_bit(HCI_RESET, &req->hdev->flags); hci_reset_req()
337 req->hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_PACKET_BASED; bredr_init()
351 req->hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_BLOCK_BASED; amp_init1()
378 if (req->hdev->commands[14] & 0x20) amp_init2()
384 struct hci_dev *hdev = req->hdev; hci_init1_req() local
386 BT_DBG("%s %ld", hdev->name, opt); hci_init1_req()
389 if (!test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) hci_init1_req()
392 switch (hdev->dev_type) { hci_init1_req()
402 BT_ERR("Unknown device type %d", hdev->dev_type); hci_init1_req()
441 struct hci_dev *hdev = req->hdev; le_setup() local
459 if (!lmp_bredr_capable(hdev)) le_setup()
460 hci_dev_set_flag(hdev, HCI_LE_ENABLED); le_setup()
465 struct hci_dev *hdev = req->hdev; hci_setup_event_mask() local
476 if (hdev->hci_ver < BLUETOOTH_VER_1_2) hci_setup_event_mask()
479 if (lmp_bredr_capable(hdev)) { hci_setup_event_mask()
496 if (hdev->le_features[0] & HCI_LE_ENCRYPTION) { hci_setup_event_mask()
502 if (lmp_inq_rssi_capable(hdev)) hci_setup_event_mask()
505 if (lmp_sniffsubr_capable(hdev)) hci_setup_event_mask()
508 if (lmp_pause_enc_capable(hdev)) hci_setup_event_mask()
511 if (lmp_ext_inq_capable(hdev)) hci_setup_event_mask()
514 if (lmp_no_flush_capable(hdev)) hci_setup_event_mask()
517 if (lmp_lsto_capable(hdev)) hci_setup_event_mask()
520 if (lmp_ssp_capable(hdev)) { hci_setup_event_mask()
534 if (lmp_le_capable(hdev)) hci_setup_event_mask()
542 struct hci_dev *hdev = req->hdev; hci_init2_req() local
544 if (hdev->dev_type == HCI_AMP) hci_init2_req()
547 if (lmp_bredr_capable(hdev)) hci_init2_req()
550 hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED); hci_init2_req()
552 if (lmp_le_capable(hdev)) hci_init2_req()
563 if (hdev->hci_ver > BLUETOOTH_VER_1_1 && hci_init2_req()
564 !test_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks)) hci_init2_req()
567 if (lmp_ssp_capable(hdev)) { hci_init2_req()
574 hdev->max_page = 0x01; hci_init2_req()
576 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { hci_init2_req()
584 memset(hdev->eir, 0, sizeof(hdev->eir)); hci_init2_req()
591 if (lmp_inq_rssi_capable(hdev) || hci_init2_req()
592 test_bit(HCI_QUIRK_FIXUP_INQUIRY_MODE, &hdev->quirks)) { hci_init2_req()
599 mode = lmp_ext_inq_capable(hdev) ? 0x02 : 0x01; hci_init2_req()
604 if (lmp_inq_tx_pwr_capable(hdev)) hci_init2_req()
607 if (lmp_ext_feat_capable(hdev)) { hci_init2_req()
615 if (hci_dev_test_flag(hdev, HCI_LINK_SECURITY)) { hci_init2_req()
624 struct hci_dev *hdev = req->hdev; hci_setup_link_policy() local
628 if (lmp_rswitch_capable(hdev)) hci_setup_link_policy()
630 if (lmp_hold_capable(hdev)) hci_setup_link_policy()
632 if (lmp_sniff_capable(hdev)) hci_setup_link_policy()
634 if (lmp_park_capable(hdev)) hci_setup_link_policy()
643 struct hci_dev *hdev = req->hdev; hci_set_le_support() local
647 if (!lmp_bredr_capable(hdev)) hci_set_le_support()
652 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { hci_set_le_support()
657 if (cp.le != lmp_host_le_capable(hdev)) hci_set_le_support()
664 struct hci_dev *hdev = req->hdev; hci_set_event_mask_page_2() local
670 if (lmp_csb_master_capable(hdev)) { hci_set_event_mask_page_2()
680 if (lmp_csb_slave_capable(hdev)) { hci_set_event_mask_page_2()
688 if (lmp_ping_capable(hdev) || hdev->le_features[0] & HCI_LE_PING) hci_set_event_mask_page_2()
696 struct hci_dev *hdev = req->hdev; hci_init3_req() local
701 if (hdev->commands[6] & 0x20) { hci_init3_req()
709 if (hdev->commands[5] & 0x10) hci_init3_req()
712 if (hdev->commands[8] & 0x01) hci_init3_req()
719 if (hdev->commands[13] & 0x01) hci_init3_req()
722 if (lmp_le_capable(hdev)) { hci_init3_req()
728 if (hdev->le_features[0] & HCI_LE_ENCRYPTION) hci_init3_req()
734 if (hdev->le_features[0] & HCI_LE_CONN_PARAM_REQ_PROC) hci_init3_req()
742 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) hci_init3_req()
748 if (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY) hci_init3_req()
756 if (hdev->commands[34] & 0x02) hci_init3_req()
764 if (hdev->commands[34] & 0x04) hci_init3_req()
770 if (hdev->commands[25] & 0x40) { hci_init3_req()
775 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) { hci_init3_req()
787 for (p = 2; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { hci_init3_req()
798 struct hci_dev *hdev = req->hdev; hci_init4_req() local
813 if (hdev->commands[6] & 0x80 && hci_init4_req()
814 !test_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks)) { hci_init4_req()
824 if (hdev->commands[22] & 0x04) hci_init4_req()
828 if (hdev->commands[29] & 0x20) hci_init4_req()
832 if (hdev->commands[30] & 0x08) hci_init4_req()
836 if (lmp_sync_train_capable(hdev)) hci_init4_req()
840 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED) && hci_init4_req()
841 bredr_sc_enabled(hdev)) { hci_init4_req()
849 static int __hci_init(struct hci_dev *hdev) __hci_init() argument
853 err = __hci_req_sync(hdev, hci_init1_req, 0, HCI_INIT_TIMEOUT); __hci_init()
860 if (hci_dev_test_flag(hdev, HCI_SETUP)) { __hci_init()
861 debugfs_create_file("dut_mode", 0644, hdev->debugfs, hdev, __hci_init()
865 err = __hci_req_sync(hdev, hci_init2_req, 0, HCI_INIT_TIMEOUT); __hci_init()
873 if (hdev->dev_type != HCI_BREDR) __hci_init()
876 err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT); __hci_init()
880 err = __hci_req_sync(hdev, hci_init4_req, 0, HCI_INIT_TIMEOUT); __hci_init()
896 if (!hci_dev_test_flag(hdev, HCI_SETUP) && __hci_init()
897 !hci_dev_test_flag(hdev, HCI_CONFIG)) __hci_init()
900 hci_debugfs_create_common(hdev); __hci_init()
902 if (lmp_bredr_capable(hdev)) __hci_init()
903 hci_debugfs_create_bredr(hdev); __hci_init()
905 if (lmp_le_capable(hdev)) __hci_init()
906 hci_debugfs_create_le(hdev); __hci_init()
913 struct hci_dev *hdev = req->hdev; hci_init0_req() local
915 BT_DBG("%s %ld", hdev->name, opt); hci_init0_req()
918 if (!test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) hci_init0_req()
925 if (hdev->set_bdaddr) hci_init0_req()
929 static int __hci_unconf_init(struct hci_dev *hdev) __hci_unconf_init() argument
933 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) __hci_unconf_init()
936 err = __hci_req_sync(hdev, hci_init0_req, 0, HCI_INIT_TIMEOUT); __hci_unconf_init()
947 BT_DBG("%s %x", req->hdev->name, scan); hci_scan_req()
957 BT_DBG("%s %x", req->hdev->name, auth); hci_auth_req()
967 BT_DBG("%s %x", req->hdev->name, encrypt); hci_encrypt_req()
977 BT_DBG("%s %x", req->hdev->name, policy); hci_linkpol_req()
987 struct hci_dev *hdev = NULL, *d; hci_dev_get() local
997 hdev = hci_dev_hold(d); hci_dev_get()
1002 return hdev; hci_dev_get()
1007 bool hci_discovery_active(struct hci_dev *hdev) hci_discovery_active() argument
1009 struct discovery_state *discov = &hdev->discovery; hci_discovery_active()
1021 void hci_discovery_set_state(struct hci_dev *hdev, int state) hci_discovery_set_state() argument
1023 int old_state = hdev->discovery.state; hci_discovery_set_state()
1025 BT_DBG("%s state %u -> %u", hdev->name, hdev->discovery.state, state); hci_discovery_set_state()
1030 hdev->discovery.state = state; hci_discovery_set_state()
1034 hci_update_background_scan(hdev); hci_discovery_set_state()
1037 mgmt_discovering(hdev, 0); hci_discovery_set_state()
1042 mgmt_discovering(hdev, 1); hci_discovery_set_state()
1051 void hci_inquiry_cache_flush(struct hci_dev *hdev) hci_inquiry_cache_flush() argument
1053 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_flush()
1065 struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, hci_inquiry_cache_lookup() argument
1068 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_lookup()
1081 struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, hci_inquiry_cache_lookup_unknown() argument
1084 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_lookup_unknown()
1097 struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, hci_inquiry_cache_lookup_resolve() argument
1101 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_lookup_resolve()
1116 void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, hci_inquiry_cache_update_resolve() argument
1119 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_update_resolve()
1135 u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, hci_inquiry_cache_update() argument
1138 struct discovery_state *cache = &hdev->discovery; hci_inquiry_cache_update()
1144 hci_remove_remote_oob_data(hdev, &data->bdaddr, BDADDR_BREDR); hci_inquiry_cache_update()
1149 ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); hci_inquiry_cache_update()
1157 hci_inquiry_cache_update_resolve(hdev, ie); hci_inquiry_cache_update()
1197 static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf) inquiry_cache_dump() argument
1199 struct discovery_state *cache = &hdev->discovery; inquiry_cache_dump()
1228 struct hci_dev *hdev = req->hdev; hci_inq_req() local
1231 BT_DBG("%s", hdev->name); hci_inq_req()
1233 if (test_bit(HCI_INQUIRY, &hdev->flags)) hci_inq_req()
1247 struct hci_dev *hdev; hci_inquiry() local
1255 hdev = hci_dev_get(ir.dev_id); hci_inquiry()
1256 if (!hdev) hci_inquiry()
1259 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_inquiry()
1264 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { hci_inquiry()
1269 if (hdev->dev_type != HCI_BREDR) { hci_inquiry()
1274 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { hci_inquiry()
1279 hci_dev_lock(hdev); hci_inquiry()
1280 if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || hci_inquiry()
1281 inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) { hci_inquiry()
1282 hci_inquiry_cache_flush(hdev); hci_inquiry()
1285 hci_dev_unlock(hdev); hci_inquiry()
1290 err = hci_req_sync(hdev, hci_inq_req, (unsigned long) &ir, hci_inquiry()
1298 if (wait_on_bit(&hdev->flags, HCI_INQUIRY, hci_inquiry()
1317 hci_dev_lock(hdev); hci_inquiry()
1318 ir.num_rsp = inquiry_cache_dump(hdev, max_rsp, buf); hci_inquiry()
1319 hci_dev_unlock(hdev); hci_inquiry()
1334 hci_dev_put(hdev); hci_inquiry()
1338 static int hci_dev_do_open(struct hci_dev *hdev) hci_dev_do_open() argument
1342 BT_DBG("%s %p", hdev->name, hdev); hci_dev_do_open()
1344 hci_req_lock(hdev); hci_dev_do_open()
1346 if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) { hci_dev_do_open()
1351 if (!hci_dev_test_flag(hdev, HCI_SETUP) && hci_dev_do_open()
1352 !hci_dev_test_flag(hdev, HCI_CONFIG)) { hci_dev_do_open()
1356 if (hci_dev_test_flag(hdev, HCI_RFKILLED)) { hci_dev_do_open()
1373 if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && hci_dev_do_open()
1374 hdev->dev_type == HCI_BREDR && hci_dev_do_open()
1375 !bacmp(&hdev->bdaddr, BDADDR_ANY) && hci_dev_do_open()
1376 !bacmp(&hdev->static_addr, BDADDR_ANY)) { hci_dev_do_open()
1382 if (test_bit(HCI_UP, &hdev->flags)) { hci_dev_do_open()
1387 if (hdev->open(hdev)) { hci_dev_do_open()
1392 atomic_set(&hdev->cmd_cnt, 1); hci_dev_do_open()
1393 set_bit(HCI_INIT, &hdev->flags); hci_dev_do_open()
1395 if (hci_dev_test_flag(hdev, HCI_SETUP)) { hci_dev_do_open()
1396 if (hdev->setup) hci_dev_do_open()
1397 ret = hdev->setup(hdev); hci_dev_do_open()
1405 if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || hci_dev_do_open()
1406 test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks)) hci_dev_do_open()
1407 hci_dev_set_flag(hdev, HCI_UNCONFIGURED); hci_dev_do_open()
1417 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) hci_dev_do_open()
1418 ret = __hci_unconf_init(hdev); hci_dev_do_open()
1421 if (hci_dev_test_flag(hdev, HCI_CONFIG)) { hci_dev_do_open()
1427 if (bacmp(&hdev->public_addr, BDADDR_ANY) && hci_dev_do_open()
1428 hdev->set_bdaddr) hci_dev_do_open()
1429 ret = hdev->set_bdaddr(hdev, &hdev->public_addr); hci_dev_do_open()
1435 if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && hci_dev_do_open()
1436 !hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) hci_dev_do_open()
1437 ret = __hci_init(hdev); hci_dev_do_open()
1440 clear_bit(HCI_INIT, &hdev->flags); hci_dev_do_open()
1443 hci_dev_hold(hdev); hci_dev_do_open()
1444 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); hci_dev_do_open()
1445 set_bit(HCI_UP, &hdev->flags); hci_dev_do_open()
1446 hci_notify(hdev, HCI_DEV_UP); hci_dev_do_open()
1447 if (!hci_dev_test_flag(hdev, HCI_SETUP) && hci_dev_do_open()
1448 !hci_dev_test_flag(hdev, HCI_CONFIG) && hci_dev_do_open()
1449 !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && hci_dev_do_open()
1450 !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && hci_dev_do_open()
1451 hdev->dev_type == HCI_BREDR) { hci_dev_do_open()
1452 hci_dev_lock(hdev); hci_dev_do_open()
1453 mgmt_powered(hdev, 1); hci_dev_do_open()
1454 hci_dev_unlock(hdev); hci_dev_do_open()
1458 flush_work(&hdev->tx_work); hci_dev_do_open()
1459 flush_work(&hdev->cmd_work); hci_dev_do_open()
1460 flush_work(&hdev->rx_work); hci_dev_do_open()
1462 skb_queue_purge(&hdev->cmd_q); hci_dev_do_open()
1463 skb_queue_purge(&hdev->rx_q); hci_dev_do_open()
1465 if (hdev->flush) hci_dev_do_open()
1466 hdev->flush(hdev); hci_dev_do_open()
1468 if (hdev->sent_cmd) { hci_dev_do_open()
1469 kfree_skb(hdev->sent_cmd); hci_dev_do_open()
1470 hdev->sent_cmd = NULL; hci_dev_do_open()
1473 hdev->close(hdev); hci_dev_do_open()
1474 hdev->flags &= BIT(HCI_RAW); hci_dev_do_open()
1478 hci_req_unlock(hdev); hci_dev_do_open()
1486 struct hci_dev *hdev; hci_dev_open() local
1489 hdev = hci_dev_get(dev); hci_dev_open()
1490 if (!hdev) hci_dev_open()
1502 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && hci_dev_open()
1503 !hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_dev_open()
1513 if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) hci_dev_open()
1514 cancel_delayed_work(&hdev->power_off); hci_dev_open()
1520 flush_workqueue(hdev->req_workqueue); hci_dev_open()
1528 if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && hci_dev_open()
1529 !hci_dev_test_flag(hdev, HCI_MGMT)) hci_dev_open()
1530 hci_dev_set_flag(hdev, HCI_BONDABLE); hci_dev_open()
1532 err = hci_dev_do_open(hdev); hci_dev_open()
1535 hci_dev_put(hdev); hci_dev_open()
1539 /* This function requires the caller holds hdev->lock */ hci_pend_le_actions_clear()
1540 static void hci_pend_le_actions_clear(struct hci_dev *hdev) hci_pend_le_actions_clear() argument
1544 list_for_each_entry(p, &hdev->le_conn_params, list) { hci_pend_le_actions_clear()
1556 static int hci_dev_do_close(struct hci_dev *hdev) hci_dev_do_close() argument
1558 BT_DBG("%s %p", hdev->name, hdev); hci_dev_do_close()
1560 if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && hci_dev_do_close()
1561 test_bit(HCI_UP, &hdev->flags)) { hci_dev_do_close()
1563 if (hdev->shutdown) hci_dev_do_close()
1564 hdev->shutdown(hdev); hci_dev_do_close()
1567 cancel_delayed_work(&hdev->power_off); hci_dev_do_close()
1569 hci_req_cancel(hdev, ENODEV); hci_dev_do_close()
1570 hci_req_lock(hdev); hci_dev_do_close()
1572 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { hci_dev_do_close()
1573 cancel_delayed_work_sync(&hdev->cmd_timer); hci_dev_do_close()
1574 hci_req_unlock(hdev); hci_dev_do_close()
1579 flush_work(&hdev->tx_work); hci_dev_do_close()
1580 flush_work(&hdev->rx_work); hci_dev_do_close()
1582 if (hdev->discov_timeout > 0) { hci_dev_do_close()
1583 cancel_delayed_work(&hdev->discov_off); hci_dev_do_close()
1584 hdev->discov_timeout = 0; hci_dev_do_close()
1585 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); hci_dev_do_close()
1586 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); hci_dev_do_close()
1589 if (hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE)) hci_dev_do_close()
1590 cancel_delayed_work(&hdev->service_cache); hci_dev_do_close()
1592 cancel_delayed_work_sync(&hdev->le_scan_disable); hci_dev_do_close()
1593 cancel_delayed_work_sync(&hdev->le_scan_restart); hci_dev_do_close()
1595 if (hci_dev_test_flag(hdev, HCI_MGMT)) hci_dev_do_close()
1596 cancel_delayed_work_sync(&hdev->rpa_expired); hci_dev_do_close()
1601 drain_workqueue(hdev->workqueue); hci_dev_do_close()
1603 hci_dev_lock(hdev); hci_dev_do_close()
1605 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hci_dev_do_close()
1607 if (!hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) { hci_dev_do_close()
1608 if (hdev->dev_type == HCI_BREDR) hci_dev_do_close()
1609 mgmt_powered(hdev, 0); hci_dev_do_close()
1612 hci_inquiry_cache_flush(hdev); hci_dev_do_close()
1613 hci_pend_le_actions_clear(hdev); hci_dev_do_close()
1614 hci_conn_hash_flush(hdev); hci_dev_do_close()
1615 hci_dev_unlock(hdev); hci_dev_do_close()
1617 smp_unregister(hdev); hci_dev_do_close()
1619 hci_notify(hdev, HCI_DEV_DOWN); hci_dev_do_close()
1621 if (hdev->flush) hci_dev_do_close()
1622 hdev->flush(hdev); hci_dev_do_close()
1625 skb_queue_purge(&hdev->cmd_q); hci_dev_do_close()
1626 atomic_set(&hdev->cmd_cnt, 1); hci_dev_do_close()
1627 if (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) && hci_dev_do_close()
1628 !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && hci_dev_do_close()
1629 test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) { hci_dev_do_close()
1630 set_bit(HCI_INIT, &hdev->flags); hci_dev_do_close()
1631 __hci_req_sync(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT); hci_dev_do_close()
1632 clear_bit(HCI_INIT, &hdev->flags); hci_dev_do_close()
1636 flush_work(&hdev->cmd_work); hci_dev_do_close()
1639 skb_queue_purge(&hdev->rx_q); hci_dev_do_close()
1640 skb_queue_purge(&hdev->cmd_q); hci_dev_do_close()
1641 skb_queue_purge(&hdev->raw_q); hci_dev_do_close()
1644 if (hdev->sent_cmd) { hci_dev_do_close()
1645 cancel_delayed_work_sync(&hdev->cmd_timer); hci_dev_do_close()
1646 kfree_skb(hdev->sent_cmd); hci_dev_do_close()
1647 hdev->sent_cmd = NULL; hci_dev_do_close()
1652 hdev->close(hdev); hci_dev_do_close()
1655 hdev->flags &= BIT(HCI_RAW); hci_dev_do_close()
1656 hci_dev_clear_volatile_flags(hdev); hci_dev_do_close()
1659 hdev->amp_status = AMP_STATUS_POWERED_DOWN; hci_dev_do_close()
1661 memset(hdev->eir, 0, sizeof(hdev->eir)); hci_dev_do_close()
1662 memset(hdev->dev_class, 0, sizeof(hdev->dev_class)); hci_dev_do_close()
1663 bacpy(&hdev->random_addr, BDADDR_ANY); hci_dev_do_close()
1665 hci_req_unlock(hdev); hci_dev_do_close()
1667 hci_dev_put(hdev); hci_dev_do_close()
1673 struct hci_dev *hdev; hci_dev_close() local
1676 hdev = hci_dev_get(dev); hci_dev_close()
1677 if (!hdev) hci_dev_close()
1680 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_dev_close()
1685 if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) hci_dev_close()
1686 cancel_delayed_work(&hdev->power_off); hci_dev_close()
1688 err = hci_dev_do_close(hdev); hci_dev_close()
1691 hci_dev_put(hdev); hci_dev_close()
1695 static int hci_dev_do_reset(struct hci_dev *hdev) hci_dev_do_reset() argument
1699 BT_DBG("%s %p", hdev->name, hdev); hci_dev_do_reset()
1701 hci_req_lock(hdev); hci_dev_do_reset()
1704 skb_queue_purge(&hdev->rx_q); hci_dev_do_reset()
1705 skb_queue_purge(&hdev->cmd_q); hci_dev_do_reset()
1710 drain_workqueue(hdev->workqueue); hci_dev_do_reset()
1712 hci_dev_lock(hdev); hci_dev_do_reset()
1713 hci_inquiry_cache_flush(hdev); hci_dev_do_reset()
1714 hci_conn_hash_flush(hdev); hci_dev_do_reset()
1715 hci_dev_unlock(hdev); hci_dev_do_reset()
1717 if (hdev->flush) hci_dev_do_reset()
1718 hdev->flush(hdev); hci_dev_do_reset()
1720 atomic_set(&hdev->cmd_cnt, 1); hci_dev_do_reset()
1721 hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0; hci_dev_do_reset()
1723 ret = __hci_req_sync(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT); hci_dev_do_reset()
1725 hci_req_unlock(hdev); hci_dev_do_reset()
1731 struct hci_dev *hdev; hci_dev_reset() local
1734 hdev = hci_dev_get(dev); hci_dev_reset()
1735 if (!hdev) hci_dev_reset()
1738 if (!test_bit(HCI_UP, &hdev->flags)) { hci_dev_reset()
1743 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_dev_reset()
1748 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { hci_dev_reset()
1753 err = hci_dev_do_reset(hdev); hci_dev_reset()
1756 hci_dev_put(hdev); hci_dev_reset()
1762 struct hci_dev *hdev; hci_dev_reset_stat() local
1765 hdev = hci_dev_get(dev); hci_dev_reset_stat()
1766 if (!hdev) hci_dev_reset_stat()
1769 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_dev_reset_stat()
1774 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { hci_dev_reset_stat()
1779 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); hci_dev_reset_stat()
1782 hci_dev_put(hdev); hci_dev_reset_stat()
1786 static void hci_update_scan_state(struct hci_dev *hdev, u8 scan) hci_update_scan_state() argument
1790 BT_DBG("%s scan 0x%02x", hdev->name, scan); hci_update_scan_state()
1793 conn_changed = !hci_dev_test_and_set_flag(hdev, hci_update_scan_state()
1796 conn_changed = hci_dev_test_and_clear_flag(hdev, hci_update_scan_state()
1800 discov_changed = !hci_dev_test_and_set_flag(hdev, hci_update_scan_state()
1803 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); hci_update_scan_state()
1804 discov_changed = hci_dev_test_and_clear_flag(hdev, hci_update_scan_state()
1808 if (!hci_dev_test_flag(hdev, HCI_MGMT)) hci_update_scan_state()
1813 hci_dev_set_flag(hdev, HCI_BREDR_ENABLED); hci_update_scan_state()
1815 if (hci_dev_test_flag(hdev, HCI_LE_ENABLED)) hci_update_scan_state()
1816 mgmt_update_adv_data(hdev); hci_update_scan_state()
1818 mgmt_new_settings(hdev); hci_update_scan_state()
1824 struct hci_dev *hdev; hci_dev_cmd() local
1831 hdev = hci_dev_get(dr.dev_id); hci_dev_cmd()
1832 if (!hdev) hci_dev_cmd()
1835 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_dev_cmd()
1840 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { hci_dev_cmd()
1845 if (hdev->dev_type != HCI_BREDR) { hci_dev_cmd()
1850 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { hci_dev_cmd()
1857 err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, hci_dev_cmd()
1862 if (!lmp_encrypt_capable(hdev)) { hci_dev_cmd()
1867 if (!test_bit(HCI_AUTH, &hdev->flags)) { hci_dev_cmd()
1869 err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, hci_dev_cmd()
1875 err = hci_req_sync(hdev, hci_encrypt_req, dr.dev_opt, hci_dev_cmd()
1880 err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt, hci_dev_cmd()
1887 hci_update_scan_state(hdev, dr.dev_opt); hci_dev_cmd()
1891 err = hci_req_sync(hdev, hci_linkpol_req, dr.dev_opt, hci_dev_cmd()
1896 hdev->link_mode = ((__u16) dr.dev_opt) & hci_dev_cmd()
1901 hdev->pkt_type = (__u16) dr.dev_opt; hci_dev_cmd()
1905 hdev->acl_mtu = *((__u16 *) &dr.dev_opt + 1); hci_dev_cmd()
1906 hdev->acl_pkts = *((__u16 *) &dr.dev_opt + 0); hci_dev_cmd()
1910 hdev->sco_mtu = *((__u16 *) &dr.dev_opt + 1); hci_dev_cmd()
1911 hdev->sco_pkts = *((__u16 *) &dr.dev_opt + 0); hci_dev_cmd()
1920 hci_dev_put(hdev); hci_dev_cmd()
1926 struct hci_dev *hdev; hci_get_dev_list() local
1947 list_for_each_entry(hdev, &hci_dev_list, list) { hci_get_dev_list()
1948 unsigned long flags = hdev->flags; hci_get_dev_list()
1954 if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) hci_get_dev_list()
1957 (dr + n)->dev_id = hdev->id; hci_get_dev_list()
1976 struct hci_dev *hdev; hci_get_dev_info() local
1984 hdev = hci_dev_get(di.dev_id); hci_get_dev_info()
1985 if (!hdev) hci_get_dev_info()
1992 if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) hci_get_dev_info()
1993 flags = hdev->flags & ~BIT(HCI_UP); hci_get_dev_info()
1995 flags = hdev->flags; hci_get_dev_info()
1997 strcpy(di.name, hdev->name); hci_get_dev_info()
1998 di.bdaddr = hdev->bdaddr; hci_get_dev_info()
1999 di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4); hci_get_dev_info()
2001 di.pkt_type = hdev->pkt_type; hci_get_dev_info()
2002 if (lmp_bredr_capable(hdev)) { hci_get_dev_info()
2003 di.acl_mtu = hdev->acl_mtu; hci_get_dev_info()
2004 di.acl_pkts = hdev->acl_pkts; hci_get_dev_info()
2005 di.sco_mtu = hdev->sco_mtu; hci_get_dev_info()
2006 di.sco_pkts = hdev->sco_pkts; hci_get_dev_info()
2008 di.acl_mtu = hdev->le_mtu; hci_get_dev_info()
2009 di.acl_pkts = hdev->le_pkts; hci_get_dev_info()
2013 di.link_policy = hdev->link_policy; hci_get_dev_info()
2014 di.link_mode = hdev->link_mode; hci_get_dev_info()
2016 memcpy(&di.stat, &hdev->stat, sizeof(di.stat)); hci_get_dev_info()
2017 memcpy(&di.features, &hdev->features, sizeof(di.features)); hci_get_dev_info()
2022 hci_dev_put(hdev); hci_get_dev_info()
2031 struct hci_dev *hdev = data; hci_rfkill_set_block() local
2033 BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked); hci_rfkill_set_block()
2035 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) hci_rfkill_set_block()
2039 hci_dev_set_flag(hdev, HCI_RFKILLED); hci_rfkill_set_block()
2040 if (!hci_dev_test_flag(hdev, HCI_SETUP) && hci_rfkill_set_block()
2041 !hci_dev_test_flag(hdev, HCI_CONFIG)) hci_rfkill_set_block()
2042 hci_dev_do_close(hdev); hci_rfkill_set_block()
2044 hci_dev_clear_flag(hdev, HCI_RFKILLED); hci_rfkill_set_block()
2056 struct hci_dev *hdev = container_of(work, struct hci_dev, power_on); hci_power_on() local
2059 BT_DBG("%s", hdev->name); hci_power_on()
2061 err = hci_dev_do_open(hdev); hci_power_on()
2063 hci_dev_lock(hdev); hci_power_on()
2064 mgmt_set_powered_failed(hdev, err); hci_power_on()
2065 hci_dev_unlock(hdev); hci_power_on()
2073 if (hci_dev_test_flag(hdev, HCI_RFKILLED) || hci_power_on()
2074 hci_dev_test_flag(hdev, HCI_UNCONFIGURED) || hci_power_on()
2075 (hdev->dev_type == HCI_BREDR && hci_power_on()
2076 !bacmp(&hdev->bdaddr, BDADDR_ANY) && hci_power_on()
2077 !bacmp(&hdev->static_addr, BDADDR_ANY))) { hci_power_on()
2078 hci_dev_clear_flag(hdev, HCI_AUTO_OFF); hci_power_on()
2079 hci_dev_do_close(hdev); hci_power_on()
2080 } else if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) { hci_power_on()
2081 queue_delayed_work(hdev->req_workqueue, &hdev->power_off, hci_power_on()
2085 if (hci_dev_test_and_clear_flag(hdev, HCI_SETUP)) { hci_power_on()
2089 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) hci_power_on()
2090 set_bit(HCI_RAW, &hdev->flags); hci_power_on()
2099 mgmt_index_added(hdev); hci_power_on()
2100 } else if (hci_dev_test_and_clear_flag(hdev, HCI_CONFIG)) { hci_power_on()
2104 if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) hci_power_on()
2105 clear_bit(HCI_RAW, &hdev->flags); hci_power_on()
2111 mgmt_index_added(hdev); hci_power_on()
2117 struct hci_dev *hdev = container_of(work, struct hci_dev, hci_power_off() local
2120 BT_DBG("%s", hdev->name); hci_power_off()
2122 hci_dev_do_close(hdev); hci_power_off()
2127 struct hci_dev *hdev = container_of(work, struct hci_dev, error_reset); hci_error_reset() local
2129 BT_DBG("%s", hdev->name); hci_error_reset()
2131 if (hdev->hw_error) hci_error_reset()
2132 hdev->hw_error(hdev, hdev->hw_error_code); hci_error_reset()
2134 BT_ERR("%s hardware error 0x%2.2x", hdev->name, hci_error_reset()
2135 hdev->hw_error_code); hci_error_reset()
2137 if (hci_dev_do_close(hdev)) hci_error_reset()
2140 hci_dev_do_open(hdev); hci_error_reset()
2145 struct hci_dev *hdev; hci_discov_off() local
2147 hdev = container_of(work, struct hci_dev, discov_off.work); hci_discov_off()
2149 BT_DBG("%s", hdev->name); hci_discov_off()
2151 mgmt_discoverable_timeout(hdev); hci_discov_off()
2154 void hci_uuids_clear(struct hci_dev *hdev) hci_uuids_clear() argument
2158 list_for_each_entry_safe(uuid, tmp, &hdev->uuids, list) { hci_uuids_clear()
2164 void hci_link_keys_clear(struct hci_dev *hdev) hci_link_keys_clear() argument
2168 list_for_each_entry_rcu(key, &hdev->link_keys, list) { hci_link_keys_clear()
2174 void hci_smp_ltks_clear(struct hci_dev *hdev) hci_smp_ltks_clear() argument
2178 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { hci_smp_ltks_clear()
2184 void hci_smp_irks_clear(struct hci_dev *hdev) hci_smp_irks_clear() argument
2188 list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) { hci_smp_irks_clear()
2194 struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) hci_find_link_key() argument
2199 list_for_each_entry_rcu(k, &hdev->link_keys, list) { hci_find_link_key()
2210 static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, hci_persistent_key() argument
2258 struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_find_ltk() argument
2264 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { hci_find_ltk()
2278 struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa) hci_find_irk_by_rpa() argument
2283 list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { hci_find_irk_by_rpa()
2290 list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { hci_find_irk_by_rpa()
2291 if (smp_irk_matches(hdev, irk->val, rpa)) { hci_find_irk_by_rpa()
2302 struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_find_irk_by_addr() argument
2312 list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { hci_find_irk_by_addr()
2324 struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, hci_add_link_key() argument
2331 old_key = hci_find_link_key(hdev, bdaddr); hci_add_link_key()
2340 list_add_rcu(&key->list, &hdev->link_keys); hci_add_link_key()
2343 BT_DBG("%s key for %pMR type %u", hdev->name, bdaddr, type); hci_add_link_key()
2365 *persistent = hci_persistent_key(hdev, conn, type, hci_add_link_key()
2371 struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_add_ltk() argument
2378 old_key = hci_find_ltk(hdev, bdaddr, addr_type, role); hci_add_ltk()
2385 list_add_rcu(&key->list, &hdev->long_term_keys); hci_add_ltk()
2400 struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_add_irk() argument
2405 irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type); hci_add_irk()
2414 list_add_rcu(&irk->list, &hdev->identity_resolving_keys); hci_add_irk()
2423 int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) hci_remove_link_key() argument
2427 key = hci_find_link_key(hdev, bdaddr); hci_remove_link_key()
2431 BT_DBG("%s removing %pMR", hdev->name, bdaddr); hci_remove_link_key()
2439 int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type) hci_remove_ltk() argument
2444 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { hci_remove_ltk()
2448 BT_DBG("%s removing %pMR", hdev->name, bdaddr); hci_remove_ltk()
2458 void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type) hci_remove_irk() argument
2462 list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) { hci_remove_irk()
2466 BT_DBG("%s removing %pMR", hdev->name, bdaddr); hci_remove_irk()
2473 bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) hci_bdaddr_is_paired() argument
2480 if (hci_find_link_key(hdev, bdaddr)) hci_bdaddr_is_paired()
2491 irk = hci_get_irk(hdev, bdaddr, addr_type); hci_bdaddr_is_paired()
2498 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { hci_bdaddr_is_paired()
2512 struct hci_dev *hdev = container_of(work, struct hci_dev, hci_cmd_timeout() local
2515 if (hdev->sent_cmd) { hci_cmd_timeout()
2516 struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data; hci_cmd_timeout()
2519 BT_ERR("%s command 0x%4.4x tx timeout", hdev->name, opcode); hci_cmd_timeout()
2521 BT_ERR("%s command tx timeout", hdev->name); hci_cmd_timeout()
2524 atomic_set(&hdev->cmd_cnt, 1); hci_cmd_timeout()
2525 queue_work(hdev->workqueue, &hdev->cmd_work); hci_cmd_timeout()
2528 struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, hci_find_remote_oob_data() argument
2533 list_for_each_entry(data, &hdev->remote_oob_data, list) { hci_find_remote_oob_data()
2544 int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_remove_remote_oob_data() argument
2549 data = hci_find_remote_oob_data(hdev, bdaddr, bdaddr_type); hci_remove_remote_oob_data()
2553 BT_DBG("%s removing %pMR (%u)", hdev->name, bdaddr, bdaddr_type); hci_remove_remote_oob_data()
2561 void hci_remote_oob_data_clear(struct hci_dev *hdev) hci_remote_oob_data_clear() argument
2565 list_for_each_entry_safe(data, n, &hdev->remote_oob_data, list) { hci_remote_oob_data_clear()
2571 int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_add_remote_oob_data() argument
2577 data = hci_find_remote_oob_data(hdev, bdaddr, bdaddr_type); hci_add_remote_oob_data()
2585 list_add(&data->list, &hdev->remote_oob_data); hci_add_remote_oob_data()
2612 BT_DBG("%s for %pMR", hdev->name, bdaddr); hci_add_remote_oob_data()
2683 /* This function requires the caller holds hdev->lock */ hci_conn_params_lookup()
2684 struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, hci_conn_params_lookup() argument
2693 list_for_each_entry(params, &hdev->le_conn_params, list) { hci_conn_params_lookup()
2703 /* This function requires the caller holds hdev->lock */ hci_pend_le_action_lookup()
2722 /* This function requires the caller holds hdev->lock */ hci_conn_params_add()
2723 struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev, hci_conn_params_add() argument
2731 params = hci_conn_params_lookup(hdev, addr, addr_type); hci_conn_params_add()
2744 list_add(&params->list, &hdev->le_conn_params); hci_conn_params_add()
2747 params->conn_min_interval = hdev->le_conn_min_interval; hci_conn_params_add()
2748 params->conn_max_interval = hdev->le_conn_max_interval; hci_conn_params_add()
2749 params->conn_latency = hdev->le_conn_latency; hci_conn_params_add()
2750 params->supervision_timeout = hdev->le_supv_timeout; hci_conn_params_add()
2770 /* This function requires the caller holds hdev->lock */ hci_conn_params_del()
2771 void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) hci_conn_params_del() argument
2775 params = hci_conn_params_lookup(hdev, addr, addr_type); hci_conn_params_del()
2781 hci_update_background_scan(hdev); hci_conn_params_del()
2786 /* This function requires the caller holds hdev->lock */ hci_conn_params_clear_disabled()
2787 void hci_conn_params_clear_disabled(struct hci_dev *hdev) hci_conn_params_clear_disabled() argument
2791 list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) { hci_conn_params_clear_disabled()
2801 /* This function requires the caller holds hdev->lock */ hci_conn_params_clear_all()
2802 void hci_conn_params_clear_all(struct hci_dev *hdev) hci_conn_params_clear_all() argument
2806 list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) hci_conn_params_clear_all()
2809 hci_update_background_scan(hdev); hci_conn_params_clear_all()
2814 static void inquiry_complete(struct hci_dev *hdev, u8 status, u16 opcode) inquiry_complete() argument
2819 hci_dev_lock(hdev); inquiry_complete()
2820 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); inquiry_complete()
2821 hci_dev_unlock(hdev); inquiry_complete()
2826 static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, le_scan_disable_work_complete() argument
2839 hdev->discovery.scan_start = 0; le_scan_disable_work_complete()
2841 switch (hdev->discovery.type) { le_scan_disable_work_complete()
2843 hci_dev_lock(hdev); le_scan_disable_work_complete()
2844 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); le_scan_disable_work_complete()
2845 hci_dev_unlock(hdev); le_scan_disable_work_complete()
2849 hci_dev_lock(hdev); le_scan_disable_work_complete()
2852 &hdev->quirks)) { le_scan_disable_work_complete()
2860 if (!test_bit(HCI_INQUIRY, &hdev->flags) && le_scan_disable_work_complete()
2861 hdev->discovery.state != DISCOVERY_RESOLVING) le_scan_disable_work_complete()
2862 hci_discovery_set_state(hdev, le_scan_disable_work_complete()
2867 hci_inquiry_cache_flush(hdev); le_scan_disable_work_complete()
2869 hci_req_init(&req, hdev); le_scan_disable_work_complete()
2879 hci_discovery_set_state(hdev, le_scan_disable_work_complete()
2884 hci_dev_unlock(hdev); le_scan_disable_work_complete()
2891 struct hci_dev *hdev = container_of(work, struct hci_dev, le_scan_disable_work() local
2896 BT_DBG("%s", hdev->name); le_scan_disable_work()
2898 cancel_delayed_work_sync(&hdev->le_scan_restart); le_scan_disable_work()
2900 hci_req_init(&req, hdev); le_scan_disable_work()
2909 static void le_scan_restart_work_complete(struct hci_dev *hdev, u8 status, le_scan_restart_work_complete() argument
2914 BT_DBG("%s", hdev->name); le_scan_restart_work_complete()
2921 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) || le_scan_restart_work_complete()
2922 !hdev->discovery.scan_start) le_scan_restart_work_complete()
2925 /* When the scan was started, hdev->le_scan_disable has been queued le_scan_restart_work_complete()
2930 duration = hdev->discovery.scan_duration; le_scan_restart_work_complete()
2931 scan_start = hdev->discovery.scan_start; le_scan_restart_work_complete()
2945 queue_delayed_work(hdev->workqueue, le_scan_restart_work_complete()
2946 &hdev->le_scan_disable, timeout); le_scan_restart_work_complete()
2951 struct hci_dev *hdev = container_of(work, struct hci_dev, le_scan_restart_work() local
2957 BT_DBG("%s", hdev->name); le_scan_restart_work()
2960 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) le_scan_restart_work()
2963 hci_req_init(&req, hdev); le_scan_restart_work()
2990 void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_copy_identity_address() argument
2993 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || hci_copy_identity_address()
2994 !bacmp(&hdev->bdaddr, BDADDR_ANY) || hci_copy_identity_address()
2995 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && hci_copy_identity_address()
2996 bacmp(&hdev->static_addr, BDADDR_ANY))) { hci_copy_identity_address()
2997 bacpy(bdaddr, &hdev->static_addr); hci_copy_identity_address()
3000 bacpy(bdaddr, &hdev->bdaddr); hci_copy_identity_address()
3008 struct hci_dev *hdev; hci_alloc_dev() local
3010 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); hci_alloc_dev()
3011 if (!hdev) hci_alloc_dev()
3014 hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hci_alloc_dev()
3015 hdev->esco_type = (ESCO_HV1); hci_alloc_dev()
3016 hdev->link_mode = (HCI_LM_ACCEPT); hci_alloc_dev()
3017 hdev->num_iac = 0x01; /* One IAC support is mandatory */ hci_alloc_dev()
3018 hdev->io_capability = 0x03; /* No Input No Output */ hci_alloc_dev()
3019 hdev->manufacturer = 0xffff; /* Default to internal use */ hci_alloc_dev()
3020 hdev->inq_tx_power = HCI_TX_POWER_INVALID; hci_alloc_dev()
3021 hdev->adv_tx_power = HCI_TX_POWER_INVALID; hci_alloc_dev()
3023 hdev->sniff_max_interval = 800; hci_alloc_dev()
3024 hdev->sniff_min_interval = 80; hci_alloc_dev()
3026 hdev->le_adv_channel_map = 0x07; hci_alloc_dev()
3027 hdev->le_adv_min_interval = 0x0800; hci_alloc_dev()
3028 hdev->le_adv_max_interval = 0x0800; hci_alloc_dev()
3029 hdev->le_scan_interval = 0x0060; hci_alloc_dev()
3030 hdev->le_scan_window = 0x0030; hci_alloc_dev()
3031 hdev->le_conn_min_interval = 0x0028; hci_alloc_dev()
3032 hdev->le_conn_max_interval = 0x0038; hci_alloc_dev()
3033 hdev->le_conn_latency = 0x0000; hci_alloc_dev()
3034 hdev->le_supv_timeout = 0x002a; hci_alloc_dev()
3035 hdev->le_def_tx_len = 0x001b; hci_alloc_dev()
3036 hdev->le_def_tx_time = 0x0148; hci_alloc_dev()
3037 hdev->le_max_tx_len = 0x001b; hci_alloc_dev()
3038 hdev->le_max_tx_time = 0x0148; hci_alloc_dev()
3039 hdev->le_max_rx_len = 0x001b; hci_alloc_dev()
3040 hdev->le_max_rx_time = 0x0148; hci_alloc_dev()
3042 hdev->rpa_timeout = HCI_DEFAULT_RPA_TIMEOUT; hci_alloc_dev()
3043 hdev->discov_interleaved_timeout = DISCOV_INTERLEAVED_TIMEOUT; hci_alloc_dev()
3044 hdev->conn_info_min_age = DEFAULT_CONN_INFO_MIN_AGE; hci_alloc_dev()
3045 hdev->conn_info_max_age = DEFAULT_CONN_INFO_MAX_AGE; hci_alloc_dev()
3047 mutex_init(&hdev->lock); hci_alloc_dev()
3048 mutex_init(&hdev->req_lock); hci_alloc_dev()
3050 INIT_LIST_HEAD(&hdev->mgmt_pending); hci_alloc_dev()
3051 INIT_LIST_HEAD(&hdev->blacklist); hci_alloc_dev()
3052 INIT_LIST_HEAD(&hdev->whitelist); hci_alloc_dev()
3053 INIT_LIST_HEAD(&hdev->uuids); hci_alloc_dev()
3054 INIT_LIST_HEAD(&hdev->link_keys); hci_alloc_dev()
3055 INIT_LIST_HEAD(&hdev->long_term_keys); hci_alloc_dev()
3056 INIT_LIST_HEAD(&hdev->identity_resolving_keys); hci_alloc_dev()
3057 INIT_LIST_HEAD(&hdev->remote_oob_data); hci_alloc_dev()
3058 INIT_LIST_HEAD(&hdev->le_white_list); hci_alloc_dev()
3059 INIT_LIST_HEAD(&hdev->le_conn_params); hci_alloc_dev()
3060 INIT_LIST_HEAD(&hdev->pend_le_conns); hci_alloc_dev()
3061 INIT_LIST_HEAD(&hdev->pend_le_reports); hci_alloc_dev()
3062 INIT_LIST_HEAD(&hdev->conn_hash.list); hci_alloc_dev()
3064 INIT_WORK(&hdev->rx_work, hci_rx_work); hci_alloc_dev()
3065 INIT_WORK(&hdev->cmd_work, hci_cmd_work); hci_alloc_dev()
3066 INIT_WORK(&hdev->tx_work, hci_tx_work); hci_alloc_dev()
3067 INIT_WORK(&hdev->power_on, hci_power_on); hci_alloc_dev()
3068 INIT_WORK(&hdev->error_reset, hci_error_reset); hci_alloc_dev()
3070 INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); hci_alloc_dev()
3071 INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); hci_alloc_dev()
3072 INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); hci_alloc_dev()
3073 INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work); hci_alloc_dev()
3075 skb_queue_head_init(&hdev->rx_q); hci_alloc_dev()
3076 skb_queue_head_init(&hdev->cmd_q); hci_alloc_dev()
3077 skb_queue_head_init(&hdev->raw_q); hci_alloc_dev()
3079 init_waitqueue_head(&hdev->req_wait_q); hci_alloc_dev()
3081 INIT_DELAYED_WORK(&hdev->cmd_timer, hci_cmd_timeout); hci_alloc_dev()
3083 hci_init_sysfs(hdev); hci_alloc_dev()
3084 discovery_init(hdev); hci_alloc_dev()
3085 adv_info_init(hdev); hci_alloc_dev()
3087 return hdev; hci_alloc_dev()
3092 void hci_free_dev(struct hci_dev *hdev) hci_free_dev() argument
3095 put_device(&hdev->dev); hci_free_dev()
3100 int hci_register_dev(struct hci_dev *hdev) hci_register_dev() argument
3104 if (!hdev->open || !hdev->close || !hdev->send) hci_register_dev()
3110 switch (hdev->dev_type) { hci_register_dev()
3124 sprintf(hdev->name, "hci%d", id); hci_register_dev()
3125 hdev->id = id; hci_register_dev()
3127 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); hci_register_dev()
3129 hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | hci_register_dev()
3130 WQ_MEM_RECLAIM, 1, hdev->name); hci_register_dev()
3131 if (!hdev->workqueue) { hci_register_dev()
3136 hdev->req_workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | hci_register_dev()
3137 WQ_MEM_RECLAIM, 1, hdev->name); hci_register_dev()
3138 if (!hdev->req_workqueue) { hci_register_dev()
3139 destroy_workqueue(hdev->workqueue); hci_register_dev()
3145 hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); hci_register_dev()
3147 dev_set_name(&hdev->dev, "%s", hdev->name); hci_register_dev()
3149 error = device_add(&hdev->dev); hci_register_dev()
3153 hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, hci_register_dev()
3155 hdev); hci_register_dev()
3156 if (hdev->rfkill) { hci_register_dev()
3157 if (rfkill_register(hdev->rfkill) < 0) { hci_register_dev()
3158 rfkill_destroy(hdev->rfkill); hci_register_dev()
3159 hdev->rfkill = NULL; hci_register_dev()
3163 if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) hci_register_dev()
3164 hci_dev_set_flag(hdev, HCI_RFKILLED); hci_register_dev()
3166 hci_dev_set_flag(hdev, HCI_SETUP); hci_register_dev()
3167 hci_dev_set_flag(hdev, HCI_AUTO_OFF); hci_register_dev()
3169 if (hdev->dev_type == HCI_BREDR) { hci_register_dev()
3173 hci_dev_set_flag(hdev, HCI_BREDR_ENABLED); hci_register_dev()
3177 list_add(&hdev->list, &hci_dev_list); hci_register_dev()
3183 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) hci_register_dev()
3184 hci_dev_set_flag(hdev, HCI_UNCONFIGURED); hci_register_dev()
3186 hci_notify(hdev, HCI_DEV_REG); hci_register_dev()
3187 hci_dev_hold(hdev); hci_register_dev()
3189 queue_work(hdev->req_workqueue, &hdev->power_on); hci_register_dev()
3194 destroy_workqueue(hdev->workqueue); hci_register_dev()
3195 destroy_workqueue(hdev->req_workqueue); hci_register_dev()
3197 ida_simple_remove(&hci_index_ida, hdev->id); hci_register_dev()
3204 void hci_unregister_dev(struct hci_dev *hdev) hci_unregister_dev() argument
3208 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); hci_unregister_dev()
3210 hci_dev_set_flag(hdev, HCI_UNREGISTER); hci_unregister_dev()
3212 id = hdev->id; hci_unregister_dev()
3215 list_del(&hdev->list); hci_unregister_dev()
3218 hci_dev_do_close(hdev); hci_unregister_dev()
3220 cancel_work_sync(&hdev->power_on); hci_unregister_dev()
3222 if (!test_bit(HCI_INIT, &hdev->flags) && hci_unregister_dev()
3223 !hci_dev_test_flag(hdev, HCI_SETUP) && hci_unregister_dev()
3224 !hci_dev_test_flag(hdev, HCI_CONFIG)) { hci_unregister_dev()
3225 hci_dev_lock(hdev); hci_unregister_dev()
3226 mgmt_index_removed(hdev); hci_unregister_dev()
3227 hci_dev_unlock(hdev); hci_unregister_dev()
3232 BUG_ON(!list_empty(&hdev->mgmt_pending)); hci_unregister_dev()
3234 hci_notify(hdev, HCI_DEV_UNREG); hci_unregister_dev()
3236 if (hdev->rfkill) { hci_unregister_dev()
3237 rfkill_unregister(hdev->rfkill); hci_unregister_dev()
3238 rfkill_destroy(hdev->rfkill); hci_unregister_dev()
3241 device_del(&hdev->dev); hci_unregister_dev()
3243 debugfs_remove_recursive(hdev->debugfs); hci_unregister_dev()
3245 destroy_workqueue(hdev->workqueue); hci_unregister_dev()
3246 destroy_workqueue(hdev->req_workqueue); hci_unregister_dev()
3248 hci_dev_lock(hdev); hci_unregister_dev()
3249 hci_bdaddr_list_clear(&hdev->blacklist); hci_unregister_dev()
3250 hci_bdaddr_list_clear(&hdev->whitelist); hci_unregister_dev()
3251 hci_uuids_clear(hdev); hci_unregister_dev()
3252 hci_link_keys_clear(hdev); hci_unregister_dev()
3253 hci_smp_ltks_clear(hdev); hci_unregister_dev()
3254 hci_smp_irks_clear(hdev); hci_unregister_dev()
3255 hci_remote_oob_data_clear(hdev); hci_unregister_dev()
3256 hci_bdaddr_list_clear(&hdev->le_white_list); hci_unregister_dev()
3257 hci_conn_params_clear_all(hdev); hci_unregister_dev()
3258 hci_discovery_filter_clear(hdev); hci_unregister_dev()
3259 hci_dev_unlock(hdev); hci_unregister_dev()
3261 hci_dev_put(hdev); hci_unregister_dev()
3268 int hci_suspend_dev(struct hci_dev *hdev) hci_suspend_dev() argument
3270 hci_notify(hdev, HCI_DEV_SUSPEND); hci_suspend_dev()
3276 int hci_resume_dev(struct hci_dev *hdev) hci_resume_dev() argument
3278 hci_notify(hdev, HCI_DEV_RESUME); hci_resume_dev()
3284 int hci_reset_dev(struct hci_dev *hdev) hci_reset_dev() argument
3297 return hci_recv_frame(hdev, skb); hci_reset_dev()
3302 int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb) hci_recv_frame() argument
3304 if (!hdev || (!test_bit(HCI_UP, &hdev->flags) hci_recv_frame()
3305 && !test_bit(HCI_INIT, &hdev->flags))) { hci_recv_frame()
3316 skb_queue_tail(&hdev->rx_q, skb); hci_recv_frame()
3317 queue_work(hdev->workqueue, &hdev->rx_work); hci_recv_frame()
3349 static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) hci_send_frame() argument
3353 BT_DBG("%s type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); hci_send_frame()
3359 hci_send_to_monitor(hdev, skb); hci_send_frame()
3361 if (atomic_read(&hdev->promisc)) { hci_send_frame()
3363 hci_send_to_sock(hdev, skb); hci_send_frame()
3369 err = hdev->send(hdev, skb); hci_send_frame()
3371 BT_ERR("%s sending frame failed (%d)", hdev->name, err); hci_send_frame()
3377 int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, hci_send_cmd() argument
3382 BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen); hci_send_cmd()
3384 skb = hci_prepare_cmd(hdev, opcode, plen, param); hci_send_cmd()
3386 BT_ERR("%s no memory for command", hdev->name); hci_send_cmd()
3395 skb_queue_tail(&hdev->cmd_q, skb); hci_send_cmd()
3396 queue_work(hdev->workqueue, &hdev->cmd_work); hci_send_cmd()
3402 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode) hci_sent_cmd_data() argument
3406 if (!hdev->sent_cmd) hci_sent_cmd_data()
3409 hdr = (void *) hdev->sent_cmd->data; hci_sent_cmd_data()
3414 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); hci_sent_cmd_data()
3416 return hdev->sent_cmd->data + HCI_COMMAND_HDR_SIZE; hci_sent_cmd_data()
3436 struct hci_dev *hdev = conn->hdev; hci_queue_acl() local
3444 switch (hdev->dev_type) { hci_queue_acl()
3452 BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type); hci_queue_acl()
3459 BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len); hci_queue_acl()
3464 BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len); hci_queue_acl()
3485 BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len); hci_queue_acl()
3496 struct hci_dev *hdev = chan->conn->hdev; hci_send_acl() local
3498 BT_DBG("%s chan %p flags 0x%4.4x", hdev->name, chan, flags); hci_send_acl()
3502 queue_work(hdev->workqueue, &hdev->tx_work); hci_send_acl()
3508 struct hci_dev *hdev = conn->hdev; hci_send_sco() local
3511 BT_DBG("%s len %d", hdev->name, skb->len); hci_send_sco()
3523 queue_work(hdev->workqueue, &hdev->tx_work); hci_send_sco()
3529 static struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, hci_low_sent() argument
3532 struct hci_conn_hash *h = &hdev->conn_hash; hci_low_sent()
3555 if (hci_conn_num(hdev, type) == num) hci_low_sent()
3566 cnt = hdev->acl_cnt; hci_low_sent()
3570 cnt = hdev->sco_cnt; hci_low_sent()
3573 cnt = hdev->le_mtu ? hdev->le_cnt : hdev->acl_cnt; hci_low_sent()
3589 static void hci_link_tx_to(struct hci_dev *hdev, __u8 type) hci_link_tx_to() argument
3591 struct hci_conn_hash *h = &hdev->conn_hash; hci_link_tx_to()
3594 BT_ERR("%s link tx timeout", hdev->name); hci_link_tx_to()
3602 hdev->name, &c->dst); hci_link_tx_to()
3610 static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type, hci_chan_sent() argument
3613 struct hci_conn_hash *h = &hdev->conn_hash; hci_chan_sent()
3619 BT_DBG("%s", hdev->name); hci_chan_sent()
3658 if (hci_conn_num(hdev, type) == conn_num) hci_chan_sent()
3669 cnt = hdev->acl_cnt; hci_chan_sent()
3672 cnt = hdev->block_cnt; hci_chan_sent()
3676 cnt = hdev->sco_cnt; hci_chan_sent()
3679 cnt = hdev->le_mtu ? hdev->le_cnt : hdev->acl_cnt; hci_chan_sent()
3692 static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type) hci_prio_recalculate() argument
3694 struct hci_conn_hash *h = &hdev->conn_hash; hci_prio_recalculate()
3698 BT_DBG("%s", hdev->name); hci_prio_recalculate()
3734 if (hci_conn_num(hdev, type) == num) hci_prio_recalculate()
3742 static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb) __get_blocks() argument
3745 return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); __get_blocks()
3748 static void __check_timeout(struct hci_dev *hdev, unsigned int cnt) __check_timeout() argument
3750 if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { __check_timeout()
3753 if (!cnt && time_after(jiffies, hdev->acl_last_tx + __check_timeout()
3755 hci_link_tx_to(hdev, ACL_LINK); __check_timeout()
3759 static void hci_sched_acl_pkt(struct hci_dev *hdev) hci_sched_acl_pkt() argument
3761 unsigned int cnt = hdev->acl_cnt; hci_sched_acl_pkt()
3766 __check_timeout(hdev, cnt); hci_sched_acl_pkt()
3768 while (hdev->acl_cnt && hci_sched_acl_pkt()
3769 (chan = hci_chan_sent(hdev, ACL_LINK, &quote))) { hci_sched_acl_pkt()
3784 hci_send_frame(hdev, skb); hci_sched_acl_pkt()
3785 hdev->acl_last_tx = jiffies; hci_sched_acl_pkt()
3787 hdev->acl_cnt--; hci_sched_acl_pkt()
3793 if (cnt != hdev->acl_cnt) hci_sched_acl_pkt()
3794 hci_prio_recalculate(hdev, ACL_LINK); hci_sched_acl_pkt()
3797 static void hci_sched_acl_blk(struct hci_dev *hdev) hci_sched_acl_blk() argument
3799 unsigned int cnt = hdev->block_cnt; hci_sched_acl_blk()
3805 __check_timeout(hdev, cnt); hci_sched_acl_blk()
3807 BT_DBG("%s", hdev->name); hci_sched_acl_blk()
3809 if (hdev->dev_type == HCI_AMP) hci_sched_acl_blk()
3814 while (hdev->block_cnt > 0 && hci_sched_acl_blk()
3815 (chan = hci_chan_sent(hdev, type, &quote))) { hci_sched_acl_blk()
3829 blocks = __get_blocks(hdev, skb); hci_sched_acl_blk()
3830 if (blocks > hdev->block_cnt) hci_sched_acl_blk()
3836 hci_send_frame(hdev, skb); hci_sched_acl_blk()
3837 hdev->acl_last_tx = jiffies; hci_sched_acl_blk()
3839 hdev->block_cnt -= blocks; hci_sched_acl_blk()
3847 if (cnt != hdev->block_cnt) hci_sched_acl_blk()
3848 hci_prio_recalculate(hdev, type); hci_sched_acl_blk()
3851 static void hci_sched_acl(struct hci_dev *hdev) hci_sched_acl() argument
3853 BT_DBG("%s", hdev->name); hci_sched_acl()
3856 if (!hci_conn_num(hdev, ACL_LINK) && hdev->dev_type == HCI_BREDR) hci_sched_acl()
3860 if (!hci_conn_num(hdev, AMP_LINK) && hdev->dev_type == HCI_AMP) hci_sched_acl()
3863 switch (hdev->flow_ctl_mode) { hci_sched_acl()
3865 hci_sched_acl_pkt(hdev); hci_sched_acl()
3869 hci_sched_acl_blk(hdev); hci_sched_acl()
3875 static void hci_sched_sco(struct hci_dev *hdev) hci_sched_sco() argument
3881 BT_DBG("%s", hdev->name); hci_sched_sco()
3883 if (!hci_conn_num(hdev, SCO_LINK)) hci_sched_sco()
3886 while (hdev->sco_cnt && (conn = hci_low_sent(hdev, SCO_LINK, &quote))) { hci_sched_sco()
3889 hci_send_frame(hdev, skb); hci_sched_sco()
3898 static void hci_sched_esco(struct hci_dev *hdev) hci_sched_esco() argument
3904 BT_DBG("%s", hdev->name); hci_sched_esco()
3906 if (!hci_conn_num(hdev, ESCO_LINK)) hci_sched_esco()
3909 while (hdev->sco_cnt && (conn = hci_low_sent(hdev, ESCO_LINK, hci_sched_esco()
3913 hci_send_frame(hdev, skb); hci_sched_esco()
3922 static void hci_sched_le(struct hci_dev *hdev) hci_sched_le() argument
3928 BT_DBG("%s", hdev->name); hci_sched_le()
3930 if (!hci_conn_num(hdev, LE_LINK)) hci_sched_le()
3933 if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { hci_sched_le()
3936 if (!hdev->le_cnt && hdev->le_pkts && hci_sched_le()
3937 time_after(jiffies, hdev->le_last_tx + HZ * 45)) hci_sched_le()
3938 hci_link_tx_to(hdev, LE_LINK); hci_sched_le()
3941 cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; hci_sched_le()
3943 while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, &quote))) { hci_sched_le()
3955 hci_send_frame(hdev, skb); hci_sched_le()
3956 hdev->le_last_tx = jiffies; hci_sched_le()
3964 if (hdev->le_pkts) hci_sched_le()
3965 hdev->le_cnt = cnt; hci_sched_le()
3967 hdev->acl_cnt = cnt; hci_sched_le()
3970 hci_prio_recalculate(hdev, LE_LINK); hci_sched_le()
3975 struct hci_dev *hdev = container_of(work, struct hci_dev, tx_work); hci_tx_work() local
3978 BT_DBG("%s acl %d sco %d le %d", hdev->name, hdev->acl_cnt, hci_tx_work()
3979 hdev->sco_cnt, hdev->le_cnt); hci_tx_work()
3981 if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_tx_work()
3983 hci_sched_acl(hdev); hci_tx_work()
3984 hci_sched_sco(hdev); hci_tx_work()
3985 hci_sched_esco(hdev); hci_tx_work()
3986 hci_sched_le(hdev); hci_tx_work()
3990 while ((skb = skb_dequeue(&hdev->raw_q))) hci_tx_work()
3991 hci_send_frame(hdev, skb); hci_tx_work()
3997 static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) hci_acldata_packet() argument
4009 BT_DBG("%s len %d handle 0x%4.4x flags 0x%4.4x", hdev->name, skb->len, hci_acldata_packet()
4012 hdev->stat.acl_rx++; hci_acldata_packet()
4014 hci_dev_lock(hdev); hci_acldata_packet()
4015 conn = hci_conn_hash_lookup_handle(hdev, handle); hci_acldata_packet()
4016 hci_dev_unlock(hdev); hci_acldata_packet()
4026 hdev->name, handle); hci_acldata_packet()
4033 static void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb) hci_scodata_packet() argument
4043 BT_DBG("%s len %d handle 0x%4.4x", hdev->name, skb->len, handle); hci_scodata_packet()
4045 hdev->stat.sco_rx++; hci_scodata_packet()
4047 hci_dev_lock(hdev); hci_scodata_packet()
4048 conn = hci_conn_hash_lookup_handle(hdev, handle); hci_scodata_packet()
4049 hci_dev_unlock(hdev); hci_scodata_packet()
4057 hdev->name, handle); hci_scodata_packet()
4063 static bool hci_req_is_complete(struct hci_dev *hdev) hci_req_is_complete() argument
4067 skb = skb_peek(&hdev->cmd_q); hci_req_is_complete()
4074 static void hci_resend_last(struct hci_dev *hdev) hci_resend_last() argument
4080 if (!hdev->sent_cmd) hci_resend_last()
4083 sent = (void *) hdev->sent_cmd->data; hci_resend_last()
4088 skb = skb_clone(hdev->sent_cmd, GFP_KERNEL); hci_resend_last()
4092 skb_queue_head(&hdev->cmd_q, skb); hci_resend_last()
4093 queue_work(hdev->workqueue, &hdev->cmd_work); hci_resend_last()
4096 void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status, hci_req_cmd_complete() argument
4108 if (!hci_sent_cmd_data(hdev, opcode)) { hci_req_cmd_complete()
4115 if (test_bit(HCI_INIT, &hdev->flags) && opcode == HCI_OP_RESET) hci_req_cmd_complete()
4116 hci_resend_last(hdev); hci_req_cmd_complete()
4124 if (!status && !hci_req_is_complete(hdev)) hci_req_cmd_complete()
4128 * callback would be found in hdev->sent_cmd instead of the hci_req_cmd_complete()
4129 * command queue (hdev->cmd_q). hci_req_cmd_complete()
4131 if (bt_cb(hdev->sent_cmd)->req.complete) { hci_req_cmd_complete()
4132 *req_complete = bt_cb(hdev->sent_cmd)->req.complete; hci_req_cmd_complete()
4136 if (bt_cb(hdev->sent_cmd)->req.complete_skb) { hci_req_cmd_complete()
4137 *req_complete_skb = bt_cb(hdev->sent_cmd)->req.complete_skb; hci_req_cmd_complete()
4142 spin_lock_irqsave(&hdev->cmd_q.lock, flags); hci_req_cmd_complete()
4143 while ((skb = __skb_dequeue(&hdev->cmd_q))) { hci_req_cmd_complete()
4145 __skb_queue_head(&hdev->cmd_q, skb); hci_req_cmd_complete()
4153 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags); hci_req_cmd_complete()
4158 struct hci_dev *hdev = container_of(work, struct hci_dev, rx_work); hci_rx_work() local
4161 BT_DBG("%s", hdev->name); hci_rx_work()
4163 while ((skb = skb_dequeue(&hdev->rx_q))) { hci_rx_work()
4165 hci_send_to_monitor(hdev, skb); hci_rx_work()
4167 if (atomic_read(&hdev->promisc)) { hci_rx_work()
4169 hci_send_to_sock(hdev, skb); hci_rx_work()
4172 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_rx_work()
4177 if (test_bit(HCI_INIT, &hdev->flags)) { hci_rx_work()
4190 BT_DBG("%s Event packet", hdev->name); hci_rx_work()
4191 hci_event_packet(hdev, skb); hci_rx_work()
4195 BT_DBG("%s ACL data packet", hdev->name); hci_rx_work()
4196 hci_acldata_packet(hdev, skb); hci_rx_work()
4200 BT_DBG("%s SCO data packet", hdev->name); hci_rx_work()
4201 hci_scodata_packet(hdev, skb); hci_rx_work()
4213 struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_work); hci_cmd_work() local
4216 BT_DBG("%s cmd_cnt %d cmd queued %d", hdev->name, hci_cmd_work()
4217 atomic_read(&hdev->cmd_cnt), skb_queue_len(&hdev->cmd_q)); hci_cmd_work()
4220 if (atomic_read(&hdev->cmd_cnt)) { hci_cmd_work()
4221 skb = skb_dequeue(&hdev->cmd_q); hci_cmd_work()
4225 kfree_skb(hdev->sent_cmd); hci_cmd_work()
4227 hdev->sent_cmd = skb_clone(skb, GFP_KERNEL); hci_cmd_work()
4228 if (hdev->sent_cmd) { hci_cmd_work()
4229 atomic_dec(&hdev->cmd_cnt); hci_cmd_work()
4230 hci_send_frame(hdev, skb); hci_cmd_work()
4231 if (test_bit(HCI_RESET, &hdev->flags)) hci_cmd_work()
4232 cancel_delayed_work(&hdev->cmd_timer); hci_cmd_work()
4234 schedule_delayed_work(&hdev->cmd_timer, hci_cmd_work()
4237 skb_queue_head(&hdev->cmd_q, skb); hci_cmd_work()
4238 queue_work(hdev->workqueue, &hdev->cmd_work); hci_cmd_work()
H A Dhci_conn.c64 hci_send_cmd(conn->hdev, HCI_OP_LE_CREATE_CONN_CANCEL, 0, NULL); hci_le_create_connection_cancel()
69 struct hci_dev *hdev = conn->hdev; hci_acl_create_connection() local
81 conn->link_policy = hdev->link_policy; hci_acl_create_connection()
87 ie = hci_inquiry_cache_lookup(hdev, &conn->dst); hci_acl_create_connection()
102 if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER)) hci_acl_create_connection()
107 hci_send_cmd(hdev, HCI_OP_CREATE_CONN, sizeof(cp), &cp); hci_acl_create_connection()
116 if (conn->hdev->hci_ver < BLUETOOTH_VER_1_2) hci_acl_create_connection_cancel()
120 hci_send_cmd(conn->hdev, HCI_OP_CREATE_CONN_CANCEL, sizeof(cp), &cp); hci_acl_create_connection_cancel()
130 hci_send_cmd(conn->hdev, HCI_OP_REJECT_SYNC_CONN_REQ, sizeof(cp), &cp); hci_reject_sco()
145 struct hci_dev *hdev = conn->hdev; hci_disconnect() local
149 hci_send_cmd(hdev, HCI_OP_READ_CLOCK_OFFSET, sizeof(clkoff_cp), hci_disconnect()
157 return hci_send_cmd(conn->hdev, HCI_OP_DISCONNECT, sizeof(cp), &cp); hci_disconnect()
170 hci_send_cmd(conn->hdev, HCI_OP_DISCONN_PHY_LINK, hci_amp_disconn()
176 struct hci_dev *hdev = conn->hdev; hci_add_sco() local
189 hci_send_cmd(hdev, HCI_OP_ADD_SCO, sizeof(cp), &cp); hci_add_sco()
194 struct hci_dev *hdev = conn->hdev; hci_setup_sync() local
236 if (hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp) < 0) hci_setup_sync()
245 struct hci_dev *hdev = conn->hdev; hci_le_conn_update() local
249 hci_dev_lock(hdev); hci_le_conn_update()
251 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); hci_le_conn_update()
259 hci_dev_unlock(hdev); hci_le_conn_update()
270 hci_send_cmd(hdev, HCI_OP_LE_CONN_UPDATE, sizeof(cp), &cp); hci_le_conn_update()
281 struct hci_dev *hdev = conn->hdev; hci_le_start_enc() local
293 hci_send_cmd(hdev, HCI_OP_LE_START_ENC, sizeof(cp), &cp); hci_le_start_enc()
307 if (lmp_esco_capable(conn->hdev)) hci_sco_setup()
369 struct hci_dev *hdev = conn->hdev; hci_conn_idle() local
373 if (!lmp_sniff_capable(hdev) || !lmp_sniff_capable(conn)) hci_conn_idle()
379 if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) { hci_conn_idle()
385 hci_send_cmd(hdev, HCI_OP_SNIFF_SUBRATE, sizeof(cp), &cp); hci_conn_idle()
391 cp.max_interval = cpu_to_le16(hdev->sniff_max_interval); hci_conn_idle()
392 cp.min_interval = cpu_to_le16(hdev->sniff_min_interval); hci_conn_idle()
395 hci_send_cmd(hdev, HCI_OP_SNIFF_MODE, sizeof(cp), &cp); hci_conn_idle()
404 hci_send_cmd(conn->hdev, HCI_OP_USER_CONFIRM_REPLY, sizeof(conn->dst), hci_conn_auto_accept()
412 struct hci_dev *hdev = conn->hdev; le_conn_timeout() local
423 hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), le_conn_timeout()
432 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, hci_conn_add() argument
437 BT_DBG("%s dst %pMR", hdev->name, dst); hci_conn_add()
444 bacpy(&conn->src, &hdev->bdaddr); hci_conn_add()
445 conn->hdev = hdev; hci_conn_add()
451 conn->io_capability = hdev->io_capability; hci_conn_add()
466 conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK; hci_conn_add()
470 hci_copy_identity_address(hdev, &conn->src, &conn->src_type); hci_conn_add()
473 if (lmp_esco_capable(hdev)) hci_conn_add()
474 conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | hci_conn_add()
475 (hdev->esco_type & EDR_ESCO_MASK); hci_conn_add()
477 conn->pkt_type = hdev->pkt_type & SCO_PTYPE_MASK; hci_conn_add()
480 conn->pkt_type = hdev->esco_type & ~EDR_ESCO_MASK; hci_conn_add()
495 hci_dev_hold(hdev); hci_conn_add()
497 hci_conn_hash_add(hdev, conn); hci_conn_add()
498 if (hdev->notify) hci_conn_add()
499 hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); hci_conn_add()
508 struct hci_dev *hdev = conn->hdev; hci_conn_del() local
510 BT_DBG("%s hcon %p handle %d", hdev->name, conn, conn->handle); hci_conn_del()
522 hdev->acl_cnt += conn->sent; hci_conn_del()
526 if (hdev->le_pkts) hci_conn_del()
527 hdev->le_cnt += conn->sent; hci_conn_del()
529 hdev->acl_cnt += conn->sent; hci_conn_del()
543 hci_conn_hash_del(hdev, conn); hci_conn_del()
544 if (hdev->notify) hci_conn_del()
545 hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); hci_conn_del()
554 hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type); hci_conn_del()
556 hci_dev_put(hdev); hci_conn_del()
566 struct hci_dev *hdev = NULL, *d; hci_get_route() local
585 hdev = d; break; hci_get_route()
589 hdev = d; break; hci_get_route()
594 if (hdev) hci_get_route()
595 hdev = hci_dev_hold(hdev); hci_get_route()
598 return hdev; hci_get_route()
602 /* This function requires the caller holds hdev->lock */ hci_le_conn_failed()
605 struct hci_dev *hdev = conn->hdev; hci_le_conn_failed() local
608 params = hci_pend_le_action_lookup(&hdev->pend_le_conns, &conn->dst, hci_le_conn_failed()
618 mgmt_connect_failed(hdev, &conn->dst, conn->type, conn->dst_type, hci_le_conn_failed()
628 hci_update_background_scan(hdev); hci_le_conn_failed()
633 mgmt_reenable_advertising(hdev); hci_le_conn_failed()
636 static void create_le_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode) create_le_conn_complete() argument
646 hci_dev_lock(hdev); create_le_conn_complete()
648 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); create_le_conn_complete()
655 hci_dev_unlock(hdev); create_le_conn_complete()
662 struct hci_dev *hdev = conn->hdev; hci_req_add_le_create_conn() local
673 cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); hci_req_add_le_create_conn()
674 cp.scan_window = cpu_to_le16(hdev->le_scan_window); hci_req_add_le_create_conn()
693 struct hci_dev *hdev = req->hdev; hci_req_directed_advertising() local
703 hci_dev_clear_flag(hdev, HCI_LE_ADV); hci_req_directed_advertising()
716 cp.channel_map = hdev->le_adv_channel_map; hci_req_directed_advertising()
726 struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, hci_connect_le() argument
737 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) { hci_connect_le()
738 if (lmp_le_capable(hdev)) hci_connect_le()
753 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); hci_connect_le()
762 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); hci_connect_le()
779 irk = hci_find_irk_by_addr(hdev, dst, dst_type); hci_connect_le()
785 conn = hci_conn_add(hdev, LE_LINK, dst, role); hci_connect_le()
794 hci_req_init(&req, hdev); hci_connect_le()
802 if (hci_dev_test_flag(hdev, HCI_LE_ADV)) { hci_connect_le()
813 if (hci_dev_test_flag(hdev, HCI_LE_SCAN) && hci_connect_le()
814 hdev->le_scan_type == LE_SCAN_ACTIVE) { hci_connect_le()
824 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); hci_connect_le()
831 conn->le_conn_min_interval = hdev->le_conn_min_interval; hci_connect_le()
832 conn->le_conn_max_interval = hdev->le_conn_max_interval; hci_connect_le()
833 conn->le_conn_latency = hdev->le_conn_latency; hci_connect_le()
834 conn->le_supv_timeout = hdev->le_supv_timeout; hci_connect_le()
843 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { hci_connect_le()
845 hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED); hci_connect_le()
862 struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, hci_connect_acl() argument
867 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { hci_connect_acl()
868 if (lmp_bredr_capable(hdev)) hci_connect_acl()
874 acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); hci_connect_acl()
876 acl = hci_conn_add(hdev, ACL_LINK, dst, HCI_ROLE_MASTER); hci_connect_acl()
893 struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, hci_connect_sco() argument
899 acl = hci_connect_acl(hdev, dst, BT_SECURITY_LOW, HCI_AT_NO_BONDING); hci_connect_sco()
903 sco = hci_conn_hash_lookup_ba(hdev, type, dst); hci_connect_sco()
905 sco = hci_conn_add(hdev, type, dst, HCI_ROLE_MASTER); hci_connect_sco()
945 if (hci_dev_test_flag(conn->hdev, HCI_SC_ONLY)) { hci_conn_check_link_mode()
981 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, hci_conn_auth()
1005 hci_send_cmd(conn->hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), hci_conn_encrypt()
1111 hci_send_cmd(conn->hdev, HCI_OP_SWITCH_ROLE, sizeof(cp), &cp); hci_conn_switch_role()
1121 struct hci_dev *hdev = conn->hdev; hci_conn_enter_active_mode() local
1134 hci_send_cmd(hdev, HCI_OP_EXIT_SNIFF_MODE, sizeof(cp), &cp); hci_conn_enter_active_mode()
1138 if (hdev->idle_timeout > 0) hci_conn_enter_active_mode()
1139 queue_delayed_work(hdev->workqueue, &conn->idle_work, hci_conn_enter_active_mode()
1140 msecs_to_jiffies(hdev->idle_timeout)); hci_conn_enter_active_mode()
1144 void hci_conn_hash_flush(struct hci_dev *hdev) hci_conn_hash_flush() argument
1146 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_flush()
1149 BT_DBG("hdev %s", hdev->name); hci_conn_hash_flush()
1160 void hci_conn_check_pending(struct hci_dev *hdev) hci_conn_check_pending() argument
1164 BT_DBG("hdev %s", hdev->name); hci_conn_check_pending()
1166 hci_dev_lock(hdev); hci_conn_check_pending()
1168 conn = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); hci_conn_check_pending()
1172 hci_dev_unlock(hdev); hci_conn_check_pending()
1202 struct hci_dev *hdev; hci_get_conn_list() local
1217 hdev = hci_dev_get(req.dev_id); hci_get_conn_list()
1218 if (!hdev) { hci_get_conn_list()
1225 hci_dev_lock(hdev); hci_get_conn_list()
1226 list_for_each_entry(c, &hdev->conn_hash.list, list) { hci_get_conn_list()
1236 hci_dev_unlock(hdev); hci_get_conn_list()
1238 cl->dev_id = hdev->id; hci_get_conn_list()
1242 hci_dev_put(hdev); hci_get_conn_list()
1250 int hci_get_conn_info(struct hci_dev *hdev, void __user *arg) hci_get_conn_info() argument
1260 hci_dev_lock(hdev); hci_get_conn_info()
1261 conn = hci_conn_hash_lookup_ba(hdev, req.type, &req.bdaddr); hci_get_conn_info()
1270 hci_dev_unlock(hdev); hci_get_conn_info()
1278 int hci_get_auth_info(struct hci_dev *hdev, void __user *arg) hci_get_auth_info() argument
1286 hci_dev_lock(hdev); hci_get_auth_info()
1287 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr); hci_get_auth_info()
1290 hci_dev_unlock(hdev); hci_get_auth_info()
1300 struct hci_dev *hdev = conn->hdev; hci_chan_create() local
1303 BT_DBG("%s hcon %p", hdev->name, conn); hci_chan_create()
1326 struct hci_dev *hdev = conn->hdev; hci_chan_del() local
1328 BT_DBG("%s hcon %p chan %p", hdev->name, conn, chan); hci_chan_del()
1366 struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle) hci_chan_lookup_handle() argument
1368 struct hci_conn_hash *h = &hdev->conn_hash; hci_chan_lookup_handle()
H A Dhci_request.c30 void hci_req_init(struct hci_request *req, struct hci_dev *hdev) hci_req_init() argument
33 req->hdev = hdev; hci_req_init()
40 struct hci_dev *hdev = req->hdev; req_run() local
62 spin_lock_irqsave(&hdev->cmd_q.lock, flags); req_run()
63 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q); req_run()
64 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags); req_run()
66 queue_work(hdev->workqueue, &hdev->cmd_work); req_run()
81 struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, hci_prepare_cmd() argument
111 struct hci_dev *hdev = req->hdev; hci_req_add_ev() local
114 BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen); hci_req_add_ev()
122 skb = hci_prepare_cmd(hdev, opcode, plen, param); hci_req_add_ev()
125 hdev->name, opcode); hci_req_add_ev()
166 struct hci_dev *hdev = req->hdev; update_white_list() local
177 list_for_each_entry(b, &hdev->le_white_list, list) { update_white_list()
180 if (hci_pend_le_action_lookup(&hdev->pend_le_conns, update_white_list()
182 hci_pend_le_action_lookup(&hdev->pend_le_reports, update_white_list()
205 list_for_each_entry(params, &hdev->pend_le_conns, action) { update_white_list()
206 if (hci_bdaddr_list_lookup(&hdev->le_white_list, update_white_list()
210 if (white_list_entries >= hdev->le_white_list_size) { update_white_list()
215 if (hci_find_irk_by_addr(hdev, &params->addr, update_white_list()
229 list_for_each_entry(params, &hdev->pend_le_reports, action) { update_white_list()
230 if (hci_bdaddr_list_lookup(&hdev->le_white_list, update_white_list()
234 if (white_list_entries >= hdev->le_white_list_size) { update_white_list()
239 if (hci_find_irk_by_addr(hdev, &params->addr, update_white_list()
257 struct hci_dev *hdev = req->hdev; hci_req_add_le_passive_scan() local
285 if (hci_dev_test_flag(hdev, HCI_PRIVACY) && hci_req_add_le_passive_scan()
286 (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) hci_req_add_le_passive_scan()
291 param_cp.interval = cpu_to_le16(hdev->le_scan_interval); hci_req_add_le_passive_scan()
292 param_cp.window = cpu_to_le16(hdev->le_scan_window); hci_req_add_le_passive_scan()
307 struct hci_dev *hdev = req->hdev; set_random_addr() local
319 if (hci_dev_test_flag(hdev, HCI_LE_ADV) || set_random_addr()
320 hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { set_random_addr()
322 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); set_random_addr()
332 struct hci_dev *hdev = req->hdev; hci_update_random_address() local
339 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { hci_update_random_address()
344 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && hci_update_random_address()
345 !bacmp(&hdev->random_addr, &hdev->rpa)) hci_update_random_address()
348 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); hci_update_random_address()
350 BT_ERR("%s failed to generate new RPA", hdev->name); hci_update_random_address()
354 set_random_addr(req, &hdev->rpa); hci_update_random_address()
356 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); hci_update_random_address()
357 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); hci_update_random_address()
380 if (bacmp(&hdev->bdaddr, &nrpa)) hci_update_random_address()
398 if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || hci_update_random_address()
399 !bacmp(&hdev->bdaddr, BDADDR_ANY) || hci_update_random_address()
400 (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && hci_update_random_address()
401 bacmp(&hdev->static_addr, BDADDR_ANY))) { hci_update_random_address()
403 if (bacmp(&hdev->static_addr, &hdev->random_addr)) hci_update_random_address()
405 &hdev->static_addr); hci_update_random_address()
417 static bool disconnected_whitelist_entries(struct hci_dev *hdev) disconnected_whitelist_entries() argument
421 list_for_each_entry(b, &hdev->whitelist, list) { disconnected_whitelist_entries()
424 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr); disconnected_whitelist_entries()
437 struct hci_dev *hdev = req->hdev; __hci_update_page_scan() local
440 if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) __hci_update_page_scan()
443 if (!hdev_is_powered(hdev)) __hci_update_page_scan()
446 if (mgmt_powering_down(hdev)) __hci_update_page_scan()
449 if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) || __hci_update_page_scan()
450 disconnected_whitelist_entries(hdev)) __hci_update_page_scan()
455 if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) __hci_update_page_scan()
458 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) __hci_update_page_scan()
464 void hci_update_page_scan(struct hci_dev *hdev) hci_update_page_scan() argument
468 hci_req_init(&req, hdev); hci_update_page_scan()
473 /* This function controls the background scanning based on hdev->pend_le_conns
477 * This function requires the caller holds hdev->lock.
481 struct hci_dev *hdev = req->hdev; __hci_update_background_scan() local
484 if (!test_bit(HCI_UP, &hdev->flags) || __hci_update_background_scan()
485 test_bit(HCI_INIT, &hdev->flags) || __hci_update_background_scan()
486 hci_dev_test_flag(hdev, HCI_SETUP) || __hci_update_background_scan()
487 hci_dev_test_flag(hdev, HCI_CONFIG) || __hci_update_background_scan()
488 hci_dev_test_flag(hdev, HCI_AUTO_OFF) || __hci_update_background_scan()
489 hci_dev_test_flag(hdev, HCI_UNREGISTER)) __hci_update_background_scan()
493 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) __hci_update_background_scan()
497 if (hdev->discovery.state != DISCOVERY_STOPPED) __hci_update_background_scan()
507 hci_discovery_filter_clear(hdev); __hci_update_background_scan()
509 if (list_empty(&hdev->pend_le_conns) && __hci_update_background_scan()
510 list_empty(&hdev->pend_le_reports)) { __hci_update_background_scan()
517 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) __hci_update_background_scan()
522 BT_DBG("%s stopping background scanning", hdev->name); __hci_update_background_scan()
532 conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); __hci_update_background_scan()
539 if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) __hci_update_background_scan()
544 BT_DBG("%s starting background scanning", hdev->name); __hci_update_background_scan()
548 static void update_background_scan_complete(struct hci_dev *hdev, u8 status, update_background_scan_complete() argument
556 void hci_update_background_scan(struct hci_dev *hdev) hci_update_background_scan() argument
561 hci_req_init(&req, hdev); hci_update_background_scan()
H A Damp.h33 struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
38 void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39 void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40 void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41 void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
43 void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
45 void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
47 void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48 void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
H A Damp.c111 struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, phylink_add() argument
118 hcon = hci_conn_add(hdev, AMP_LINK, dst, role); phylink_add()
176 struct hci_dev *hdev = conn->hdev; phylink_gen_key() local
196 key = hci_find_link_key(hdev, &conn->dst); phylink_gen_key()
223 void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle) amp_read_loc_assoc_frag() argument
226 struct amp_assoc *loc_assoc = &hdev->loc_assoc; amp_read_loc_assoc_frag()
228 BT_DBG("%s handle %d", hdev->name, phy_handle); amp_read_loc_assoc_frag()
231 cp.max_len = cpu_to_le16(hdev->amp_assoc_size); amp_read_loc_assoc_frag()
234 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); amp_read_loc_assoc_frag()
237 void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr) amp_read_loc_assoc() argument
241 memset(&hdev->loc_assoc, 0, sizeof(struct amp_assoc)); amp_read_loc_assoc()
244 cp.max_len = cpu_to_le16(hdev->amp_assoc_size); amp_read_loc_assoc()
247 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); amp_read_loc_assoc()
250 void amp_read_loc_assoc_final_data(struct hci_dev *hdev, amp_read_loc_assoc_final_data() argument
258 cp.max_len = cpu_to_le16(hdev->amp_assoc_size); amp_read_loc_assoc_final_data()
263 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); amp_read_loc_assoc_final_data()
267 static bool amp_write_rem_assoc_frag(struct hci_dev *hdev, amp_write_rem_assoc_frag() argument
310 hci_send_cmd(hdev, HCI_OP_WRITE_REMOTE_AMP_ASSOC, len, cp); amp_write_rem_assoc_frag()
317 void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle) amp_write_rem_assoc_continue() argument
321 BT_DBG("%s phy handle 0x%2.2x", hdev->name, handle); amp_write_rem_assoc_continue()
323 hcon = hci_conn_hash_lookup_handle(hdev, handle); amp_write_rem_assoc_continue()
328 if (amp_write_rem_assoc_frag(hdev, hcon)) amp_write_rem_assoc_continue()
329 a2mp_send_create_phy_link_rsp(hdev, 0); amp_write_rem_assoc_continue()
332 void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) amp_write_remote_assoc() argument
336 BT_DBG("%s phy handle 0x%2.2x", hdev->name, handle); amp_write_remote_assoc()
338 hcon = hci_conn_hash_lookup_handle(hdev, handle); amp_write_remote_assoc()
342 BT_DBG("%s phy handle 0x%2.2x hcon %p", hdev->name, handle, hcon); amp_write_remote_assoc()
344 amp_write_rem_assoc_frag(hdev, hcon); amp_write_remote_assoc()
347 void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, amp_create_phylink() argument
354 BT_DBG("%s hcon %p phy handle 0x%2.2x", hdev->name, hcon, amp_create_phylink()
363 hci_send_cmd(hdev, HCI_OP_CREATE_PHY_LINK, sizeof(cp), &cp); amp_create_phylink()
366 void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr, amp_accept_phylink() argument
373 BT_DBG("%s hcon %p phy handle 0x%2.2x", hdev->name, hcon, amp_accept_phylink()
382 hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp); amp_accept_phylink()
387 struct hci_dev *bredr_hdev = hci_dev_hold(bredr_hcon->hdev); amp_physical_cfm()
402 bredr_chan->local_amp_id = hs_hcon->hdev->id; amp_physical_cfm()
404 bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu; amp_physical_cfm()
417 struct hci_dev *hdev; amp_create_logical_link() local
425 hdev = hci_dev_hold(chan->hs_hcon->hdev); amp_create_logical_link()
426 if (!hdev) amp_create_logical_link()
446 hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp), amp_create_logical_link()
449 hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp), amp_create_logical_link()
452 hci_dev_put(hdev); amp_create_logical_link()
466 hci_send_cmd(hcon->hdev, HCI_OP_DISCONN_LOGICAL_LINK, sizeof(cp), &cp); amp_disconnect_logical_link()
H A Dhci_sysfs.c78 struct hci_dev *hdev = conn->hdev; hci_conn_init_sysfs() local
84 conn->dev.parent = &hdev->dev; hci_conn_init_sysfs()
91 struct hci_dev *hdev = conn->hdev; hci_conn_add_sysfs() local
95 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); hci_conn_add_sysfs()
102 hci_dev_hold(hdev); hci_conn_add_sysfs()
107 struct hci_dev *hdev = conn->hdev; hci_conn_del_sysfs() local
124 hci_dev_put(hdev); hci_conn_del_sysfs()
142 struct hci_dev *hdev = to_hci_dev(dev); show_type() local
143 return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type)); show_type()
149 struct hci_dev *hdev = to_hci_dev(dev); show_name() local
154 name[i] = hdev->dev_name[i]; show_name()
163 struct hci_dev *hdev = to_hci_dev(dev); show_address() local
164 return sprintf(buf, "%pMR\n", &hdev->bdaddr); show_address()
182 struct hci_dev *hdev = to_hci_dev(dev); bt_host_release() local
183 kfree(hdev); bt_host_release()
193 void hci_init_sysfs(struct hci_dev *hdev) hci_init_sysfs() argument
195 struct device *dev = &hdev->dev; hci_init_sysfs()
H A Dhci_sock.c49 struct hci_dev *hdev; member in struct:hci_pinfo
156 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) hci_send_to_sock() argument
161 BT_DBG("hdev %p len %d", hdev, skb->len); hci_send_to_sock()
168 if (sk->sk_state != BT_BOUND || hci_pi(sk)->hdev != hdev) hci_send_to_sock()
252 void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb) hci_send_to_monitor() argument
261 BT_DBG("hdev %p len %d", hdev, skb->len); hci_send_to_monitor()
294 hdr->index = cpu_to_le16(hdev->id); hci_send_to_monitor()
302 static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) create_monitor_event() argument
316 ni->type = hdev->dev_type; create_monitor_event()
317 ni->bus = hdev->bus; create_monitor_event()
318 bacpy(&ni->bdaddr, &hdev->bdaddr); create_monitor_event()
319 memcpy(ni->name, hdev->name, 8); create_monitor_event()
340 hdr->index = cpu_to_le16(hdev->id); create_monitor_event()
348 struct hci_dev *hdev; send_monitor_replay() local
352 list_for_each_entry(hdev, &hci_dev_list, list) { send_monitor_replay()
355 skb = create_monitor_event(hdev, HCI_DEV_REG); send_monitor_replay()
367 static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data) hci_si_event() argument
389 hci_send_to_sock(hdev, skb); hci_si_event()
393 void hci_sock_dev_event(struct hci_dev *hdev, int event) hci_sock_dev_event() argument
397 BT_DBG("hdev %s event %d", hdev->name, event); hci_sock_dev_event()
403 skb = create_monitor_event(hdev, event); hci_sock_dev_event()
413 ev.dev_id = hdev->id; hci_sock_dev_event()
423 if (hci_pi(sk)->hdev == hdev) { hci_sock_dev_event()
424 hci_pi(sk)->hdev = NULL; hci_sock_dev_event()
429 hci_dev_put(hdev); hci_sock_dev_event()
490 struct hci_dev *hdev; hci_sock_release() local
497 hdev = hci_pi(sk)->hdev; hci_sock_release()
504 if (hdev) { hci_sock_release()
506 mgmt_index_added(hdev); hci_sock_release()
507 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); hci_sock_release()
508 hci_dev_close(hdev->id); hci_sock_release()
511 atomic_dec(&hdev->promisc); hci_sock_release()
512 hci_dev_put(hdev); hci_sock_release()
524 static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg) hci_sock_blacklist_add() argument
532 hci_dev_lock(hdev); hci_sock_blacklist_add()
534 err = hci_bdaddr_list_add(&hdev->blacklist, &bdaddr, BDADDR_BREDR); hci_sock_blacklist_add()
536 hci_dev_unlock(hdev); hci_sock_blacklist_add()
541 static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg) hci_sock_blacklist_del() argument
549 hci_dev_lock(hdev); hci_sock_blacklist_del()
551 err = hci_bdaddr_list_del(&hdev->blacklist, &bdaddr, BDADDR_BREDR); hci_sock_blacklist_del()
553 hci_dev_unlock(hdev); hci_sock_blacklist_del()
562 struct hci_dev *hdev = hci_pi(sk)->hdev; hci_sock_bound_ioctl() local
564 if (!hdev) hci_sock_bound_ioctl()
567 if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) hci_sock_bound_ioctl()
570 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) hci_sock_bound_ioctl()
573 if (hdev->dev_type != HCI_BREDR) hci_sock_bound_ioctl()
583 return hci_get_conn_info(hdev, (void __user *) arg); hci_sock_bound_ioctl()
586 return hci_get_auth_info(hdev, (void __user *) arg); hci_sock_bound_ioctl()
591 return hci_sock_blacklist_add(hdev, (void __user *) arg); hci_sock_bound_ioctl()
596 return hci_sock_blacklist_del(hdev, (void __user *) arg); hci_sock_bound_ioctl()
680 struct hci_dev *hdev = NULL; hci_sock_bind() local
704 if (hci_pi(sk)->hdev) { hci_sock_bind()
710 hdev = hci_dev_get(haddr.hci_dev); hci_sock_bind()
711 if (!hdev) { hci_sock_bind()
716 atomic_inc(&hdev->promisc); hci_sock_bind()
719 hci_pi(sk)->hdev = hdev; hci_sock_bind()
723 if (hci_pi(sk)->hdev) { hci_sock_bind()
738 hdev = hci_dev_get(haddr.hci_dev); hci_sock_bind()
739 if (!hdev) { hci_sock_bind()
744 if (test_bit(HCI_INIT, &hdev->flags) || hci_sock_bind()
745 hci_dev_test_flag(hdev, HCI_SETUP) || hci_sock_bind()
746 hci_dev_test_flag(hdev, HCI_CONFIG) || hci_sock_bind()
747 (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) && hci_sock_bind()
748 test_bit(HCI_UP, &hdev->flags))) { hci_sock_bind()
750 hci_dev_put(hdev); hci_sock_bind()
754 if (hci_dev_test_and_set_flag(hdev, HCI_USER_CHANNEL)) { hci_sock_bind()
756 hci_dev_put(hdev); hci_sock_bind()
760 mgmt_index_removed(hdev); hci_sock_bind()
762 err = hci_dev_open(hdev->id); hci_sock_bind()
774 hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); hci_sock_bind()
775 mgmt_index_added(hdev); hci_sock_bind()
776 hci_dev_put(hdev); hci_sock_bind()
781 atomic_inc(&hdev->promisc); hci_sock_bind()
783 hci_pi(sk)->hdev = hdev; hci_sock_bind()
858 struct hci_dev *hdev; hci_sock_getname() local
868 hdev = hci_pi(sk)->hdev; hci_sock_getname()
869 if (!hdev) { hci_sock_getname()
876 haddr->hci_dev = hdev->id; hci_sock_getname()
976 struct hci_dev *hdev = NULL; hci_mgmt_cmd() local
1023 hdev = hci_dev_get(index); hci_mgmt_cmd()
1024 if (!hdev) { hci_mgmt_cmd()
1030 if (hci_dev_test_flag(hdev, HCI_SETUP) || hci_mgmt_cmd()
1031 hci_dev_test_flag(hdev, HCI_CONFIG) || hci_mgmt_cmd()
1032 hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { hci_mgmt_cmd()
1038 if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && hci_mgmt_cmd()
1047 if (no_hdev != !hdev) { hci_mgmt_cmd()
1061 if (hdev && chan->hdev_init) hci_mgmt_cmd()
1062 chan->hdev_init(sk, hdev); hci_mgmt_cmd()
1066 err = handler->func(sk, hdev, cp, len); hci_mgmt_cmd()
1073 if (hdev) hci_mgmt_cmd()
1074 hci_dev_put(hdev); hci_mgmt_cmd()
1085 struct hci_dev *hdev; hci_sock_sendmsg() local
1121 hdev = hci_pi(sk)->hdev; hci_sock_sendmsg()
1122 if (!hdev) { hci_sock_sendmsg()
1127 if (!test_bit(HCI_UP, &hdev->flags)) { hci_sock_sendmsg()
1157 skb_queue_tail(&hdev->raw_q, skb); hci_sock_sendmsg()
1158 queue_work(hdev->workqueue, &hdev->tx_work); hci_sock_sendmsg()
1173 skb_queue_tail(&hdev->raw_q, skb); hci_sock_sendmsg()
1174 queue_work(hdev->workqueue, &hdev->tx_work); hci_sock_sendmsg()
1181 skb_queue_tail(&hdev->cmd_q, skb); hci_sock_sendmsg()
1182 queue_work(hdev->workqueue, &hdev->cmd_work); hci_sock_sendmsg()
1190 skb_queue_tail(&hdev->raw_q, skb); hci_sock_sendmsg()
1191 queue_work(hdev->workqueue, &hdev->tx_work); hci_sock_sendmsg()
H A Da2mp.c100 struct hci_dev *hdev; __a2mp_add_cl() local
107 list_for_each_entry(hdev, &hci_dev_list, list) { __a2mp_add_cl()
108 if (hdev->dev_type == HCI_AMP) { __a2mp_add_cl()
109 cl[i].id = hdev->id; __a2mp_add_cl()
110 cl[i].type = hdev->amp_type; __a2mp_add_cl()
111 if (test_bit(HCI_UP, &hdev->flags)) __a2mp_add_cl()
112 cl[i].status = hdev->amp_status; __a2mp_add_cl()
144 struct hci_dev *hdev; a2mp_discover_req() local
171 list_for_each_entry(hdev, &hci_dev_list, list) { a2mp_discover_req()
172 if (hdev->dev_type == HCI_AMP) a2mp_discover_req()
293 struct hci_dev *hdev; a2mp_getinfo_req() local
300 hdev = hci_dev_get(req->id); a2mp_getinfo_req()
301 if (!hdev || hdev->dev_type != HCI_AMP) { a2mp_getinfo_req()
314 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL); a2mp_getinfo_req()
317 if (hdev) a2mp_getinfo_req()
318 hci_dev_put(hdev); a2mp_getinfo_req()
355 struct hci_dev *hdev; a2mp_getampassoc_req() local
366 hdev = hci_dev_get(req->id); a2mp_getampassoc_req()
367 if (!hdev || hdev->amp_type == AMP_TYPE_BREDR || tmp) { a2mp_getampassoc_req()
384 amp_read_loc_assoc(hdev, mgr); a2mp_getampassoc_req()
387 if (hdev) a2mp_getampassoc_req()
388 hci_dev_put(hdev); a2mp_getampassoc_req()
399 struct hci_dev *hdev; a2mp_getampassoc_rsp() local
435 hdev = hci_dev_get(rsp->id); a2mp_getampassoc_rsp()
436 if (!hdev) a2mp_getampassoc_rsp()
439 hcon = phylink_add(hdev, mgr, rsp->id, true); a2mp_getampassoc_rsp()
443 BT_DBG("Created hcon %p: loc:%d -> rem:%d", hcon, hdev->id, rsp->id); a2mp_getampassoc_rsp()
447 amp_create_phylink(hdev, mgr, hcon); a2mp_getampassoc_rsp()
450 hci_dev_put(hdev); a2mp_getampassoc_rsp()
461 struct hci_dev *hdev; a2mp_createphyslink_req() local
473 hdev = hci_dev_get(req->remote_id); a2mp_createphyslink_req()
474 if (!hdev || hdev->amp_type == AMP_TYPE_BREDR) { a2mp_createphyslink_req()
508 hcon = phylink_add(hdev, mgr, req->local_id, false); a2mp_createphyslink_req()
510 amp_accept_phylink(hdev, mgr, hcon); a2mp_createphyslink_req()
517 if (hdev) a2mp_createphyslink_req()
518 hci_dev_put(hdev); a2mp_createphyslink_req()
540 struct hci_dev *hdev; a2mp_discphyslink_req() local
552 hdev = hci_dev_get(req->remote_id); a2mp_discphyslink_req()
553 if (!hdev) { a2mp_discphyslink_req()
558 hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, a2mp_discphyslink_req()
569 hci_dev_put(hdev); a2mp_discphyslink_req()
882 void a2mp_send_getinfo_rsp(struct hci_dev *hdev) a2mp_send_getinfo_rsp() argument
891 BT_DBG("%s mgr %p", hdev->name, mgr); a2mp_send_getinfo_rsp()
893 rsp.id = hdev->id; a2mp_send_getinfo_rsp()
896 if (hdev->amp_type != AMP_TYPE_BREDR) { a2mp_send_getinfo_rsp()
898 rsp.total_bw = cpu_to_le32(hdev->amp_total_bw); a2mp_send_getinfo_rsp()
899 rsp.max_bw = cpu_to_le32(hdev->amp_max_bw); a2mp_send_getinfo_rsp()
900 rsp.min_latency = cpu_to_le32(hdev->amp_min_latency); a2mp_send_getinfo_rsp()
901 rsp.pal_cap = cpu_to_le16(hdev->amp_pal_cap); a2mp_send_getinfo_rsp()
902 rsp.assoc_size = cpu_to_le16(hdev->amp_assoc_size); a2mp_send_getinfo_rsp()
909 void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status) a2mp_send_getampassoc_rsp() argument
912 struct amp_assoc *loc_assoc = &hdev->loc_assoc; a2mp_send_getampassoc_rsp()
920 BT_DBG("%s mgr %p", hdev->name, mgr); a2mp_send_getampassoc_rsp()
929 rsp->id = hdev->id; a2mp_send_getampassoc_rsp()
943 void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status) a2mp_send_create_phy_link_req() argument
946 struct amp_assoc *loc_assoc = &hdev->loc_assoc; a2mp_send_create_phy_link_req()
957 BT_DBG("%s mgr %p assoc_len %zu", hdev->name, mgr, len); a2mp_send_create_phy_link_req()
969 req->local_id = hdev->id; a2mp_send_create_phy_link_req()
980 void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status) a2mp_send_create_phy_link_rsp() argument
990 hs_hcon = hci_conn_hash_lookup_state(hdev, AMP_LINK, BT_CONNECT); a2mp_send_create_phy_link_rsp()
998 BT_DBG("%s mgr %p hs_hcon %p status %u", hdev->name, mgr, hs_hcon, a2mp_send_create_phy_link_rsp()
1001 rsp.local_id = hdev->id; a2mp_send_create_phy_link_rsp()
H A Dhci_debugfs.h25 void hci_debugfs_create_common(struct hci_dev *hdev);
26 void hci_debugfs_create_bredr(struct hci_dev *hdev);
27 void hci_debugfs_create_le(struct hci_dev *hdev);
32 static inline void hci_debugfs_create_common(struct hci_dev *hdev) hci_debugfs_create_common() argument
36 static inline void hci_debugfs_create_bredr(struct hci_dev *hdev) hci_debugfs_create_bredr() argument
40 static inline void hci_debugfs_create_le(struct hci_dev *hdev) hci_debugfs_create_le() argument
H A Dmgmt_util.c30 int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel, mgmt_send_event() argument
42 if (hdev) mgmt_send_event()
43 hdr->index = cpu_to_le16(hdev->id); mgmt_send_event()
125 struct hci_dev *hdev) mgmt_pending_find()
129 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { mgmt_pending_find()
141 struct hci_dev *hdev, mgmt_pending_find_data()
146 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { mgmt_pending_find_data()
156 void mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev, mgmt_pending_foreach() argument
162 list_for_each_entry_safe(cmd, tmp, &hdev->mgmt_pending, list) { mgmt_pending_foreach()
171 struct hci_dev *hdev, mgmt_pending_add()
181 cmd->index = hdev->id; mgmt_pending_add()
194 list_add(&cmd->list, &hdev->mgmt_pending); mgmt_pending_add()
124 mgmt_pending_find(unsigned short channel, u16 opcode, struct hci_dev *hdev) mgmt_pending_find() argument
139 mgmt_pending_find_data(unsigned short channel, u16 opcode, struct hci_dev *hdev, const void *data) mgmt_pending_find_data() argument
170 mgmt_pending_add(struct sock *sk, u16 opcode, struct hci_dev *hdev, void *data, u16 len) mgmt_pending_add() argument
H A Dhci_request.h24 struct hci_dev *hdev; member in struct:hci_request
33 void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
40 void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status,
44 struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen,
50 void hci_update_page_scan(struct hci_dev *hdev);
56 void hci_update_background_scan(struct hci_dev *hdev);
H A Dmgmt_util.h34 int mgmt_send_event(u16 event, struct hci_dev *hdev, unsigned short channel,
41 struct hci_dev *hdev);
44 struct hci_dev *hdev,
46 void mgmt_pending_foreach(u16 opcode, struct hci_dev *hdev,
50 struct hci_dev *hdev,
H A Dsmp.c490 bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16], smp_irk_matches() argument
493 struct l2cap_chan *chan = hdev->smp_data; smp_irk_matches()
512 int smp_generate_rpa(struct hci_dev *hdev, const u8 irk[16], bdaddr_t *rpa) smp_generate_rpa() argument
514 struct l2cap_chan *chan = hdev->smp_data; smp_generate_rpa()
537 int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) smp_generate_oob() argument
539 struct l2cap_chan *chan = hdev->smp_data; smp_generate_oob()
548 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { smp_generate_oob()
649 struct hci_dev *hdev = hcon->hdev; build_pairing_cmd() local
652 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { build_pairing_cmd()
660 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) build_pairing_cmd()
663 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) build_pairing_cmd()
666 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) && build_pairing_cmd()
671 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { build_pairing_cmd()
681 oob_data = hci_find_remote_oob_data(hdev, &hcon->dst, build_pairing_cmd()
702 req->auth_req = (authreq & AUTH_REQ_MASK(hdev)); build_pairing_cmd()
713 rsp->auth_req = (authreq & AUTH_REQ_MASK(hdev)); build_pairing_cmd()
757 !hci_dev_test_flag(hcon->hdev, HCI_KEEP_DEBUG_KEYS)) { smp_chan_destroy()
917 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst, tk_request()
920 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, tk_request()
924 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst, tk_request()
1019 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, smp_random()
1031 struct hci_dev *hdev = hcon->hdev; smp_notify_keys() local
1037 mgmt_new_irk(hdev, smp->remote_irk); smp_notify_keys()
1045 queue_work(hdev->workqueue, &conn->id_addr_update_work); smp_notify_keys()
1083 mgmt_new_csrk(hdev, smp->csrk, persistent); smp_notify_keys()
1089 mgmt_new_csrk(hdev, smp->slave_csrk, persistent); smp_notify_keys()
1095 mgmt_new_ltk(hdev, smp->ltk, persistent); smp_notify_keys()
1101 mgmt_new_ltk(hdev, smp->slave_ltk, persistent); smp_notify_keys()
1115 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, smp_notify_keys()
1118 mgmt_new_link_key(hdev, key, persistent); smp_notify_keys()
1123 if (!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS) && smp_notify_keys()
1150 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, sc_add_ltk()
1202 struct hci_dev *hdev = hcon->hdev; sc_generate_ltk() local
1205 key = hci_find_link_key(hdev, &hcon->dst); sc_generate_ltk()
1207 BT_ERR("%s No Link Key found to generate LTK", hdev->name); sc_generate_ltk()
1228 struct hci_dev *hdev = hcon->hdev; smp_distribute_keys() local
1278 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, smp_distribute_keys()
1295 memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk)); smp_distribute_keys()
1477 struct hci_dev *hdev = hcon->hdev; sc_passkey_round() local
1549 BT_DBG("%s Starting passkey round %u", hdev->name, sc_passkey_round()
1672 struct hci_dev *hdev = conn->hcon->hdev; build_bredr_pairing_cmd() local
1675 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { build_bredr_pairing_cmd()
1680 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) build_bredr_pairing_cmd()
1683 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) build_bredr_pairing_cmd()
1711 struct hci_dev *hdev = conn->hcon->hdev; smp_cmd_pairing_req() local
1733 auth = req->auth_req & AUTH_REQ_MASK(hdev); smp_cmd_pairing_req()
1735 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && smp_cmd_pairing_req()
1739 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) smp_cmd_pairing_req()
1757 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) smp_cmd_pairing_req()
1840 struct hci_dev *hdev = smp->conn->hcon->hdev; sc_send_public_key() local
1845 struct l2cap_chan *chan = hdev->smp_data; sc_send_public_key()
1863 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { sc_send_public_key()
1897 struct hci_dev *hdev = conn->hcon->hdev; smp_cmd_pairing_rsp() local
1917 auth = rsp->auth_req & AUTH_REQ_MASK(hdev); smp_cmd_pairing_rsp()
1919 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) smp_cmd_pairing_rsp()
2015 struct hci_dev *hdev = hcon->hdev; fixup_sc_false_positive() local
2023 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { fixup_sc_false_positive()
2036 auth = req->auth_req & AUTH_REQ_MASK(hdev); fixup_sc_false_positive()
2168 err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type, smp_cmd_pairing_random()
2183 key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role); smp_ltk_encrypt()
2216 hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role)) smp_sufficient_security()
2230 struct hci_dev *hdev = hcon->hdev; smp_cmd_security_req() local
2242 auth = rp->auth_req & AUTH_REQ_MASK(hdev); smp_cmd_security_req()
2244 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) smp_cmd_security_req()
2265 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && smp_cmd_security_req()
2297 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) smp_conn_security()
2332 if (hci_dev_test_flag(hcon->hdev, HCI_SC_ENABLED)) smp_conn_security()
2391 struct hci_dev *hdev = conn->hcon->hdev; smp_cmd_master_ident() local
2412 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK, smp_cmd_master_ident()
2488 smp->remote_irk = hci_add_irk(conn->hcon->hdev, &smp->id_addr, smp_cmd_ident_addr_info()
2580 struct hci_dev *hdev = hcon->hdev; smp_cmd_public_key() local
2622 BT_DBG("%s selected method 0x%02x", hdev->name, smp->method); smp_cmd_public_key()
2639 if (mgmt_user_passkey_notify(hdev, &hcon->dst, hcon->type, smp_cmd_public_key()
2662 if (mgmt_user_passkey_request(hdev, &hcon->dst, hcon->type, smp_cmd_public_key()
2773 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) { smp_sig_channel()
2869 BT_ERR("%s unexpected SMP command 0x%02x from %pMR", hcon->hdev->name, smp_sig_channel()
2892 struct hci_dev *hdev = hcon->hdev; bredr_pairing() local
2911 if (!hci_dev_test_flag(hdev, HCI_SC_ENABLED)) bredr_pairing()
2916 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) bredr_pairing()
2920 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) bredr_pairing()
2938 hdev->name); bredr_pairing()
2944 BT_DBG("%s starting SMP over BR/EDR", hdev->name); bredr_pairing()
3094 static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) smp_add_cid() argument
3148 hci_copy_identity_address(hdev, &chan->src, &bdaddr_type); smp_add_cid()
3155 bacpy(&chan->src, &hdev->bdaddr); smp_add_cid()
3193 struct hci_dev *hdev = file->private_data; force_bredr_smp_read() local
3196 buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP) ? 'Y': 'N'; force_bredr_smp_read()
3206 struct hci_dev *hdev = file->private_data; force_bredr_smp_write() local
3218 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) force_bredr_smp_write()
3224 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); force_bredr_smp_write()
3228 hdev->smp_bredr_data = chan; force_bredr_smp_write()
3232 chan = hdev->smp_bredr_data; force_bredr_smp_write()
3233 hdev->smp_bredr_data = NULL; force_bredr_smp_write()
3237 hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP); force_bredr_smp_write()
3249 int smp_register(struct hci_dev *hdev) smp_register() argument
3253 BT_DBG("%s", hdev->name); smp_register()
3258 if (!lmp_le_capable(hdev)) smp_register()
3261 if (WARN_ON(hdev->smp_data)) { smp_register()
3262 chan = hdev->smp_data; smp_register()
3263 hdev->smp_data = NULL; smp_register()
3267 chan = smp_add_cid(hdev, L2CAP_CID_SMP); smp_register()
3271 hdev->smp_data = chan; smp_register()
3280 if (!lmp_sc_capable(hdev)) { smp_register()
3281 debugfs_create_file("force_bredr_smp", 0644, hdev->debugfs, smp_register()
3282 hdev, &force_bredr_smp_fops); smp_register()
3286 if (WARN_ON(hdev->smp_bredr_data)) { smp_register()
3287 chan = hdev->smp_bredr_data; smp_register()
3288 hdev->smp_bredr_data = NULL; smp_register()
3292 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); smp_register()
3295 chan = hdev->smp_data; smp_register()
3296 hdev->smp_data = NULL; smp_register()
3301 hdev->smp_bredr_data = chan; smp_register()
3306 void smp_unregister(struct hci_dev *hdev) smp_unregister() argument
3310 if (hdev->smp_bredr_data) { smp_unregister()
3311 chan = hdev->smp_bredr_data; smp_unregister()
3312 hdev->smp_bredr_data = NULL; smp_unregister()
3316 if (hdev->smp_data) { smp_unregister()
3317 chan = hdev->smp_data; smp_unregister()
3318 hdev->smp_data = NULL; smp_unregister()
H A Da2mp.h137 void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
138 void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
139 void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
140 void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
H A Dsmp.h188 bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16],
190 int smp_generate_rpa(struct hci_dev *hdev, const u8 irk[16], bdaddr_t *rpa);
191 int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]);
193 int smp_register(struct hci_dev *hdev);
194 void smp_unregister(struct hci_dev *hdev);
H A Dsco.c105 struct hci_dev *hdev = hcon->hdev; sco_conn_add() local
120 if (hdev->sco_mtu > 0) sco_conn_add()
121 conn->mtu = hdev->sco_mtu; sco_conn_add()
215 struct hci_dev *hdev; sco_connect() local
220 hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src); sco_connect()
221 if (!hdev) sco_connect()
224 hci_dev_lock(hdev); sco_connect()
226 if (lmp_esco_capable(hdev) && !disable_esco) sco_connect()
232 (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) { sco_connect()
237 hcon = hci_connect_sco(hdev, type, &sco_pi(sk)->dst, sco_connect()
267 hci_dev_unlock(hdev); sco_connect()
268 hci_dev_put(hdev); sco_connect()
722 struct hci_dev *hdev = conn->hdev; sco_conn_defer_accept() local
728 if (!lmp_esco_capable(hdev)) { sco_conn_defer_accept()
734 hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); sco_conn_defer_accept()
759 hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, sco_conn_defer_accept()
1062 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) sco_connect_ind() argument
1067 BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr); sco_connect_ind()
1075 if (!bacmp(&sco_pi(sk)->src, &hdev->bdaddr) || sco_connect_ind()
H A Dl2cap_core.c854 if (lmp_no_flush_capable(conn->hcon->hdev) || l2cap_send_cmd()
895 lmp_no_flush_capable(hcon->hdev))) l2cap_do_send()
1129 struct hci_dev *hdev; __amp_capable() local
1139 list_for_each_entry(hdev, &hci_dev_list, list) { __amp_capable()
1140 if (hdev->amp_type != AMP_TYPE_BREDR && __amp_capable()
1141 test_bit(HCI_UP, &hdev->flags)) { __amp_capable()
1478 struct hci_dev *hdev = hcon->hdev; l2cap_le_conn_ready() local
1480 BT_DBG("%s conn %p", hdev->name, conn); l2cap_le_conn_ready()
1546 queue_work(hcon->hdev->workqueue, &conn->pending_rx_work); l2cap_conn_ready()
1592 struct hci_dev *hdev = conn->hcon->hdev; l2cap_register_user() local
1602 hci_dev_lock(hdev); l2cap_register_user()
1623 hci_dev_unlock(hdev); l2cap_register_user()
1630 struct hci_dev *hdev = conn->hcon->hdev; l2cap_unregister_user() local
1632 hci_dev_lock(hdev); l2cap_unregister_user()
1643 hci_dev_unlock(hdev); l2cap_unregister_user()
3128 u64 ertm_to = chan->hs_hcon->hdev->amp_be_flush_to; __l2cap_set_ertm_timeouts()
3896 struct hci_dev *hdev = conn->hcon->hdev; l2cap_connect_req() local
3902 hci_dev_lock(hdev); l2cap_connect_req()
3903 if (hci_dev_test_flag(hdev, HCI_MGMT) && l2cap_connect_req()
3905 mgmt_device_connected(hdev, hcon, 0, NULL, 0); l2cap_connect_req()
3906 hci_dev_unlock(hdev); l2cap_connect_req()
4452 struct hci_dev *hdev; l2cap_create_channel_req() local
4474 hdev = hci_dev_get(req->amp_id); l2cap_create_channel_req()
4475 if (!hdev) l2cap_create_channel_req()
4478 if (hdev->dev_type != HCI_AMP || !test_bit(HCI_UP, &hdev->flags)) { l2cap_create_channel_req()
4479 hci_dev_put(hdev); l2cap_create_channel_req()
4489 hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, l2cap_create_channel_req()
4492 hci_dev_put(hdev); l2cap_create_channel_req()
4503 conn->mtu = hdev->block_mtu; l2cap_create_channel_req()
4506 hci_dev_put(hdev); l2cap_create_channel_req()
4916 struct hci_dev *hdev; l2cap_move_channel_req() local
4917 hdev = hci_dev_get(req->dest_amp_id); l2cap_move_channel_req()
4918 if (!hdev || hdev->dev_type != HCI_AMP || l2cap_move_channel_req()
4919 !test_bit(HCI_UP, &hdev->flags)) { l2cap_move_channel_req()
4920 if (hdev) l2cap_move_channel_req()
4921 hci_dev_put(hdev); l2cap_move_channel_req()
4926 hci_dev_put(hdev); l2cap_move_channel_req()
5229 mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type, l2cap_conn_param_update_req()
6399 chan->conn->mtu = chan->hs_hcon->hdev->block_mtu; l2cap_finish_move()
6401 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; l2cap_finish_move()
6470 chan->conn->mtu = chan->hs_hcon->hdev->block_mtu; l2cap_rx_state_wait_f()
6472 chan->conn->mtu = chan->conn->hcon->hdev->acl_mtu; l2cap_rx_state_wait_f()
6907 hci_bdaddr_list_lookup(&hcon->hdev->blacklist, &hcon->dst, l2cap_recv_frame()
6975 if (hcon->hdev->le_mtu) { l2cap_conn_add()
6976 conn->mtu = hcon->hdev->le_mtu; l2cap_conn_add()
6981 conn->mtu = hcon->hdev->acl_mtu; l2cap_conn_add()
6990 hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED)) l2cap_conn_add()
6993 if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) && l2cap_conn_add()
6994 (bredr_sc_enabled(hcon->hdev) || l2cap_conn_add()
6995 hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP))) l2cap_conn_add()
7031 struct hci_dev *hdev; l2cap_chan_connect() local
7037 hdev = hci_get_route(dst, &chan->src); l2cap_chan_connect()
7038 if (!hdev) l2cap_chan_connect()
7041 hci_dev_lock(hdev); l2cap_chan_connect()
7115 if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) l2cap_chan_connect()
7120 hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level, l2cap_chan_connect()
7124 hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type); l2cap_chan_connect()
7182 hci_dev_unlock(hdev); l2cap_chan_connect()
7183 hci_dev_put(hdev); l2cap_chan_connect()
7190 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) l2cap_connect_ind() argument
7195 BT_DBG("hdev %s, bdaddr %pMR", hdev->name, bdaddr); l2cap_connect_ind()
7203 if (!bacmp(&c->src, &hdev->bdaddr)) { l2cap_connect_ind()
7257 struct hci_dev *hdev = hcon->hdev; l2cap_connect_cfm() local
7279 if (hci_bdaddr_list_lookup(&hdev->blacklist, &hcon->dst, dst_type)) l2cap_connect_cfm()
7452 if (!conn && hcon->hdev->dev_type != HCI_BREDR) l2cap_recv_acldata()
H A D6lowpan.c77 struct hci_dev *hdev; member in struct:lowpan_dev
250 if (conn->hcon->hdev == entry->hdev) { lookup_dev()
876 (*dev)->hdev = chan->conn->hcon->hdev; setup_netdev()
1145 struct hci_dev *hdev; get_l2cap_conn() local
1157 hdev = hci_get_route(addr, src); get_l2cap_conn()
1158 if (!hdev) get_l2cap_conn()
1161 hci_dev_lock(hdev); get_l2cap_conn()
1162 hcon = hci_conn_hash_lookup_ba(hdev, LE_LINK, addr); get_l2cap_conn()
1163 hci_dev_unlock(hdev); get_l2cap_conn()
/linux-4.1.27/net/nfc/hci/
H A Dcore.c49 void nfc_hci_reset_pipes(struct nfc_hci_dev *hdev) nfc_hci_reset_pipes() argument
54 hdev->pipes[i].gate = NFC_HCI_INVALID_GATE; nfc_hci_reset_pipes()
55 hdev->pipes[i].dest_host = NFC_HCI_INVALID_HOST; nfc_hci_reset_pipes()
57 memset(hdev->gate2pipe, NFC_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe)); nfc_hci_reset_pipes()
61 void nfc_hci_reset_pipes_per_host(struct nfc_hci_dev *hdev, u8 host) nfc_hci_reset_pipes_per_host() argument
66 if (hdev->pipes[i].dest_host != host) nfc_hci_reset_pipes_per_host()
69 hdev->pipes[i].gate = NFC_HCI_INVALID_GATE; nfc_hci_reset_pipes_per_host()
70 hdev->pipes[i].dest_host = NFC_HCI_INVALID_HOST; nfc_hci_reset_pipes_per_host()
77 struct nfc_hci_dev *hdev = container_of(work, struct nfc_hci_dev, nfc_hci_msg_tx_work() local
83 mutex_lock(&hdev->msg_tx_mutex); nfc_hci_msg_tx_work()
84 if (hdev->shutting_down) nfc_hci_msg_tx_work()
87 if (hdev->cmd_pending_msg) { nfc_hci_msg_tx_work()
88 if (timer_pending(&hdev->cmd_timer) == 0) { nfc_hci_msg_tx_work()
89 if (hdev->cmd_pending_msg->cb) nfc_hci_msg_tx_work()
90 hdev->cmd_pending_msg->cb(hdev-> nfc_hci_msg_tx_work()
95 kfree(hdev->cmd_pending_msg); nfc_hci_msg_tx_work()
96 hdev->cmd_pending_msg = NULL; nfc_hci_msg_tx_work()
103 if (list_empty(&hdev->msg_tx_queue)) nfc_hci_msg_tx_work()
106 msg = list_first_entry(&hdev->msg_tx_queue, struct hci_msg, msg_l); nfc_hci_msg_tx_work()
111 r = nfc_llc_xmit_from_hci(hdev->llc, skb); nfc_hci_msg_tx_work()
130 hdev->cmd_pending_msg = msg; nfc_hci_msg_tx_work()
131 mod_timer(&hdev->cmd_timer, jiffies + nfc_hci_msg_tx_work()
132 msecs_to_jiffies(hdev->cmd_pending_msg->completion_delay)); nfc_hci_msg_tx_work()
135 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_msg_tx_work()
140 struct nfc_hci_dev *hdev = container_of(work, struct nfc_hci_dev, nfc_hci_msg_rx_work() local
148 while ((skb = skb_dequeue(&hdev->msg_rx_queue)) != NULL) { nfc_hci_msg_rx_work()
156 nfc_hci_hcp_message_rx(hdev, pipe, type, instruction, skb); nfc_hci_msg_rx_work()
160 static void __nfc_hci_cmd_completion(struct nfc_hci_dev *hdev, int err, __nfc_hci_cmd_completion() argument
163 del_timer_sync(&hdev->cmd_timer); __nfc_hci_cmd_completion()
165 if (hdev->cmd_pending_msg->cb) __nfc_hci_cmd_completion()
166 hdev->cmd_pending_msg->cb(hdev->cmd_pending_msg->cb_context, __nfc_hci_cmd_completion()
171 kfree(hdev->cmd_pending_msg); __nfc_hci_cmd_completion()
172 hdev->cmd_pending_msg = NULL; __nfc_hci_cmd_completion()
174 schedule_work(&hdev->msg_tx_work); __nfc_hci_cmd_completion()
177 void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result, nfc_hci_resp_received() argument
180 mutex_lock(&hdev->msg_tx_mutex); nfc_hci_resp_received()
182 if (hdev->cmd_pending_msg == NULL) { nfc_hci_resp_received()
187 __nfc_hci_cmd_completion(hdev, nfc_hci_result_to_errno(result), skb); nfc_hci_resp_received()
190 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_resp_received()
193 void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, nfc_hci_cmd_received() argument
196 u8 gate = hdev->pipes[pipe].gate; nfc_hci_cmd_received()
217 hdev->gate2pipe[create_info->dest_gate] = create_info->pipe; nfc_hci_cmd_received()
218 hdev->pipes[create_info->pipe].gate = create_info->dest_gate; nfc_hci_cmd_received()
219 hdev->pipes[create_info->pipe].dest_host = nfc_hci_cmd_received()
235 hdev->pipes[delete_info->pipe].gate = NFC_HCI_INVALID_GATE; nfc_hci_cmd_received()
236 hdev->pipes[delete_info->pipe].dest_host = NFC_HCI_INVALID_HOST; nfc_hci_cmd_received()
245 nfc_hci_reset_pipes_per_host(hdev, cleared_info->host); nfc_hci_cmd_received()
252 if (hdev->ops->cmd_received) nfc_hci_cmd_received()
253 hdev->ops->cmd_received(hdev, pipe, cmd, skb); nfc_hci_cmd_received()
256 nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, nfc_hci_cmd_received()
279 int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate) nfc_hci_target_discovered() argument
295 r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE, nfc_hci_target_discovered()
300 r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE, nfc_hci_target_discovered()
320 r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE, nfc_hci_target_discovered()
333 if (hdev->ops->complete_target_discovered) { nfc_hci_target_discovered()
334 r = hdev->ops->complete_target_discovered(hdev, gate, nfc_hci_target_discovered()
344 if (hdev->ops->target_from_gate) nfc_hci_target_discovered()
345 r = hdev->ops->target_from_gate(hdev, gate, targets); nfc_hci_target_discovered()
351 if (hdev->ops->complete_target_discovered) { nfc_hci_target_discovered()
352 r = hdev->ops->complete_target_discovered(hdev, gate, nfc_hci_target_discovered()
364 r = nfc_targets_found(hdev->ndev, targets, 1); nfc_hci_target_discovered()
376 void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, nfc_hci_event_received() argument
380 u8 gate = hdev->pipes[pipe].gate; nfc_hci_event_received()
387 if (hdev->ops->event_received) { nfc_hci_event_received()
388 r = hdev->ops->event_received(hdev, pipe, event, skb); nfc_hci_event_received()
415 r = nfc_hci_target_discovered(hdev, gate); nfc_hci_event_received()
428 nfc_hci_driver_failure(hdev, r); nfc_hci_event_received()
433 struct nfc_hci_dev *hdev = (struct nfc_hci_dev *)data; nfc_hci_cmd_timeout() local
435 schedule_work(&hdev->msg_tx_work); nfc_hci_cmd_timeout()
438 static int hci_dev_connect_gates(struct nfc_hci_dev *hdev, u8 gate_count, hci_dev_connect_gates() argument
443 r = nfc_hci_connect_gate(hdev, NFC_HCI_HOST_CONTROLLER_ID, hci_dev_connect_gates()
453 static int hci_dev_session_init(struct nfc_hci_dev *hdev) hci_dev_session_init() argument
458 if (hdev->init_data.gates[0].gate != NFC_HCI_ADMIN_GATE) hci_dev_session_init()
461 r = nfc_hci_connect_gate(hdev, NFC_HCI_HOST_CONTROLLER_ID, hci_dev_session_init()
462 hdev->init_data.gates[0].gate, hci_dev_session_init()
463 hdev->init_data.gates[0].pipe); hci_dev_session_init()
467 r = nfc_hci_get_param(hdev, NFC_HCI_ADMIN_GATE, hci_dev_session_init()
472 if (skb->len && skb->len == strlen(hdev->init_data.session_id) && hci_dev_session_init()
473 (memcmp(hdev->init_data.session_id, skb->data, hci_dev_session_init()
474 skb->len) == 0) && hdev->ops->load_session) { hci_dev_session_init()
477 r = hdev->ops->load_session(hdev); hci_dev_session_init()
483 r = nfc_hci_disconnect_all_gates(hdev); hci_dev_session_init()
487 r = hci_dev_connect_gates(hdev, hdev->init_data.gate_count, hci_dev_session_init()
488 hdev->init_data.gates); hci_dev_session_init()
492 r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, hci_dev_session_init()
494 hdev->init_data.session_id, hci_dev_session_init()
495 strlen(hdev->init_data.session_id)); hci_dev_session_init()
501 nfc_hci_disconnect_all_gates(hdev); hci_dev_session_init()
509 static int hci_dev_version(struct nfc_hci_dev *hdev) hci_dev_version() argument
514 r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE, hci_dev_version()
528 hdev->sw_romlib = (skb->data[0] & 0xf0) >> 4; hci_dev_version()
529 hdev->sw_patch = skb->data[0] & 0x0f; hci_dev_version()
530 hdev->sw_flashlib_major = skb->data[1]; hci_dev_version()
531 hdev->sw_flashlib_minor = skb->data[2]; hci_dev_version()
535 r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE, hci_dev_version()
545 hdev->hw_derivative = (skb->data[0] & 0xe0) >> 5; hci_dev_version()
546 hdev->hw_version = skb->data[0] & 0x1f; hci_dev_version()
547 hdev->hw_mpw = (skb->data[1] & 0xc0) >> 6; hci_dev_version()
548 hdev->hw_software = skb->data[1] & 0x3f; hci_dev_version()
549 hdev->hw_bsid = skb->data[2]; hci_dev_version()
554 pr_info("RomLib : %d\n", hdev->sw_romlib); hci_dev_version()
555 pr_info("Patch : %d\n", hdev->sw_patch); hci_dev_version()
556 pr_info("FlashLib Major : %d\n", hdev->sw_flashlib_major); hci_dev_version()
557 pr_info("FlashLib Minor : %d\n", hdev->sw_flashlib_minor); hci_dev_version()
559 pr_info("Derivative : %d\n", hdev->hw_derivative); hci_dev_version()
560 pr_info("HW Version : %d\n", hdev->hw_version); hci_dev_version()
561 pr_info("#MPW : %d\n", hdev->hw_mpw); hci_dev_version()
562 pr_info("Software : %d\n", hdev->hw_software); hci_dev_version()
563 pr_info("BSID Version : %d\n", hdev->hw_bsid); hci_dev_version()
570 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_dev_up() local
573 if (hdev->ops->open) { hci_dev_up()
574 r = hdev->ops->open(hdev); hci_dev_up()
579 r = nfc_llc_start(hdev->llc); hci_dev_up()
583 r = hci_dev_session_init(hdev); hci_dev_up()
587 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, hci_dev_up()
592 if (hdev->ops->hci_ready) { hci_dev_up()
593 r = hdev->ops->hci_ready(hdev); hci_dev_up()
598 r = hci_dev_version(hdev); hci_dev_up()
605 nfc_llc_stop(hdev->llc); hci_dev_up()
608 if (hdev->ops->close) hci_dev_up()
609 hdev->ops->close(hdev); hci_dev_up()
616 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_dev_down() local
618 nfc_llc_stop(hdev->llc); hci_dev_down()
620 if (hdev->ops->close) hci_dev_down()
621 hdev->ops->close(hdev); hci_dev_down()
623 nfc_hci_reset_pipes(hdev); hci_dev_down()
631 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_start_poll() local
633 if (hdev->ops->start_poll) hci_start_poll()
634 return hdev->ops->start_poll(hdev, im_protocols, tm_protocols); hci_start_poll()
636 return nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, hci_start_poll()
643 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_stop_poll() local
645 if (hdev->ops->stop_poll) hci_stop_poll()
646 hdev->ops->stop_poll(hdev); hci_stop_poll()
648 nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, hci_stop_poll()
655 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_dep_link_up() local
657 if (!hdev->ops->dep_link_up) hci_dep_link_up()
660 return hdev->ops->dep_link_up(hdev, target, comm_mode, hci_dep_link_up()
666 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_dep_link_down() local
668 if (!hdev->ops->dep_link_down) hci_dep_link_down()
671 return hdev->ops->dep_link_down(hdev); hci_dep_link_down()
689 struct nfc_hci_dev *hdev = context; hci_transceive_cb() local
691 switch (hdev->async_cb_type) { hci_transceive_cb()
701 hdev->async_cb(hdev->async_cb_context, skb, err); hci_transceive_cb()
714 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_transceive() local
722 if (hdev->ops->im_transceive) { hci_transceive()
723 r = hdev->ops->im_transceive(hdev, target, skb, cb, hci_transceive()
731 hdev->async_cb_type = HCI_CB_TYPE_TRANSCEIVE; hci_transceive()
732 hdev->async_cb = cb; hci_transceive()
733 hdev->async_cb_context = cb_context; hci_transceive()
735 r = nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, hci_transceive()
737 skb->len, hci_transceive_cb, hdev); hci_transceive()
740 if (hdev->ops->im_transceive) { hci_transceive()
741 r = hdev->ops->im_transceive(hdev, target, skb, cb, hci_transceive()
758 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_tm_send() local
760 if (!hdev->ops->tm_send) { hci_tm_send()
765 return hdev->ops->tm_send(hdev, skb); hci_tm_send()
771 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_check_presence() local
773 if (!hdev->ops->check_presence) hci_check_presence()
776 return hdev->ops->check_presence(hdev, target); hci_check_presence()
781 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_discover_se() local
783 if (hdev->ops->discover_se) hci_discover_se()
784 return hdev->ops->discover_se(hdev); hci_discover_se()
791 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_enable_se() local
793 if (hdev->ops->enable_se) hci_enable_se()
794 return hdev->ops->enable_se(hdev, se_idx); hci_enable_se()
801 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_disable_se() local
803 if (hdev->ops->disable_se) hci_disable_se()
804 return hdev->ops->disable_se(hdev, se_idx); hci_disable_se()
813 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_se_io() local
815 if (hdev->ops->se_io) hci_se_io()
816 return hdev->ops->se_io(hdev, se_idx, apdu, hci_se_io()
822 static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err) nfc_hci_failure() argument
824 mutex_lock(&hdev->msg_tx_mutex); nfc_hci_failure()
826 if (hdev->cmd_pending_msg == NULL) { nfc_hci_failure()
827 nfc_driver_failure(hdev->ndev, err); nfc_hci_failure()
831 __nfc_hci_cmd_completion(hdev, err, NULL); nfc_hci_failure()
834 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_failure()
837 static void nfc_hci_llc_failure(struct nfc_hci_dev *hdev, int err) nfc_hci_llc_failure() argument
839 nfc_hci_failure(hdev, err); nfc_hci_llc_failure()
842 static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) nfc_hci_recv_from_llc() argument
854 skb_queue_tail(&hdev->rx_hcp_frags, skb); nfc_hci_recv_from_llc()
859 if (skb_queue_len(&hdev->rx_hcp_frags)) { nfc_hci_recv_from_llc()
861 skb_queue_tail(&hdev->rx_hcp_frags, skb); nfc_hci_recv_from_llc()
864 skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { nfc_hci_recv_from_llc()
872 nfc_hci_failure(hdev, -ENOMEM); nfc_hci_recv_from_llc()
878 skb_queue_walk(&hdev->rx_hcp_frags, frag_skb) { nfc_hci_recv_from_llc()
885 skb_queue_purge(&hdev->rx_hcp_frags); nfc_hci_recv_from_llc()
902 nfc_hci_hcp_message_rx(hdev, pipe, type, instruction, hcp_skb); nfc_hci_recv_from_llc()
904 skb_queue_tail(&hdev->msg_rx_queue, hcp_skb); nfc_hci_recv_from_llc()
905 schedule_work(&hdev->msg_rx_work); nfc_hci_recv_from_llc()
911 struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); hci_fw_download() local
913 if (!hdev->ops->fw_download) hci_fw_download()
916 return hdev->ops->fw_download(hdev, firmware_name); hci_fw_download()
947 struct nfc_hci_dev *hdev; nfc_hci_allocate_device() local
955 hdev = kzalloc(sizeof(struct nfc_hci_dev), GFP_KERNEL); nfc_hci_allocate_device()
956 if (hdev == NULL) nfc_hci_allocate_device()
959 hdev->llc = nfc_llc_allocate(llc_name, hdev, ops->xmit, nfc_hci_allocate_device()
962 if (hdev->llc == NULL) { nfc_hci_allocate_device()
963 kfree(hdev); nfc_hci_allocate_device()
967 hdev->ndev = nfc_allocate_device(&hci_nfc_ops, protocols, nfc_hci_allocate_device()
970 if (!hdev->ndev) { nfc_hci_allocate_device()
971 nfc_llc_free(hdev->llc); nfc_hci_allocate_device()
972 kfree(hdev); nfc_hci_allocate_device()
976 hdev->ops = ops; nfc_hci_allocate_device()
977 hdev->max_data_link_payload = max_link_payload; nfc_hci_allocate_device()
978 hdev->init_data = *init_data; nfc_hci_allocate_device()
980 nfc_set_drvdata(hdev->ndev, hdev); nfc_hci_allocate_device()
982 nfc_hci_reset_pipes(hdev); nfc_hci_allocate_device()
984 hdev->quirks = quirks; nfc_hci_allocate_device()
986 return hdev; nfc_hci_allocate_device()
990 void nfc_hci_free_device(struct nfc_hci_dev *hdev) nfc_hci_free_device() argument
992 nfc_free_device(hdev->ndev); nfc_hci_free_device()
993 nfc_llc_free(hdev->llc); nfc_hci_free_device()
994 kfree(hdev); nfc_hci_free_device()
998 int nfc_hci_register_device(struct nfc_hci_dev *hdev) nfc_hci_register_device() argument
1000 mutex_init(&hdev->msg_tx_mutex); nfc_hci_register_device()
1002 INIT_LIST_HEAD(&hdev->msg_tx_queue); nfc_hci_register_device()
1004 INIT_WORK(&hdev->msg_tx_work, nfc_hci_msg_tx_work); nfc_hci_register_device()
1006 init_timer(&hdev->cmd_timer); nfc_hci_register_device()
1007 hdev->cmd_timer.data = (unsigned long)hdev; nfc_hci_register_device()
1008 hdev->cmd_timer.function = nfc_hci_cmd_timeout; nfc_hci_register_device()
1010 skb_queue_head_init(&hdev->rx_hcp_frags); nfc_hci_register_device()
1012 INIT_WORK(&hdev->msg_rx_work, nfc_hci_msg_rx_work); nfc_hci_register_device()
1014 skb_queue_head_init(&hdev->msg_rx_queue); nfc_hci_register_device()
1016 return nfc_register_device(hdev->ndev); nfc_hci_register_device()
1020 void nfc_hci_unregister_device(struct nfc_hci_dev *hdev) nfc_hci_unregister_device() argument
1024 mutex_lock(&hdev->msg_tx_mutex); nfc_hci_unregister_device()
1026 if (hdev->cmd_pending_msg) { nfc_hci_unregister_device()
1027 if (hdev->cmd_pending_msg->cb) nfc_hci_unregister_device()
1028 hdev->cmd_pending_msg->cb( nfc_hci_unregister_device()
1029 hdev->cmd_pending_msg->cb_context, nfc_hci_unregister_device()
1031 kfree(hdev->cmd_pending_msg); nfc_hci_unregister_device()
1032 hdev->cmd_pending_msg = NULL; nfc_hci_unregister_device()
1035 hdev->shutting_down = true; nfc_hci_unregister_device()
1037 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_unregister_device()
1039 del_timer_sync(&hdev->cmd_timer); nfc_hci_unregister_device()
1040 cancel_work_sync(&hdev->msg_tx_work); nfc_hci_unregister_device()
1042 cancel_work_sync(&hdev->msg_rx_work); nfc_hci_unregister_device()
1044 nfc_unregister_device(hdev->ndev); nfc_hci_unregister_device()
1046 skb_queue_purge(&hdev->rx_hcp_frags); nfc_hci_unregister_device()
1047 skb_queue_purge(&hdev->msg_rx_queue); nfc_hci_unregister_device()
1049 list_for_each_entry_safe(msg, n, &hdev->msg_tx_queue, msg_l) { nfc_hci_unregister_device()
1057 void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata) nfc_hci_set_clientdata() argument
1059 hdev->clientdata = clientdata; nfc_hci_set_clientdata()
1063 void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev) nfc_hci_get_clientdata() argument
1065 return hdev->clientdata; nfc_hci_get_clientdata()
1069 void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err) nfc_hci_driver_failure() argument
1071 nfc_hci_failure(hdev, err); nfc_hci_driver_failure()
1075 void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb) nfc_hci_recv_frame() argument
1077 nfc_llc_rcv_from_drv(hdev->llc, skb); nfc_hci_recv_frame()
H A Dcommand.c31 static int nfc_hci_execute_cmd_async(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, nfc_hci_execute_cmd_async() argument
41 return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_COMMAND, cmd, nfc_hci_execute_cmd_async()
67 static int nfc_hci_execute_cmd(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, nfc_hci_execute_cmd() argument
83 hcp_ew.exec_result = nfc_hci_hcp_message_tx(hdev, pipe, nfc_hci_execute_cmd()
103 int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, nfc_hci_send_event() argument
110 pipe = hdev->gate2pipe[gate]; nfc_hci_send_event()
114 return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_EVENT, event, nfc_hci_send_event()
124 int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, nfc_hci_send_cmd() argument
131 pipe = hdev->gate2pipe[gate]; nfc_hci_send_cmd()
135 return nfc_hci_execute_cmd(hdev, pipe, cmd, param, param_len, skb); nfc_hci_send_cmd()
139 int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, nfc_hci_send_cmd_async() argument
147 pipe = hdev->gate2pipe[gate]; nfc_hci_send_cmd_async()
151 return nfc_hci_execute_cmd_async(hdev, pipe, cmd, param, param_len, nfc_hci_send_cmd_async()
156 int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, nfc_hci_set_param() argument
179 r = nfc_hci_send_cmd(hdev, gate, NFC_HCI_ANY_SET_PARAMETER, nfc_hci_set_param()
188 int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, nfc_hci_get_param() argument
193 return nfc_hci_send_cmd(hdev, gate, NFC_HCI_ANY_GET_PARAMETER, nfc_hci_get_param()
198 static int nfc_hci_open_pipe(struct nfc_hci_dev *hdev, u8 pipe) nfc_hci_open_pipe() argument
205 r = nfc_hci_execute_cmd(hdev, pipe, NFC_HCI_ANY_OPEN_PIPE, nfc_hci_open_pipe()
218 static int nfc_hci_close_pipe(struct nfc_hci_dev *hdev, u8 pipe) nfc_hci_close_pipe() argument
222 return nfc_hci_execute_cmd(hdev, pipe, NFC_HCI_ANY_CLOSE_PIPE, nfc_hci_close_pipe()
226 static u8 nfc_hci_create_pipe(struct nfc_hci_dev *hdev, u8 dest_host, nfc_hci_create_pipe() argument
240 *result = nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, nfc_hci_create_pipe()
255 static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe) nfc_hci_delete_pipe() argument
259 return nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, nfc_hci_delete_pipe()
263 static int nfc_hci_clear_all_pipes(struct nfc_hci_dev *hdev) nfc_hci_clear_all_pipes() argument
273 if (test_bit(NFC_HCI_QUIRK_SHORT_CLEAR, &hdev->quirks)) nfc_hci_clear_all_pipes()
276 return nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, nfc_hci_clear_all_pipes()
281 int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate) nfc_hci_disconnect_gate() argument
284 u8 pipe = hdev->gate2pipe[gate]; nfc_hci_disconnect_gate()
291 r = nfc_hci_close_pipe(hdev, pipe); nfc_hci_disconnect_gate()
296 r = nfc_hci_delete_pipe(hdev, pipe); nfc_hci_disconnect_gate()
301 hdev->gate2pipe[gate] = NFC_HCI_INVALID_PIPE; nfc_hci_disconnect_gate()
307 int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev) nfc_hci_disconnect_all_gates() argument
313 r = nfc_hci_clear_all_pipes(hdev); nfc_hci_disconnect_all_gates()
317 nfc_hci_reset_pipes(hdev); nfc_hci_disconnect_all_gates()
323 int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate, nfc_hci_connect_gate() argument
334 if (hdev->gate2pipe[dest_gate] != NFC_HCI_INVALID_PIPE) nfc_hci_connect_gate()
348 pipe = nfc_hci_create_pipe(hdev, dest_host, dest_gate, &r); nfc_hci_connect_gate()
356 r = nfc_hci_open_pipe(hdev, pipe); nfc_hci_connect_gate()
359 if (nfc_hci_delete_pipe(hdev, pipe) < 0) { nfc_hci_connect_gate()
366 hdev->pipes[pipe].gate = dest_gate; nfc_hci_connect_gate()
367 hdev->pipes[pipe].dest_host = dest_host; nfc_hci_connect_gate()
368 hdev->gate2pipe[dest_gate] = pipe; nfc_hci_connect_gate()
H A Dhcp.c33 int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe, nfc_hci_hcp_message_tx() argument
39 struct nfc_dev *ndev = hdev->ndev; nfc_hci_hcp_message_tx()
63 hdev->max_data_link_payload) nfc_hci_hcp_message_tx()
66 data_link_len = hdev->max_data_link_payload - nfc_hci_hcp_message_tx()
105 mutex_lock(&hdev->msg_tx_mutex); nfc_hci_hcp_message_tx()
107 if (hdev->shutting_down) { nfc_hci_hcp_message_tx()
109 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_hcp_message_tx()
113 list_add_tail(&cmd->msg_l, &hdev->msg_tx_queue); nfc_hci_hcp_message_tx()
114 mutex_unlock(&hdev->msg_tx_mutex); nfc_hci_hcp_message_tx()
116 schedule_work(&hdev->msg_tx_work); nfc_hci_hcp_message_tx()
131 void nfc_hci_hcp_message_rx(struct nfc_hci_dev *hdev, u8 pipe, u8 type, nfc_hci_hcp_message_rx() argument
136 nfc_hci_resp_received(hdev, instruction, skb); nfc_hci_hcp_message_rx()
139 nfc_hci_cmd_received(hdev, pipe, instruction, skb); nfc_hci_hcp_message_rx()
142 nfc_hci_event_received(hdev, pipe, instruction, skb); nfc_hci_hcp_message_rx()
H A Dllc_nop.c24 struct nfc_hci_dev *hdev; member in struct:llc_nop
32 static void *llc_nop_init(struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv, llc_nop_init() argument
46 llc_nop->hdev = hdev; llc_nop_init()
75 llc_nop->rcv_to_hci(llc_nop->hdev, skb); llc_nop_rcv_from_drv()
82 return llc_nop->xmit_to_drv(llc_nop->hdev, skb); llc_nop_xmit_from_hci()
H A Dhci.h82 int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
88 void nfc_hci_hcp_message_rx(struct nfc_hci_dev *hdev, u8 pipe, u8 type,
H A Dllc.c101 struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev, nfc_llc_allocate() argument
117 llc->data = llc_engine->ops->init(hdev, xmit_to_drv, rcv_to_hci, nfc_llc_allocate()
H A Dllc.h27 void *(*init) (struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv,
H A Dllc_shdlc.c38 struct nfc_hci_dev *hdev; member in struct:llc_shdlc
165 r = shdlc->xmit_to_drv(shdlc->hdev, skb); llc_shdlc_send_s_frame()
183 r = shdlc->xmit_to_drv(shdlc->hdev, skb); llc_shdlc_send_u_frame()
258 shdlc->rcv_to_hci(shdlc->hdev, skb); llc_shdlc_rcv_i_frame()
561 r = shdlc->xmit_to_drv(shdlc->hdev, skb); llc_shdlc_handle_send_queue()
684 shdlc->llc_failure(shdlc->hdev, shdlc->hard_fault); llc_shdlc_sm_work()
749 static void *llc_shdlc_init(struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv, llc_shdlc_init() argument
787 shdlc->hdev = hdev; llc_shdlc_init()
/linux-4.1.27/drivers/crypto/
H A Dimg-hash.c85 struct img_hash_dev *hdev; member in struct:img_hash_request_ctx
110 struct img_hash_dev *hdev; member in struct:img_hash_ctx
147 static inline u32 img_hash_read(struct img_hash_dev *hdev, u32 offset) img_hash_read() argument
149 return readl_relaxed(hdev->io_base + offset); img_hash_read()
152 static inline void img_hash_write(struct img_hash_dev *hdev, img_hash_write() argument
155 writel_relaxed(value, hdev->io_base + offset); img_hash_write()
158 static inline u32 img_hash_read_result_queue(struct img_hash_dev *hdev) img_hash_read_result_queue() argument
160 return be32_to_cpu(img_hash_read(hdev, CR_RESULT_QUEUE)); img_hash_read_result_queue()
163 static void img_hash_start(struct img_hash_dev *hdev, bool dma) img_hash_start() argument
165 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_start()
176 dev_dbg(hdev->dev, "Starting hash process\n"); img_hash_start()
177 img_hash_write(hdev, CR_CONTROL, cr); img_hash_start()
186 img_hash_read(hdev, CR_CONTROL); img_hash_start()
189 static int img_hash_xmit_cpu(struct img_hash_dev *hdev, const u8 *buf, img_hash_xmit_cpu() argument
195 dev_dbg(hdev->dev, "xmit_cpu: length: %zu bytes\n", length); img_hash_xmit_cpu()
198 hdev->flags |= DRIVER_FLAGS_FINAL; img_hash_xmit_cpu()
203 writel_relaxed(buffer[count], hdev->cpu_addr); img_hash_xmit_cpu()
210 struct img_hash_dev *hdev = (struct img_hash_dev *)data; img_hash_dma_callback() local
211 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_dma_callback()
214 img_hash_xmit_cpu(hdev, ctx->buffer, ctx->bufcnt, 0); img_hash_dma_callback()
218 tasklet_schedule(&hdev->dma_task); img_hash_dma_callback()
221 static int img_hash_xmit_dma(struct img_hash_dev *hdev, struct scatterlist *sg) img_hash_xmit_dma() argument
224 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_xmit_dma()
226 ctx->dma_ct = dma_map_sg(hdev->dev, sg, 1, DMA_MEM_TO_DEV); img_hash_xmit_dma()
228 dev_err(hdev->dev, "Invalid DMA sg\n"); img_hash_xmit_dma()
229 hdev->err = -EINVAL; img_hash_xmit_dma()
233 desc = dmaengine_prep_slave_sg(hdev->dma_lch, img_hash_xmit_dma()
239 dev_err(hdev->dev, "Null DMA descriptor\n"); img_hash_xmit_dma()
240 hdev->err = -EINVAL; img_hash_xmit_dma()
241 dma_unmap_sg(hdev->dev, sg, 1, DMA_MEM_TO_DEV); img_hash_xmit_dma()
245 desc->callback_param = hdev; img_hash_xmit_dma()
247 dma_async_issue_pending(hdev->dma_lch); img_hash_xmit_dma()
252 static int img_hash_write_via_cpu(struct img_hash_dev *hdev) img_hash_write_via_cpu() argument
254 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_write_via_cpu()
256 ctx->bufcnt = sg_copy_to_buffer(hdev->req->src, sg_nents(ctx->sg), img_hash_write_via_cpu()
257 ctx->buffer, hdev->req->nbytes); img_hash_write_via_cpu()
259 ctx->total = hdev->req->nbytes; img_hash_write_via_cpu()
262 hdev->flags |= (DRIVER_FLAGS_CPU | DRIVER_FLAGS_FINAL); img_hash_write_via_cpu()
264 img_hash_start(hdev, false); img_hash_write_via_cpu()
266 return img_hash_xmit_cpu(hdev, ctx->buffer, ctx->total, 1); img_hash_write_via_cpu()
288 hash[i] = img_hash_read_result_queue(ctx->hdev); img_hash_copy_hash()
294 struct img_hash_dev *hdev = ctx->hdev; img_hash_finish_req() local
298 if (DRIVER_FLAGS_FINAL & hdev->flags) img_hash_finish_req()
301 dev_warn(hdev->dev, "Hash failed with error %d\n", err); img_hash_finish_req()
305 hdev->flags &= ~(DRIVER_FLAGS_DMA_READY | DRIVER_FLAGS_OUTPUT_READY | img_hash_finish_req()
312 static int img_hash_write_via_dma(struct img_hash_dev *hdev) img_hash_write_via_dma() argument
314 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_write_via_dma()
316 img_hash_start(hdev, true); img_hash_write_via_dma()
318 dev_dbg(hdev->dev, "xmit dma size: %d\n", ctx->total); img_hash_write_via_dma()
321 hdev->flags |= DRIVER_FLAGS_FINAL; img_hash_write_via_dma()
323 hdev->flags |= DRIVER_FLAGS_DMA_ACTIVE | DRIVER_FLAGS_FINAL; img_hash_write_via_dma()
325 tasklet_schedule(&hdev->dma_task); img_hash_write_via_dma()
330 static int img_hash_dma_init(struct img_hash_dev *hdev) img_hash_dma_init() argument
335 hdev->dma_lch = dma_request_slave_channel(hdev->dev, "tx"); img_hash_dma_init()
336 if (!hdev->dma_lch) { img_hash_dma_init()
337 dev_err(hdev->dev, "Couldn't aquire a slave DMA channel.\n"); img_hash_dma_init()
341 dma_conf.dst_addr = hdev->bus_addr; img_hash_dma_init()
346 err = dmaengine_slave_config(hdev->dma_lch, &dma_conf); img_hash_dma_init()
348 dev_err(hdev->dev, "Couldn't configure DMA slave.\n"); img_hash_dma_init()
349 dma_release_channel(hdev->dma_lch); img_hash_dma_init()
358 struct img_hash_dev *hdev = (struct img_hash_dev *)d; img_hash_dma_task() local
359 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_dma_task()
385 if (img_hash_xmit_dma(hdev, &tsg)) { img_hash_dma_task()
386 dev_err(hdev->dev, "DMA failed, falling back to CPU"); img_hash_dma_task()
388 hdev->err = 0; img_hash_dma_task()
389 img_hash_xmit_cpu(hdev, addr + ctx->offset, img_hash_dma_task()
421 img_hash_dma_callback(hdev); img_hash_dma_task()
428 static int img_hash_write_via_dma_stop(struct img_hash_dev *hdev) img_hash_write_via_dma_stop() argument
430 struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req); img_hash_write_via_dma_stop()
433 dma_unmap_sg(hdev->dev, ctx->sg, ctx->dma_ct, DMA_TO_DEVICE); img_hash_write_via_dma_stop()
438 static int img_hash_process_data(struct img_hash_dev *hdev) img_hash_process_data() argument
440 struct ahash_request *req = hdev->req; img_hash_process_data()
447 dev_dbg(hdev->dev, "process data request(%d bytes) using DMA\n", img_hash_process_data()
449 err = img_hash_write_via_dma(hdev); img_hash_process_data()
451 dev_dbg(hdev->dev, "process data request(%d bytes) using CPU\n", img_hash_process_data()
453 err = img_hash_write_via_cpu(hdev); img_hash_process_data()
458 static int img_hash_hw_init(struct img_hash_dev *hdev) img_hash_hw_init() argument
463 img_hash_write(hdev, CR_RESET, CR_RESET_SET); img_hash_hw_init()
464 img_hash_write(hdev, CR_RESET, CR_RESET_UNSET); img_hash_hw_init()
465 img_hash_write(hdev, CR_INTENAB, CR_INT_NEW_RESULTS_SET); img_hash_hw_init()
467 nbits = (u64)hdev->req->nbytes << 3; img_hash_hw_init()
470 img_hash_write(hdev, CR_MESSAGE_LENGTH_H, u); img_hash_hw_init()
471 img_hash_write(hdev, CR_MESSAGE_LENGTH_L, l); img_hash_hw_init()
473 if (!(DRIVER_FLAGS_INIT & hdev->flags)) { img_hash_hw_init()
474 hdev->flags |= DRIVER_FLAGS_INIT; img_hash_hw_init()
475 hdev->err = 0; img_hash_hw_init()
477 dev_dbg(hdev->dev, "hw initialized, nbits: %llx\n", nbits); img_hash_hw_init()
494 static int img_hash_handle_queue(struct img_hash_dev *hdev, img_hash_handle_queue() argument
502 spin_lock_irqsave(&hdev->lock, flags); img_hash_handle_queue()
505 res = ahash_enqueue_request(&hdev->queue, req); img_hash_handle_queue()
507 if (DRIVER_FLAGS_BUSY & hdev->flags) { img_hash_handle_queue()
508 spin_unlock_irqrestore(&hdev->lock, flags); img_hash_handle_queue()
512 backlog = crypto_get_backlog(&hdev->queue); img_hash_handle_queue()
513 async_req = crypto_dequeue_request(&hdev->queue); img_hash_handle_queue()
515 hdev->flags |= DRIVER_FLAGS_BUSY; img_hash_handle_queue()
517 spin_unlock_irqrestore(&hdev->lock, flags); img_hash_handle_queue()
526 hdev->req = req; img_hash_handle_queue()
530 dev_info(hdev->dev, "processing req, op: %lu, bytes: %d\n", img_hash_handle_queue()
533 err = img_hash_hw_init(hdev); img_hash_handle_queue()
536 err = img_hash_process_data(hdev); img_hash_handle_queue()
595 struct img_hash_dev *hdev = NULL; img_hash_digest() local
600 if (!tctx->hdev) { img_hash_digest()
602 hdev = tmp; img_hash_digest()
605 tctx->hdev = hdev; img_hash_digest()
608 hdev = tctx->hdev; img_hash_digest()
612 ctx->hdev = hdev; img_hash_digest()
641 err = img_hash_handle_queue(tctx->hdev, req); img_hash_digest()
678 struct img_hash_dev *hdev = dev_id; img_irq_handler() local
681 reg = img_hash_read(hdev, CR_INTSTAT); img_irq_handler()
682 img_hash_write(hdev, CR_INTCLEAR, reg); img_irq_handler()
685 dev_dbg(hdev->dev, "IRQ CR_INT_NEW_RESULTS_SET\n"); img_irq_handler()
686 if (DRIVER_FLAGS_BUSY & hdev->flags) { img_irq_handler()
687 hdev->flags |= DRIVER_FLAGS_OUTPUT_READY; img_irq_handler()
688 if (!(DRIVER_FLAGS_CPU & hdev->flags)) img_irq_handler()
689 hdev->flags |= DRIVER_FLAGS_DMA_READY; img_irq_handler()
690 tasklet_schedule(&hdev->done_task); img_irq_handler()
692 dev_warn(hdev->dev, img_irq_handler()
696 dev_warn(hdev->dev, img_irq_handler()
699 dev_warn(hdev->dev, img_irq_handler()
702 dev_warn(hdev->dev, img_irq_handler()
803 static int img_register_algs(struct img_hash_dev *hdev) img_register_algs() argument
821 static int img_unregister_algs(struct img_hash_dev *hdev) img_unregister_algs() argument
832 struct img_hash_dev *hdev = (struct img_hash_dev *)data; img_hash_done_task() local
835 if (hdev->err == -EINVAL) { img_hash_done_task()
836 err = hdev->err; img_hash_done_task()
840 if (!(DRIVER_FLAGS_BUSY & hdev->flags)) { img_hash_done_task()
841 img_hash_handle_queue(hdev, NULL); img_hash_done_task()
845 if (DRIVER_FLAGS_CPU & hdev->flags) { img_hash_done_task()
846 if (DRIVER_FLAGS_OUTPUT_READY & hdev->flags) { img_hash_done_task()
847 hdev->flags &= ~DRIVER_FLAGS_OUTPUT_READY; img_hash_done_task()
850 } else if (DRIVER_FLAGS_DMA_READY & hdev->flags) { img_hash_done_task()
851 if (DRIVER_FLAGS_DMA_ACTIVE & hdev->flags) { img_hash_done_task()
852 hdev->flags &= ~DRIVER_FLAGS_DMA_ACTIVE; img_hash_done_task()
853 img_hash_write_via_dma_stop(hdev); img_hash_done_task()
854 if (hdev->err) { img_hash_done_task()
855 err = hdev->err; img_hash_done_task()
859 if (DRIVER_FLAGS_OUTPUT_READY & hdev->flags) { img_hash_done_task()
860 hdev->flags &= ~(DRIVER_FLAGS_DMA_READY | img_hash_done_task()
868 img_hash_finish_req(hdev->req, err); img_hash_done_task()
879 struct img_hash_dev *hdev; img_hash_probe() local
885 hdev = devm_kzalloc(dev, sizeof(*hdev), GFP_KERNEL); img_hash_probe()
886 if (hdev == NULL) img_hash_probe()
889 spin_lock_init(&hdev->lock); img_hash_probe()
891 hdev->dev = dev; img_hash_probe()
893 platform_set_drvdata(pdev, hdev); img_hash_probe()
895 INIT_LIST_HEAD(&hdev->list); img_hash_probe()
897 tasklet_init(&hdev->done_task, img_hash_done_task, (unsigned long)hdev); img_hash_probe()
898 tasklet_init(&hdev->dma_task, img_hash_dma_task, (unsigned long)hdev); img_hash_probe()
900 crypto_init_queue(&hdev->queue, IMG_HASH_QUEUE_LENGTH); img_hash_probe()
905 hdev->io_base = devm_ioremap_resource(dev, hash_res); img_hash_probe()
906 if (IS_ERR(hdev->io_base)) { img_hash_probe()
907 err = PTR_ERR(hdev->io_base); img_hash_probe()
915 hdev->cpu_addr = devm_ioremap_resource(dev, hash_res); img_hash_probe()
916 if (IS_ERR(hdev->cpu_addr)) { img_hash_probe()
918 err = PTR_ERR(hdev->cpu_addr); img_hash_probe()
921 hdev->bus_addr = hash_res->start; img_hash_probe()
931 dev_name(dev), hdev); img_hash_probe()
938 hdev->hash_clk = devm_clk_get(&pdev->dev, "hash"); img_hash_probe()
939 if (IS_ERR(hdev->hash_clk)) { img_hash_probe()
941 err = PTR_ERR(hdev->hash_clk); img_hash_probe()
945 hdev->sys_clk = devm_clk_get(&pdev->dev, "sys"); img_hash_probe()
946 if (IS_ERR(hdev->sys_clk)) { img_hash_probe()
948 err = PTR_ERR(hdev->sys_clk); img_hash_probe()
952 err = clk_prepare_enable(hdev->hash_clk); img_hash_probe()
956 err = clk_prepare_enable(hdev->sys_clk); img_hash_probe()
960 err = img_hash_dma_init(hdev); img_hash_probe()
965 dma_chan_name(hdev->dma_lch)); img_hash_probe()
968 list_add_tail(&hdev->list, &img_hash.dev_list); img_hash_probe()
971 err = img_register_algs(hdev); img_hash_probe()
980 list_del(&hdev->list); img_hash_probe()
982 dma_release_channel(hdev->dma_lch); img_hash_probe()
984 clk_disable_unprepare(hdev->sys_clk); img_hash_probe()
986 clk_disable_unprepare(hdev->hash_clk); img_hash_probe()
988 tasklet_kill(&hdev->done_task); img_hash_probe()
989 tasklet_kill(&hdev->dma_task); img_hash_probe()
996 static struct img_hash_dev *hdev; img_hash_remove() local
998 hdev = platform_get_drvdata(pdev); img_hash_remove()
1000 list_del(&hdev->list); img_hash_remove()
1003 img_unregister_algs(hdev); img_hash_remove()
1005 tasklet_kill(&hdev->done_task); img_hash_remove()
1006 tasklet_kill(&hdev->dma_task); img_hash_remove()
1008 dma_release_channel(hdev->dma_lch); img_hash_remove()
1010 clk_disable_unprepare(hdev->hash_clk); img_hash_remove()
1011 clk_disable_unprepare(hdev->sys_clk); img_hash_remove()
/linux-4.1.27/drivers/hid/
H A Dhid-lg.h10 int lgff_init(struct hid_device *hdev);
12 static inline int lgff_init(struct hid_device *hdev) { return -1; } lgff_init() argument
16 int lg2ff_init(struct hid_device *hdev); lgff_init()
18 static inline int lg2ff_init(struct hid_device *hdev) { return -1; } lg2ff_init() argument
22 int lg3ff_init(struct hid_device *hdev); lg2ff_init()
24 static inline int lg3ff_init(struct hid_device *hdev) { return -1; } argument
H A Dhid-lg4ff.h9 int lg4ff_init(struct hid_device *hdev);
10 int lg4ff_deinit(struct hid_device *hdev);
14 static inline int lg4ff_init(struct hid_device *hdev) { return -1; } lg4ff_deinit() argument
15 static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; } argument
H A Dhid-lenovo.c46 static int lenovo_input_mapping_tpkbd(struct hid_device *hdev, lenovo_input_mapping_tpkbd() argument
52 hid_set_drvdata(hdev, (void *)1); lenovo_input_mapping_tpkbd()
59 static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, lenovo_input_mapping_cptkbd() argument
133 static int lenovo_input_mapping(struct hid_device *hdev, lenovo_input_mapping() argument
137 switch (hdev->product) { lenovo_input_mapping()
139 return lenovo_input_mapping_tpkbd(hdev, hi, field, lenovo_input_mapping()
143 return lenovo_input_mapping_cptkbd(hdev, hi, field, lenovo_input_mapping()
153 static int lenovo_send_cmd_cptkbd(struct hid_device *hdev, lenovo_send_cmd_cptkbd() argument
159 switch (hdev->product) { lenovo_send_cmd_cptkbd()
161 ret = hid_hw_raw_request(hdev, 0x13, buf, sizeof(buf), lenovo_send_cmd_cptkbd()
165 ret = hid_hw_output_report(hdev, buf, sizeof(buf)); lenovo_send_cmd_cptkbd()
175 static void lenovo_features_set_cptkbd(struct hid_device *hdev) lenovo_features_set_cptkbd() argument
178 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); lenovo_features_set_cptkbd()
180 ret = lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock); lenovo_features_set_cptkbd()
181 ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); lenovo_features_set_cptkbd()
183 hid_err(hdev, "Fn-lock setting failed: %d\n", ret); lenovo_features_set_cptkbd()
190 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_fn_lock_show_cptkbd() local
191 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); attr_fn_lock_show_cptkbd()
201 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_fn_lock_store_cptkbd() local
202 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); attr_fn_lock_store_cptkbd()
211 lenovo_features_set_cptkbd(hdev); attr_fn_lock_store_cptkbd()
220 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_sensitivity_show_cptkbd() local
221 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); attr_sensitivity_show_cptkbd()
232 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_sensitivity_store_cptkbd() local
233 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); attr_sensitivity_store_cptkbd()
240 lenovo_features_set_cptkbd(hdev); attr_sensitivity_store_cptkbd()
267 static int lenovo_raw_event(struct hid_device *hdev, lenovo_raw_event() argument
275 if (unlikely(hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD lenovo_raw_event()
287 static int lenovo_features_set_tpkbd(struct hid_device *hdev) lenovo_features_set_tpkbd() argument
290 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); lenovo_features_set_tpkbd()
292 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; lenovo_features_set_tpkbd()
302 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); lenovo_features_set_tpkbd()
310 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_press_to_select_show_tpkbd() local
311 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_press_to_select_show_tpkbd()
321 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_press_to_select_store_tpkbd() local
322 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_press_to_select_store_tpkbd()
331 lenovo_features_set_tpkbd(hdev); attr_press_to_select_store_tpkbd()
340 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_dragging_show_tpkbd() local
341 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_dragging_show_tpkbd()
351 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_dragging_store_tpkbd() local
352 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_dragging_store_tpkbd()
361 lenovo_features_set_tpkbd(hdev); attr_dragging_store_tpkbd()
370 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_release_to_select_show_tpkbd() local
371 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_release_to_select_show_tpkbd()
381 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_release_to_select_store_tpkbd() local
382 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_release_to_select_store_tpkbd()
391 lenovo_features_set_tpkbd(hdev); attr_release_to_select_store_tpkbd()
400 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_select_right_show_tpkbd() local
401 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_select_right_show_tpkbd()
411 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_select_right_store_tpkbd() local
412 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_select_right_store_tpkbd()
421 lenovo_features_set_tpkbd(hdev); attr_select_right_store_tpkbd()
430 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_sensitivity_show_tpkbd() local
431 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_sensitivity_show_tpkbd()
442 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_sensitivity_store_tpkbd() local
443 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_sensitivity_store_tpkbd()
450 lenovo_features_set_tpkbd(hdev); attr_sensitivity_store_tpkbd()
459 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_press_speed_show_tpkbd() local
460 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_press_speed_show_tpkbd()
471 struct hid_device *hdev = container_of(dev, struct hid_device, dev); attr_press_speed_store_tpkbd() local
472 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); attr_press_speed_store_tpkbd()
479 lenovo_features_set_tpkbd(hdev); attr_press_speed_store_tpkbd()
532 struct hid_device *hdev = container_of(dev, struct hid_device, dev); lenovo_led_brightness_get_tpkbd() local
533 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); lenovo_led_brightness_get_tpkbd()
548 struct hid_device *hdev = container_of(dev, struct hid_device, dev); lenovo_led_brightness_set_tpkbd() local
549 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); lenovo_led_brightness_set_tpkbd()
561 report = hdev->report_enum[HID_OUTPUT_REPORT].report_id_hash[3]; lenovo_led_brightness_set_tpkbd()
564 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); lenovo_led_brightness_set_tpkbd()
567 static int lenovo_probe_tpkbd(struct hid_device *hdev) lenovo_probe_tpkbd() argument
569 struct device *dev = &hdev->dev; lenovo_probe_tpkbd()
580 if (!hid_get_drvdata(hdev)) lenovo_probe_tpkbd()
583 hid_set_drvdata(hdev, NULL); lenovo_probe_tpkbd()
587 if (!hid_validate_values(hdev, HID_FEATURE_REPORT, 4, i, 1)) lenovo_probe_tpkbd()
590 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 3, 0, 2)) lenovo_probe_tpkbd()
593 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); lenovo_probe_tpkbd()
595 hid_warn(hdev, "Could not create sysfs group: %d\n", ret); lenovo_probe_tpkbd()
597 data_pointer = devm_kzalloc(&hdev->dev, lenovo_probe_tpkbd()
601 hid_err(hdev, "Could not allocate memory for driver data\n"); lenovo_probe_tpkbd()
609 name_mute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); lenovo_probe_tpkbd()
610 name_micmute = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); lenovo_probe_tpkbd()
612 hid_err(hdev, "Could not allocate memory for led data\n"); lenovo_probe_tpkbd()
618 hid_set_drvdata(hdev, data_pointer); lenovo_probe_tpkbd()
634 lenovo_features_set_tpkbd(hdev); lenovo_probe_tpkbd()
639 static int lenovo_probe_cptkbd(struct hid_device *hdev) lenovo_probe_cptkbd() argument
645 if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD lenovo_probe_cptkbd()
646 && hdev->type != HID_TYPE_USBMOUSE) { lenovo_probe_cptkbd()
647 hid_dbg(hdev, "Ignoring keyboard half of device\n"); lenovo_probe_cptkbd()
651 cptkbd_data = devm_kzalloc(&hdev->dev, lenovo_probe_cptkbd()
655 hid_err(hdev, "can't alloc keyboard descriptor\n"); lenovo_probe_cptkbd()
658 hid_set_drvdata(hdev, cptkbd_data); lenovo_probe_cptkbd()
664 ret = lenovo_send_cmd_cptkbd(hdev, 0x01, 0x03); lenovo_probe_cptkbd()
666 hid_warn(hdev, "Failed to switch F7/9/11 mode: %d\n", ret); lenovo_probe_cptkbd()
669 ret = lenovo_send_cmd_cptkbd(hdev, 0x09, 0x01); lenovo_probe_cptkbd()
671 hid_warn(hdev, "Failed to switch middle button: %d\n", ret); lenovo_probe_cptkbd()
676 lenovo_features_set_cptkbd(hdev); lenovo_probe_cptkbd()
678 ret = sysfs_create_group(&hdev->dev.kobj, &lenovo_attr_group_cptkbd); lenovo_probe_cptkbd()
680 hid_warn(hdev, "Could not create sysfs group: %d\n", ret); lenovo_probe_cptkbd()
685 static int lenovo_probe(struct hid_device *hdev, lenovo_probe() argument
690 ret = hid_parse(hdev); lenovo_probe()
692 hid_err(hdev, "hid_parse failed\n"); lenovo_probe()
696 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); lenovo_probe()
698 hid_err(hdev, "hid_hw_start failed\n"); lenovo_probe()
702 switch (hdev->product) { lenovo_probe()
704 ret = lenovo_probe_tpkbd(hdev); lenovo_probe()
708 ret = lenovo_probe_cptkbd(hdev); lenovo_probe()
719 hid_hw_stop(hdev); lenovo_probe()
724 static void lenovo_remove_tpkbd(struct hid_device *hdev) lenovo_remove_tpkbd() argument
726 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); lenovo_remove_tpkbd()
735 sysfs_remove_group(&hdev->dev.kobj, lenovo_remove_tpkbd()
741 hid_set_drvdata(hdev, NULL); lenovo_remove_tpkbd()
744 static void lenovo_remove_cptkbd(struct hid_device *hdev) lenovo_remove_cptkbd() argument
746 sysfs_remove_group(&hdev->dev.kobj, lenovo_remove_cptkbd()
750 static void lenovo_remove(struct hid_device *hdev) lenovo_remove() argument
752 switch (hdev->product) { lenovo_remove()
754 lenovo_remove_tpkbd(hdev); lenovo_remove()
758 lenovo_remove_cptkbd(hdev); lenovo_remove()
762 hid_hw_stop(hdev); lenovo_remove()
H A Dhid-rmi.c91 * @hdev: pointer to the struct hid_device
125 struct hid_device *hdev; member in struct:rmi_data
133 static int rmi_write_report(struct hid_device *hdev, u8 *report, int len);
137 * @hdev: The pointer to the hid_device struct
149 static int rmi_set_page(struct hid_device *hdev, u8 page) rmi_set_page() argument
151 struct rmi_data *data = hid_get_drvdata(hdev); rmi_set_page()
159 retval = rmi_write_report(hdev, data->writeReport, rmi_set_page()
162 dev_err(&hdev->dev, rmi_set_page()
171 static int rmi_set_mode(struct hid_device *hdev, u8 mode) rmi_set_mode() argument
176 ret = hid_hw_raw_request(hdev, RMI_SET_RMI_MODE_REPORT_ID, txbuf, rmi_set_mode()
179 dev_err(&hdev->dev, "unable to set rmi mode to %d (%d)\n", mode, rmi_set_mode()
187 static int rmi_write_report(struct hid_device *hdev, u8 *report, int len) rmi_write_report() argument
191 ret = hid_hw_output_report(hdev, (void *)report, len); rmi_write_report()
193 dev_err(&hdev->dev, "failed to write hid report (%d)\n", ret); rmi_write_report()
200 static int rmi_read_block(struct hid_device *hdev, u16 addr, void *buf, rmi_read_block() argument
203 struct rmi_data *data = hid_get_drvdata(hdev); rmi_read_block()
213 ret = rmi_set_page(hdev, RMI_PAGE(addr)); rmi_read_block()
228 ret = rmi_write_report(hdev, data->writeReport, rmi_read_block()
232 dev_err(&hdev->dev, rmi_read_block()
244 hid_warn(hdev, "%s: timeout elapsed\n", rmi_read_block()
272 static inline int rmi_read(struct hid_device *hdev, u16 addr, void *buf) rmi_read() argument
274 return rmi_read_block(hdev, addr, buf, 1); rmi_read()
277 static int rmi_write_block(struct hid_device *hdev, u16 addr, void *buf, rmi_write_block() argument
280 struct rmi_data *data = hid_get_drvdata(hdev); rmi_write_block()
286 ret = rmi_set_page(hdev, RMI_PAGE(addr)); rmi_write_block()
297 ret = rmi_write_report(hdev, data->writeReport, rmi_write_block()
300 dev_err(&hdev->dev, rmi_write_block()
312 static inline int rmi_write(struct hid_device *hdev, u16 addr, void *buf) rmi_write() argument
314 return rmi_write_block(hdev, addr, buf, 1); rmi_write()
355 rmi_set_mode(hdata->hdev, RMI_MODE_ATTN_REPORTS); rmi_reset_work()
358 static inline int rmi_schedule_reset(struct hid_device *hdev) rmi_schedule_reset() argument
360 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_schedule_reset()
364 static int rmi_f11_input_event(struct hid_device *hdev, u8 irq, u8 *data, rmi_f11_input_event() argument
367 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_f11_input_event()
386 dev_driver_string(&hdev->dev), rmi_f11_input_event()
387 dev_name(&hdev->dev)); rmi_f11_input_event()
388 hid_dbg(hdev, "Incomplete finger report\n"); rmi_f11_input_event()
399 static int rmi_f30_input_event(struct hid_device *hdev, u8 irq, u8 *data, rmi_f30_input_event() argument
402 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_f30_input_event()
411 hid_warn(hdev, "Click Button pressed, but the click data is missing\n"); rmi_f30_input_event()
427 static int rmi_input_event(struct hid_device *hdev, u8 *data, int size) rmi_input_event() argument
429 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_input_event()
440 hid_dbg(hdev, "unknown intr source:%02lx %s:%d\n", rmi_input_event()
444 index += rmi_f11_input_event(hdev, data[1], &data[index], rmi_input_event()
446 index += rmi_f30_input_event(hdev, data[1], &data[index], rmi_input_event()
449 index += rmi_f30_input_event(hdev, data[1], &data[index], rmi_input_event()
451 index += rmi_f11_input_event(hdev, data[1], &data[index], rmi_input_event()
458 static int rmi_read_data_event(struct hid_device *hdev, u8 *data, int size) rmi_read_data_event() argument
460 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_read_data_event()
463 hid_dbg(hdev, "no read request pending\n"); rmi_read_data_event()
475 static int rmi_check_sanity(struct hid_device *hdev, u8 *data, int size) rmi_check_sanity() argument
491 static int rmi_raw_event(struct hid_device *hdev, rmi_raw_event() argument
494 size = rmi_check_sanity(hdev, data, size); rmi_raw_event()
500 return rmi_read_data_event(hdev, data, size); rmi_raw_event()
502 return rmi_input_event(hdev, data, size); rmi_raw_event()
510 static int rmi_event(struct hid_device *hdev, struct hid_field *field, rmi_event() argument
513 struct rmi_data *data = hid_get_drvdata(hdev); rmi_event()
527 rmi_schedule_reset(hdev); rmi_event()
535 static int rmi_post_reset(struct hid_device *hdev) rmi_post_reset() argument
537 return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); rmi_post_reset()
540 static int rmi_post_resume(struct hid_device *hdev) rmi_post_resume() argument
542 return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); rmi_post_resume()
601 static int rmi_scan_pdt(struct hid_device *hdev) rmi_scan_pdt() argument
603 struct rmi_data *data = hid_get_drvdata(hdev); rmi_scan_pdt()
612 hid_info(hdev, "Scanning PDT...\n"); rmi_scan_pdt()
621 retval = rmi_read_block(hdev, i, &entry, sizeof(entry)); rmi_scan_pdt()
623 hid_err(hdev, rmi_scan_pdt()
634 hid_info(hdev, "Found F%02X on page %#04x\n", rmi_scan_pdt()
645 hid_info(hdev, "%s: Done with PDT scan.\n", __func__); rmi_scan_pdt()
654 static int rmi_populate_f01(struct hid_device *hdev) rmi_populate_f01() argument
656 struct rmi_data *data = hid_get_drvdata(hdev); rmi_populate_f01()
670 ret = rmi_read_block(hdev, query_offset, basic_queries, rmi_populate_f01()
673 hid_err(hdev, "Can not read basic queries from Function 0x1.\n"); rmi_populate_f01()
692 ret = rmi_read(hdev, query_offset, info); rmi_populate_f01()
694 hid_err(hdev, "Can not read query42.\n"); rmi_populate_f01()
702 ret = rmi_read(hdev, query_offset, &ds4_query_len); rmi_populate_f01()
704 hid_err(hdev, "Can not read DS4 Query length.\n"); rmi_populate_f01()
710 ret = rmi_read(hdev, query_offset, info); rmi_populate_f01()
712 hid_err(hdev, "Can not read DS4 query.\n"); rmi_populate_f01()
725 ret = rmi_read_block(hdev, prod_info_addr, info, 3); rmi_populate_f01()
727 hid_err(hdev, "Can not read product info.\n"); rmi_populate_f01()
738 static int rmi_populate_f11(struct hid_device *hdev) rmi_populate_f11() argument
740 struct rmi_data *data = hid_get_drvdata(hdev); rmi_populate_f11()
760 hid_err(hdev, "No 2D sensor found, giving up.\n"); rmi_populate_f11()
765 ret = rmi_read(hdev, data->f11.query_base_addr, buf); rmi_populate_f11()
767 hid_err(hdev, "can not get query 0: %d.\n", ret); rmi_populate_f11()
777 ret = rmi_read(hdev, data->f11.query_base_addr + 1, buf); rmi_populate_f11()
779 hid_err(hdev, "can not get NumberOfFingers: %d.\n", ret); rmi_populate_f11()
790 hid_err(hdev, "No absolute events, giving up.\n"); rmi_populate_f11()
797 ret = rmi_read(hdev, data->f11.query_base_addr + 5, buf); rmi_populate_f11()
799 hid_err(hdev, "can not get absolute data sources: %d.\n", ret); rmi_populate_f11()
817 ret = rmi_read(hdev, rmi_populate_f11()
820 hid_err(hdev, "can not read gesture information: %d.\n", rmi_populate_f11()
841 ret = rmi_read(hdev, data->f11.query_base_addr rmi_populate_f11()
844 hid_err(hdev, "can not get query 12: %d.\n", ret); rmi_populate_f11()
851 ret = rmi_read_block(hdev, rmi_populate_f11()
855 hid_err(hdev, "can not read query 15-18: %d.\n", rmi_populate_f11()
866 hid_info(hdev, "%s: size in mm: %d x %d\n", rmi_populate_f11()
881 ret = rmi_read(hdev, data->f11.query_base_addr rmi_populate_f11()
884 hid_err(hdev, "can not get query 28: %d.\n", ret); rmi_populate_f11()
893 ret = rmi_read(hdev, data->f11.query_base_addr rmi_populate_f11()
896 hid_err(hdev, "can not get query 36: %d.\n", ret); rmi_populate_f11()
913 ret = rmi_read_block(hdev, data->f11.control_base_addr, buf, 12); rmi_populate_f11()
915 hid_err(hdev, "can not read ctrl block of size 11: %d.\n", ret); rmi_populate_f11()
924 ret = rmi_write(hdev, data->f11.control_base_addr, buf); rmi_populate_f11()
926 hid_err(hdev, "can not write to control reg 0: %d.\n", rmi_populate_f11()
934 ret = rmi_write(hdev, data->f11.control_base_addr + 11, rmi_populate_f11()
937 hid_err(hdev, "can not write to control reg 11: %d.\n", rmi_populate_f11()
946 static int rmi_populate_f30(struct hid_device *hdev) rmi_populate_f30() argument
948 struct rmi_data *data = hid_get_drvdata(hdev); rmi_populate_f30()
959 hid_err(hdev, "No GPIO/LEDs found, giving up.\n"); rmi_populate_f30()
963 ret = rmi_read_block(hdev, data->f30.query_base_addr, buf, 2); rmi_populate_f30()
965 hid_err(hdev, "can not get F30 query registers: %d.\n", ret); rmi_populate_f30()
983 ret = rmi_read_block(hdev, data->f30.control_base_addr + ctrl2_addr, rmi_populate_f30()
986 hid_err(hdev, "can not read ctrl 2&3 block of size %d: %d.\n", rmi_populate_f30()
1014 static int rmi_populate(struct hid_device *hdev) rmi_populate() argument
1018 ret = rmi_scan_pdt(hdev); rmi_populate()
1020 hid_err(hdev, "PDT scan failed with code %d.\n", ret); rmi_populate()
1024 ret = rmi_populate_f01(hdev); rmi_populate()
1026 hid_err(hdev, "Error while initializing F01 (%d).\n", ret); rmi_populate()
1030 ret = rmi_populate_f11(hdev); rmi_populate()
1032 hid_err(hdev, "Error while initializing F11 (%d).\n", ret); rmi_populate()
1036 ret = rmi_populate_f30(hdev); rmi_populate()
1038 hid_warn(hdev, "Error while initializing F30 (%d).\n", ret); rmi_populate()
1043 static void rmi_input_configured(struct hid_device *hdev, struct hid_input *hi) rmi_input_configured() argument
1045 struct rmi_data *data = hid_get_drvdata(hdev); rmi_input_configured()
1052 hid_dbg(hdev, "Opening low level driver\n"); rmi_input_configured()
1053 ret = hid_hw_open(hdev); rmi_input_configured()
1061 hid_device_io_start(hdev); rmi_input_configured()
1063 ret = rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); rmi_input_configured()
1065 dev_err(&hdev->dev, "failed to set rmi mode\n"); rmi_input_configured()
1069 ret = rmi_set_page(hdev, 0); rmi_input_configured()
1071 dev_err(&hdev->dev, "failed to set page select to 0.\n"); rmi_input_configured()
1075 ret = rmi_populate(hdev); rmi_input_configured()
1079 hid_info(hdev, "firmware id: %ld\n", data->firmware_id); rmi_input_configured()
1112 hid_device_io_stop(hdev); rmi_input_configured()
1113 hid_hw_close(hdev); rmi_input_configured()
1116 static int rmi_input_mapping(struct hid_device *hdev, rmi_input_mapping() argument
1120 struct rmi_data *data = hid_get_drvdata(hdev); rmi_input_mapping()
1137 static int rmi_check_valid_report_id(struct hid_device *hdev, unsigned type, rmi_check_valid_report_id() argument
1142 *report = hdev->report_enum[type].report_id_hash[id]; rmi_check_valid_report_id()
1154 static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) rmi_probe() argument
1163 data = devm_kzalloc(&hdev->dev, sizeof(struct rmi_data), GFP_KERNEL); rmi_probe()
1168 data->hdev = hdev; rmi_probe()
1170 hid_set_drvdata(hdev, data); rmi_probe()
1172 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; rmi_probe()
1174 ret = hid_parse(hdev); rmi_probe()
1176 hid_err(hdev, "parse failed\n"); rmi_probe()
1187 if (!rmi_check_valid_report_id(hdev, HID_FEATURE_REPORT, rmi_probe()
1189 hid_dbg(hdev, "device does not have set mode feature report\n"); rmi_probe()
1193 if (!rmi_check_valid_report_id(hdev, HID_INPUT_REPORT, rmi_probe()
1195 hid_dbg(hdev, "device does not have attention input report\n"); rmi_probe()
1201 if (!rmi_check_valid_report_id(hdev, HID_OUTPUT_REPORT, rmi_probe()
1203 hid_dbg(hdev, rmi_probe()
1213 data->writeReport = devm_kzalloc(&hdev->dev, alloc_size, GFP_KERNEL); rmi_probe()
1226 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); rmi_probe()
1228 hid_err(hdev, "hw start failed\n"); rmi_probe()
1241 hid_err(hdev, "Device failed to be properly configured\n"); rmi_probe()
1246 static void rmi_remove(struct hid_device *hdev) rmi_remove() argument
1248 struct rmi_data *hdata = hid_get_drvdata(hdev); rmi_remove()
1252 hid_hw_stop(hdev); rmi_remove()
H A Dhid-roccat-konepure.c78 static int konepure_init_specials(struct hid_device *hdev) konepure_init_specials() argument
80 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); konepure_init_specials()
87 hid_set_drvdata(hdev, NULL); konepure_init_specials()
93 hid_err(hdev, "can't alloc device descriptor\n"); konepure_init_specials()
96 hid_set_drvdata(hdev, konepure); konepure_init_specials()
100 hid_err(hdev, "couldn't init KonePure device\n"); konepure_init_specials()
104 retval = roccat_connect(konepure_class, hdev, konepure_init_specials()
107 hid_err(hdev, "couldn't init char dev\n"); konepure_init_specials()
119 static void konepure_remove_specials(struct hid_device *hdev) konepure_remove_specials() argument
121 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); konepure_remove_specials()
128 konepure = hid_get_drvdata(hdev); konepure_remove_specials()
134 static int konepure_probe(struct hid_device *hdev, konepure_probe() argument
139 retval = hid_parse(hdev); konepure_probe()
141 hid_err(hdev, "parse failed\n"); konepure_probe()
145 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); konepure_probe()
147 hid_err(hdev, "hw start failed\n"); konepure_probe()
151 retval = konepure_init_specials(hdev); konepure_probe()
153 hid_err(hdev, "couldn't install mouse\n"); konepure_probe()
160 hid_hw_stop(hdev); konepure_probe()
165 static void konepure_remove(struct hid_device *hdev) konepure_remove() argument
167 konepure_remove_specials(hdev); konepure_remove()
168 hid_hw_stop(hdev); konepure_remove()
171 static int konepure_raw_event(struct hid_device *hdev, konepure_raw_event() argument
174 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); konepure_raw_event()
175 struct roccat_common2_device *konepure = hid_get_drvdata(hdev); konepure_raw_event()
H A Dhid-roccat-ryos.c86 static int ryos_init_specials(struct hid_device *hdev) ryos_init_specials() argument
88 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); ryos_init_specials()
95 hid_set_drvdata(hdev, NULL); ryos_init_specials()
101 hid_err(hdev, "can't alloc device descriptor\n"); ryos_init_specials()
104 hid_set_drvdata(hdev, ryos); ryos_init_specials()
108 hid_err(hdev, "couldn't init Ryos device\n"); ryos_init_specials()
112 retval = roccat_connect(ryos_class, hdev, ryos_init_specials()
115 hid_err(hdev, "couldn't init char dev\n"); ryos_init_specials()
127 static void ryos_remove_specials(struct hid_device *hdev) ryos_remove_specials() argument
129 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); ryos_remove_specials()
136 ryos = hid_get_drvdata(hdev); ryos_remove_specials()
142 static int ryos_probe(struct hid_device *hdev, ryos_probe() argument
147 retval = hid_parse(hdev); ryos_probe()
149 hid_err(hdev, "parse failed\n"); ryos_probe()
153 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); ryos_probe()
155 hid_err(hdev, "hw start failed\n"); ryos_probe()
159 retval = ryos_init_specials(hdev); ryos_probe()
161 hid_err(hdev, "couldn't install mouse\n"); ryos_probe()
168 hid_hw_stop(hdev); ryos_probe()
173 static void ryos_remove(struct hid_device *hdev) ryos_remove() argument
175 ryos_remove_specials(hdev); ryos_remove()
176 hid_hw_stop(hdev); ryos_remove()
179 static int ryos_raw_event(struct hid_device *hdev, ryos_raw_event() argument
182 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); ryos_raw_event()
183 struct roccat_common2_device *ryos = hid_get_drvdata(hdev); ryos_raw_event()
H A Dhid-roccat-savu.c58 static int savu_init_specials(struct hid_device *hdev) savu_init_specials() argument
60 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); savu_init_specials()
67 hid_set_drvdata(hdev, NULL); savu_init_specials()
73 hid_err(hdev, "can't alloc device descriptor\n"); savu_init_specials()
76 hid_set_drvdata(hdev, savu); savu_init_specials()
80 hid_err(hdev, "couldn't init Savu device\n"); savu_init_specials()
84 retval = roccat_connect(savu_class, hdev, savu_init_specials()
87 hid_err(hdev, "couldn't init char dev\n"); savu_init_specials()
99 static void savu_remove_specials(struct hid_device *hdev) savu_remove_specials() argument
101 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); savu_remove_specials()
108 savu = hid_get_drvdata(hdev); savu_remove_specials()
114 static int savu_probe(struct hid_device *hdev, savu_probe() argument
119 retval = hid_parse(hdev); savu_probe()
121 hid_err(hdev, "parse failed\n"); savu_probe()
125 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); savu_probe()
127 hid_err(hdev, "hw start failed\n"); savu_probe()
131 retval = savu_init_specials(hdev); savu_probe()
133 hid_err(hdev, "couldn't install mouse\n"); savu_probe()
140 hid_hw_stop(hdev); savu_probe()
145 static void savu_remove(struct hid_device *hdev) savu_remove() argument
147 savu_remove_specials(hdev); savu_remove()
148 hid_hw_stop(hdev); savu_remove()
169 static int savu_raw_event(struct hid_device *hdev, savu_raw_event() argument
172 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); savu_raw_event()
173 struct roccat_common2_device *savu = hid_get_drvdata(hdev); savu_raw_event()
H A Dhid-picolcd_core.c62 struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir) picolcd_report() argument
64 struct list_head *feature_report_list = &hdev->report_enum[dir].report_list; picolcd_report()
71 hid_warn(hdev, "No report with id 0x%x found\n", id);
77 struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev, picolcd_send_and_wait() argument
80 struct picolcd_data *data = hid_get_drvdata(hdev); picolcd_send_and_wait()
82 struct hid_report *report = picolcd_out_report(report_id, hdev); picolcd_send_and_wait()
111 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_send_and_wait()
189 static int picolcd_check_version(struct hid_device *hdev) picolcd_check_version() argument
191 struct picolcd_data *data = hid_get_drvdata(hdev); picolcd_check_version()
198 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0); picolcd_check_version()
200 hid_err(hdev, "no version response from PicoLCD\n"); picolcd_check_version()
208 hid_info(hdev, "PicoLCD, bootloader version %d.%d\n", picolcd_check_version()
211 hid_info(hdev, "PicoLCD, firmware version %d.%d\n", picolcd_check_version()
215 hid_err(hdev, "confused, got unexpected version response from PicoLCD\n"); picolcd_check_version()
225 int picolcd_reset(struct hid_device *hdev) picolcd_reset() argument
227 struct picolcd_data *data = hid_get_drvdata(hdev); picolcd_reset()
228 struct hid_report *report = picolcd_out_report(REPORT_RESET, hdev); picolcd_reset()
236 if (hdev->product == USB_DEVICE_ID_PICOLCD_BOOTLOADER) picolcd_reset()
245 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); picolcd_reset()
248 error = picolcd_check_version(hdev); picolcd_reset()
284 report = picolcd_out_report(REPORT_EXIT_FLASHER, data->hdev); picolcd_operation_mode_store()
289 report = picolcd_out_report(REPORT_EXIT_KEYBOARD, data->hdev); picolcd_operation_mode_store()
304 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_operation_mode_store()
343 static int picolcd_raw_event(struct hid_device *hdev, picolcd_raw_event() argument
346 struct picolcd_data *data = hid_get_drvdata(hdev); picolcd_raw_event()
354 hid_warn(hdev, "invalid size value (%d) for picolcd raw event (%d)\n", picolcd_raw_event()
379 picolcd_debug_raw_event(data, hdev, report, raw_data, size); picolcd_raw_event()
384 static int picolcd_suspend(struct hid_device *hdev, pm_message_t message) picolcd_suspend() argument
389 picolcd_suspend_backlight(hid_get_drvdata(hdev)); picolcd_suspend()
394 static int picolcd_resume(struct hid_device *hdev) picolcd_resume() argument
397 ret = picolcd_resume_backlight(hid_get_drvdata(hdev)); picolcd_resume()
403 static int picolcd_reset_resume(struct hid_device *hdev) picolcd_reset_resume() argument
406 ret = picolcd_reset(hdev); picolcd_reset_resume()
409 ret = picolcd_fb_reset(hid_get_drvdata(hdev), 0); picolcd_reset_resume()
412 ret = picolcd_resume_lcd(hid_get_drvdata(hdev)); picolcd_reset_resume()
415 ret = picolcd_resume_backlight(hid_get_drvdata(hdev)); picolcd_reset_resume()
418 picolcd_leds_set(hid_get_drvdata(hdev)); picolcd_reset_resume()
427 struct hid_device *hdev = data->hdev; picolcd_init_keys() local
435 hid_err(hdev, "unsupported KEY_STATE report\n"); picolcd_init_keys()
441 hid_err(hdev, "failed to allocate input device\n"); picolcd_init_keys()
444 input_set_drvdata(idev, hdev); picolcd_init_keys()
446 idev->name = hdev->name; picolcd_init_keys()
447 idev->phys = hdev->phys; picolcd_init_keys()
448 idev->uniq = hdev->uniq; picolcd_init_keys()
449 idev->id.bustype = hdev->bus; picolcd_init_keys()
450 idev->id.vendor = hdev->vendor; picolcd_init_keys()
451 idev->id.product = hdev->product; picolcd_init_keys()
452 idev->id.version = hdev->version; picolcd_init_keys()
453 idev->dev.parent = &hdev->dev; picolcd_init_keys()
463 hid_err(hdev, "error registering the input device\n"); picolcd_init_keys()
480 static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) picolcd_probe_lcd() argument
485 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev)); picolcd_probe_lcd()
490 error = picolcd_init_cir(data, picolcd_in_report(REPORT_IR_DATA, hdev)); picolcd_probe_lcd()
500 error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev)); picolcd_probe_lcd()
505 error = picolcd_init_backlight(data, picolcd_out_report(REPORT_BRIGHTNESS, hdev)); picolcd_probe_lcd()
510 error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev)); picolcd_probe_lcd()
514 picolcd_init_devfs(data, picolcd_out_report(REPORT_EE_READ, hdev), picolcd_probe_lcd()
515 picolcd_out_report(REPORT_EE_WRITE, hdev), picolcd_probe_lcd()
516 picolcd_out_report(REPORT_READ_MEMORY, hdev), picolcd_probe_lcd()
517 picolcd_out_report(REPORT_WRITE_MEMORY, hdev), picolcd_probe_lcd()
518 picolcd_out_report(REPORT_RESET, hdev)); picolcd_probe_lcd()
530 static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data *data) picolcd_probe_bootloader() argument
533 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), picolcd_probe_bootloader()
534 picolcd_out_report(REPORT_BL_WRITE_MEMORY, hdev), NULL); picolcd_probe_bootloader()
538 static int picolcd_probe(struct hid_device *hdev, picolcd_probe() argument
552 hid_err(hdev, "can't allocate space for Minibox PicoLCD device data\n"); picolcd_probe()
559 data->hdev = hdev; picolcd_probe()
561 if (hdev->product == USB_DEVICE_ID_PICOLCD_BOOTLOADER) picolcd_probe()
563 hid_set_drvdata(hdev, data); picolcd_probe()
566 error = hid_parse(hdev); picolcd_probe()
568 hid_err(hdev, "device report parse failed\n"); picolcd_probe()
572 error = hid_hw_start(hdev, 0); picolcd_probe()
574 hid_err(hdev, "hardware start failed\n"); picolcd_probe()
578 error = hid_hw_open(hdev); picolcd_probe()
580 hid_err(hdev, "failed to open input interrupt pipe for key and IR events\n"); picolcd_probe()
584 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay); picolcd_probe()
586 hid_err(hdev, "failed to create sysfs attributes\n"); picolcd_probe()
590 error = device_create_file(&hdev->dev, &dev_attr_operation_mode); picolcd_probe()
592 hid_err(hdev, "failed to create sysfs attributes\n"); picolcd_probe()
597 error = picolcd_probe_bootloader(hdev, data); picolcd_probe()
599 error = picolcd_probe_lcd(hdev, data); picolcd_probe()
607 device_remove_file(&hdev->dev, &dev_attr_operation_mode); picolcd_probe()
609 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); picolcd_probe()
611 hid_hw_close(hdev); picolcd_probe()
613 hid_hw_stop(hdev); picolcd_probe()
617 hid_set_drvdata(hdev, NULL); picolcd_probe()
622 static void picolcd_remove(struct hid_device *hdev) picolcd_remove() argument
624 struct picolcd_data *data = hid_get_drvdata(hdev); picolcd_remove()
633 device_remove_file(&hdev->dev, &dev_attr_operation_mode); picolcd_remove()
634 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); picolcd_remove()
635 hid_hw_close(hdev); picolcd_remove()
636 hid_hw_stop(hdev); picolcd_remove()
654 hid_set_drvdata(hdev, NULL); picolcd_remove()
H A Dhid-samsung.c56 static inline void samsung_irda_dev_trace(struct hid_device *hdev, samsung_irda_dev_trace() argument
59 hid_info(hdev, "fixing up Samsung IrDA %d byte report descriptor\n", samsung_irda_dev_trace()
63 static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, samsung_irda_report_fixup() argument
70 samsung_irda_dev_trace(hdev, 184); samsung_irda_report_fixup()
78 samsung_irda_dev_trace(hdev, 203); samsung_irda_report_fixup()
84 samsung_irda_dev_trace(hdev, 135); samsung_irda_report_fixup()
90 samsung_irda_dev_trace(hdev, 171); samsung_irda_report_fixup()
100 static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, samsung_kbd_mouse_input_mapping() argument
104 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); samsung_kbd_mouse_input_mapping()
133 static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, samsung_report_fixup() argument
136 if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) samsung_report_fixup()
137 rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize); samsung_report_fixup()
141 static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi, samsung_input_mapping() argument
147 if (USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE == hdev->product) samsung_input_mapping()
148 ret = samsung_kbd_mouse_input_mapping(hdev, samsung_input_mapping()
154 static int samsung_probe(struct hid_device *hdev, samsung_probe() argument
160 ret = hid_parse(hdev); samsung_probe()
162 hid_err(hdev, "parse failed\n"); samsung_probe()
166 if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) { samsung_probe()
167 if (hdev->rsize == 184) { samsung_probe()
174 ret = hid_hw_start(hdev, cmask); samsung_probe()
176 hid_err(hdev, "hw start failed\n"); samsung_probe()
H A Dhid-cp2112.c155 struct hid_device *hdev; member in struct:cp2112_device
173 struct hid_device *hdev = dev->hdev; cp2112_gpio_direction_input() local
177 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, cp2112_gpio_direction_input()
181 hid_err(hdev, "error requesting GPIO config: %d\n", ret); cp2112_gpio_direction_input()
188 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), cp2112_gpio_direction_input()
191 hid_err(hdev, "error setting GPIO config: %d\n", ret); cp2112_gpio_direction_input()
202 struct hid_device *hdev = dev->hdev; cp2112_gpio_set() local
210 ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, sizeof(buf), cp2112_gpio_set()
213 hid_err(hdev, "error setting GPIO values: %d\n", ret); cp2112_gpio_set()
220 struct hid_device *hdev = dev->hdev; cp2112_gpio_get() local
224 ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, sizeof(buf), cp2112_gpio_get()
227 hid_err(hdev, "error requesting GPIO values: %d\n", ret); cp2112_gpio_get()
239 struct hid_device *hdev = dev->hdev; cp2112_gpio_direction_output() local
243 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, cp2112_gpio_direction_output()
247 hid_err(hdev, "error requesting GPIO config: %d\n", ret); cp2112_gpio_direction_output()
254 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), cp2112_gpio_direction_output()
257 hid_err(hdev, "error setting GPIO config: %d\n", ret); cp2112_gpio_direction_output()
270 static int cp2112_hid_get(struct hid_device *hdev, unsigned char report_number, cp2112_hid_get() argument
280 ret = hid_hw_raw_request(hdev, report_number, buf, count, cp2112_hid_get()
287 static int cp2112_hid_output(struct hid_device *hdev, u8 *data, size_t count, cp2112_hid_output() argument
298 ret = hid_hw_output_report(hdev, buf, count); cp2112_hid_output()
300 ret = hid_hw_raw_request(hdev, buf[0], buf, count, report_type, cp2112_hid_output()
332 struct hid_device *hdev = dev->hdev; cp2112_xfer_status() local
340 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); cp2112_xfer_status()
342 hid_warn(hdev, "Error requesting status: %d\n", ret); cp2112_xfer_status()
355 struct hid_device *hdev = dev->hdev; cp2112_read() local
366 ret = cp2112_hid_output(hdev, &report.report, sizeof(report), cp2112_read()
369 hid_warn(hdev, "Error requesting data: %d\n", ret); cp2112_read()
377 hid_dbg(hdev, "read %d of %zd bytes requested\n", cp2112_read()
453 struct hid_device *hdev = dev->hdev; cp2112_i2c_xfer() local
459 hid_dbg(hdev, "I2C %d messages\n", num); cp2112_i2c_xfer()
462 hid_err(hdev, cp2112_i2c_xfer()
476 ret = hid_hw_power(hdev, PM_HINT_FULLON); cp2112_i2c_xfer()
478 hid_err(hdev, "power management error: %d\n", ret); cp2112_i2c_xfer()
482 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); cp2112_i2c_xfer()
484 hid_warn(hdev, "Error starting transaction: %d\n", ret); cp2112_i2c_xfer()
498 hid_warn(hdev, "Transfer timed out, cancelling.\n"); cp2112_i2c_xfer()
502 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); cp2112_i2c_xfer()
504 hid_warn(hdev, "Error cancelling transaction: %d\n", cp2112_i2c_xfer()
518 hid_warn(hdev, "short read: %d < %d\n", ret, msgs->len); cp2112_i2c_xfer()
528 hid_hw_power(hdev, PM_HINT_NORMAL); cp2112_i2c_xfer()
529 hid_dbg(hdev, "I2C transfer finished: %d\n", ret); cp2112_i2c_xfer()
538 struct hid_device *hdev = dev->hdev; cp2112_xfer() local
546 hid_dbg(hdev, "%s addr 0x%x flags 0x%x cmd 0x%x size %d\n", cp2112_xfer()
613 hid_warn(hdev, "Unsupported transaction %d\n", size); cp2112_xfer()
620 ret = hid_hw_power(hdev, PM_HINT_FULLON); cp2112_xfer()
622 hid_err(hdev, "power management error: %d\n", ret); cp2112_xfer()
626 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); cp2112_xfer()
628 hid_warn(hdev, "Error starting transaction: %d\n", ret); cp2112_xfer()
642 hid_warn(hdev, "Transfer timed out, cancelling.\n"); cp2112_xfer()
646 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); cp2112_xfer()
648 hid_warn(hdev, "Error cancelling transaction: %d\n", cp2112_xfer()
667 hid_warn(hdev, "short read: %d < %zd\n", ret, read_length); cp2112_xfer()
692 hid_hw_power(hdev, PM_HINT_NORMAL); cp2112_xfer()
693 hid_dbg(hdev, "transfer finished: %d\n", ret); cp2112_xfer()
715 static int cp2112_get_usb_config(struct hid_device *hdev, cp2112_get_usb_config() argument
720 ret = cp2112_hid_get(hdev, CP2112_USB_CONFIG, (u8 *)cfg, sizeof(*cfg), cp2112_get_usb_config()
723 hid_err(hdev, "error reading usb config: %d\n", ret); cp2112_get_usb_config()
732 static int cp2112_set_usb_config(struct hid_device *hdev, cp2112_set_usb_config() argument
739 ret = cp2112_hid_output(hdev, (u8 *)cfg, sizeof(*cfg), cp2112_set_usb_config()
742 hid_err(hdev, "error writing usb config: %d\n", ret); cp2112_set_usb_config()
751 static void chmod_sysfs_attrs(struct hid_device *hdev);
758 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
760 int ret = cp2112_get_usb_config(hdev, &cfg); \
764 ret = cp2112_set_usb_config(hdev, &cfg); \
767 chmod_sysfs_attrs(hdev); \
773 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \
775 int ret = cp2112_get_usb_config(hdev, &cfg); \
838 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); pstr_store() local
852 ret = cp2112_hid_output(hdev, &report.report, report.length + 1, pstr_store()
855 hid_err(hdev, "error writing %s string: %d\n", kattr->attr.name, pstr_store()
862 chmod_sysfs_attrs(hdev); pstr_store()
869 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); pstr_show() local
876 ret = cp2112_hid_get(hdev, attr->report, &report.report, pstr_show()
879 hid_err(hdev, "error reading %s string: %d\n", kattr->attr.name, pstr_show()
887 hid_err(hdev, "invalid %s string length: %d\n", pstr_show()
932 static void chmod_sysfs_attrs(struct hid_device *hdev) chmod_sysfs_attrs() argument
938 ret = cp2112_hid_get(hdev, CP2112_LOCK_BYTE, buf, sizeof(buf), chmod_sysfs_attrs()
941 hid_err(hdev, "error reading lock byte: %d\n", ret); chmod_sysfs_attrs()
947 ret = sysfs_chmod_file(&hdev->dev.kobj, *attr, mode); chmod_sysfs_attrs()
949 hid_err(hdev, "error chmoding sysfs file %s\n", chmod_sysfs_attrs()
955 static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) cp2112_probe() argument
962 ret = hid_parse(hdev); cp2112_probe()
964 hid_err(hdev, "parse failed\n"); cp2112_probe()
968 ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); cp2112_probe()
970 hid_err(hdev, "hw start failed\n"); cp2112_probe()
974 ret = hid_hw_open(hdev); cp2112_probe()
976 hid_err(hdev, "hw open failed\n"); cp2112_probe()
980 ret = hid_hw_power(hdev, PM_HINT_FULLON); cp2112_probe()
982 hid_err(hdev, "power management error: %d\n", ret); cp2112_probe()
986 ret = cp2112_hid_get(hdev, CP2112_GET_VERSION_INFO, buf, sizeof(buf), cp2112_probe()
989 hid_err(hdev, "error requesting version\n"); cp2112_probe()
995 hid_info(hdev, "Part Number: 0x%02X Device Version: 0x%02X\n", cp2112_probe()
998 ret = cp2112_hid_get(hdev, CP2112_SMBUS_CONFIG, (u8 *)&config, cp2112_probe()
1001 hid_err(hdev, "error requesting SMBus config\n"); cp2112_probe()
1009 ret = cp2112_hid_output(hdev, (u8 *)&config, sizeof(config), cp2112_probe()
1012 hid_err(hdev, "error setting SMBus config\n"); cp2112_probe()
1024 hid_set_drvdata(hdev, (void *)dev); cp2112_probe()
1025 dev->hdev = hdev; cp2112_probe()
1030 dev->adap.dev.parent = &hdev->dev; cp2112_probe()
1032 "CP2112 SMBus Bridge on hiddev%d", hdev->minor); cp2112_probe()
1035 hid_device_io_start(hdev); cp2112_probe()
1037 hid_device_io_stop(hdev); cp2112_probe()
1040 hid_err(hdev, "error registering i2c adapter\n"); cp2112_probe()
1044 hid_dbg(hdev, "adapter registered\n"); cp2112_probe()
1054 dev->gc.dev = &hdev->dev; cp2112_probe()
1058 hid_err(hdev, "error registering gpio chip\n"); cp2112_probe()
1062 ret = sysfs_create_group(&hdev->dev.kobj, &cp2112_attr_group); cp2112_probe()
1064 hid_err(hdev, "error creating sysfs attrs\n"); cp2112_probe()
1068 chmod_sysfs_attrs(hdev); cp2112_probe()
1069 hid_hw_power(hdev, PM_HINT_NORMAL); cp2112_probe()
1080 hid_hw_power(hdev, PM_HINT_NORMAL); cp2112_probe()
1082 hid_hw_close(hdev); cp2112_probe()
1084 hid_hw_stop(hdev); cp2112_probe()
1088 static void cp2112_remove(struct hid_device *hdev) cp2112_remove() argument
1090 struct cp2112_device *dev = hid_get_drvdata(hdev); cp2112_remove()
1092 sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group); cp2112_remove()
1101 hid_hw_close(hdev); cp2112_remove()
1102 hid_hw_stop(hdev); cp2112_remove()
1106 static int cp2112_raw_event(struct hid_device *hdev, struct hid_report *report, cp2112_raw_event() argument
1109 struct cp2112_device *dev = hid_get_drvdata(hdev); cp2112_raw_event()
1114 hid_dbg(hdev, "xfer status: %02x %02x %04x %04x\n", cp2112_raw_event()
1147 hid_dbg(hdev, "read response: %02x %02x\n", data[1], data[2]); cp2112_raw_event()
1157 hid_err(hdev, "unknown report\n"); cp2112_raw_event()
H A Dhid-sensor-hub.c68 static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev, sensor_hub_report() argument
73 list_for_each_entry(report, &hdev->report_enum[dir].report_list, list) { sensor_hub_report()
77 hid_warn(hdev, "No report with id 0x%x found\n", id); sensor_hub_report()
82 static int sensor_hub_get_physical_device_count(struct hid_device *hdev) sensor_hub_get_physical_device_count() argument
87 for (i = 0; i < hdev->maxcollection; ++i) { sensor_hub_get_physical_device_count()
88 struct hid_collection *collection = &hdev->collection[i]; sensor_hub_get_physical_device_count()
111 struct hid_device *hdev, sensor_hub_get_callback()
118 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); sensor_hub_get_callback()
145 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); sensor_hub_register_callback()
186 struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); sensor_hub_remove_callback()
207 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); sensor_hub_set_feature()
215 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); sensor_hub_set_feature()
235 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); sensor_hub_set_feature()
236 hid_hw_wait(hsdev->hdev); sensor_hub_set_feature()
249 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); sensor_hub_get_feature()
254 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); sensor_hub_get_feature()
260 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT); sensor_hub_get_feature()
261 hid_hw_wait(hsdev->hdev); sensor_hub_get_feature()
287 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); sensor_hub_input_attr_get_raw_value()
292 report = sensor_hub_report(report_id, hsdev->hdev, sensor_hub_input_attr_get_raw_value()
310 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT); sensor_hub_input_attr_get_raw_value()
344 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); hid_sensor_get_usage_index()
370 struct hid_device *hdev = hsdev->hdev; sensor_hub_input_get_attribute_info() local
380 report_enum = &hdev->report_enum[type]; sensor_hub_input_get_attribute_info()
410 static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) sensor_hub_suspend() argument
412 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); sensor_hub_suspend()
416 hid_dbg(hdev, " sensor_hub_suspend\n"); sensor_hub_suspend()
428 static int sensor_hub_resume(struct hid_device *hdev) sensor_hub_resume() argument
430 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); sensor_hub_resume()
434 hid_dbg(hdev, " sensor_hub_resume\n"); sensor_hub_resume()
446 static int sensor_hub_reset_resume(struct hid_device *hdev) sensor_hub_reset_resume() argument
455 static int sensor_hub_raw_event(struct hid_device *hdev, sensor_hub_raw_event() argument
461 struct sensor_hub_data *pdata = hid_get_drvdata(hdev); sensor_hub_raw_event()
468 hid_dbg(hdev, "sensor_hub_raw_event report id:0x%x size:%d type:%d\n", sensor_hub_raw_event()
470 hid_dbg(hdev, "maxfield:%d\n", report->maxfield); sensor_hub_raw_event()
480 hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", sensor_hub_raw_event()
487 collection = &hdev->collection[ sensor_hub_raw_event()
489 hid_dbg(hdev, "collection->usage %x\n", sensor_hub_raw_event()
492 callback = sensor_hub_get_callback(hdev, sensor_hub_raw_event()
504 hid_dbg(hdev, "data was pending ...\n"); sensor_hub_raw_event()
535 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); sensor_hub_device_open()
539 ret = hid_hw_open(hsdev->hdev); sensor_hub_device_open()
541 hid_err(hsdev->hdev, "failed to open hid device\n"); sensor_hub_device_open()
555 struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); sensor_hub_device_close()
560 hid_hw_close(hsdev->hdev); sensor_hub_device_close()
565 static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, sensor_hub_report_fixup() argument
569 struct sensor_hub_data *sd = hid_get_drvdata(hdev); sensor_hub_report_fixup()
576 hid_dbg(hdev, "No Enum quirks\n"); sensor_hub_report_fixup()
599 static int sensor_hub_probe(struct hid_device *hdev, sensor_hub_probe() argument
611 sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); sensor_hub_probe()
613 hid_err(hdev, "cannot allocate Sensor data\n"); sensor_hub_probe()
617 hid_set_drvdata(hdev, sd); sensor_hub_probe()
623 ret = hid_parse(hdev); sensor_hub_probe()
625 hid_err(hdev, "parse failed\n"); sensor_hub_probe()
628 INIT_LIST_HEAD(&hdev->inputs); sensor_hub_probe()
630 ret = hid_hw_start(hdev, 0); sensor_hub_probe()
632 hid_err(hdev, "hw start failed\n"); sensor_hub_probe()
638 dev_cnt = sensor_hub_get_physical_device_count(hdev); sensor_hub_probe()
640 hid_err(hdev, "Invalid Physical device count\n"); sensor_hub_probe()
644 sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * sensor_hub_probe()
648 hid_err(hdev, "Failed to allocate memory for mfd cells\n"); sensor_hub_probe()
653 for (i = 0; i < hdev->maxcollection; ++i) { sensor_hub_probe()
654 struct hid_collection *collection = &hdev->collection[i]; sensor_hub_probe()
659 hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), sensor_hub_probe()
662 hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); sensor_hub_probe()
666 hsdev->hdev = hdev; sensor_hub_probe()
667 hsdev->vendor_id = hdev->vendor; sensor_hub_probe()
668 hsdev->product_id = hdev->product; sensor_hub_probe()
670 hsdev->mutex_ptr = devm_kzalloc(&hdev->dev, sensor_hub_probe()
682 name = devm_kasprintf(&hdev->dev, GFP_KERNEL, sensor_hub_probe()
686 hid_err(hdev, "Failed MFD device name\n"); sensor_hub_probe()
698 hid_dbg(hdev, "Adding %s:%d\n", name, sensor_hub_probe()
713 ret = mfd_add_hotplug_devices(&hdev->dev, sensor_hub_probe()
722 hid_hw_stop(hdev); sensor_hub_probe()
727 static void sensor_hub_remove(struct hid_device *hdev) sensor_hub_remove() argument
729 struct sensor_hub_data *data = hid_get_drvdata(hdev); sensor_hub_remove()
733 hid_dbg(hdev, " hardware removed\n"); sensor_hub_remove()
734 hid_hw_close(hdev); sensor_hub_remove()
735 hid_hw_stop(hdev); sensor_hub_remove()
744 mfd_remove_devices(&hdev->dev); sensor_hub_remove()
745 hid_set_drvdata(hdev, NULL); sensor_hub_remove()
110 sensor_hub_get_callback( struct hid_device *hdev, u32 usage_id, int collection_index, struct hid_sensor_hub_device **hsdev, void **priv) sensor_hub_get_callback() argument
H A Dhid-belkin.c29 static int belkin_input_mapping(struct hid_device *hdev, struct hid_input *hi, belkin_input_mapping() argument
33 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); belkin_input_mapping()
49 static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id) belkin_probe() argument
54 hid_set_drvdata(hdev, (void *)quirks); belkin_probe()
56 ret = hid_parse(hdev); belkin_probe()
58 hid_err(hdev, "parse failed\n"); belkin_probe()
62 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | belkin_probe()
65 hid_err(hdev, "hw start failed\n"); belkin_probe()
H A Dhid-cypress.c33 static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, cp_report_fixup() argument
36 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); cp_report_fixup()
55 static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, cp_input_mapped() argument
59 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); cp_input_mapped()
72 static int cp_event(struct hid_device *hdev, struct hid_field *field, cp_event() argument
75 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); cp_event()
77 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || cp_event()
86 hid_set_drvdata(hdev, (void *)quirks); cp_event()
100 static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id) cp_probe() argument
105 hid_set_drvdata(hdev, (void *)quirks); cp_probe()
107 ret = hid_parse(hdev); cp_probe()
109 hid_err(hdev, "parse failed\n"); cp_probe()
113 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); cp_probe()
115 hid_err(hdev, "hw start failed\n"); cp_probe()
H A Dhid-roccat-lua.c118 static int lua_init_specials(struct hid_device *hdev) lua_init_specials() argument
120 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); lua_init_specials()
127 hid_err(hdev, "can't alloc device descriptor\n"); lua_init_specials()
130 hid_set_drvdata(hdev, lua); lua_init_specials()
134 hid_err(hdev, "couldn't init struct lua_device\n"); lua_init_specials()
140 hid_err(hdev, "cannot create sysfs files\n"); lua_init_specials()
150 static void lua_remove_specials(struct hid_device *hdev) lua_remove_specials() argument
152 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); lua_remove_specials()
157 lua = hid_get_drvdata(hdev); lua_remove_specials()
161 static int lua_probe(struct hid_device *hdev, lua_probe() argument
166 retval = hid_parse(hdev); lua_probe()
168 hid_err(hdev, "parse failed\n"); lua_probe()
172 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); lua_probe()
174 hid_err(hdev, "hw start failed\n"); lua_probe()
178 retval = lua_init_specials(hdev); lua_probe()
180 hid_err(hdev, "couldn't install mouse\n"); lua_probe()
187 hid_hw_stop(hdev); lua_probe()
192 static void lua_remove(struct hid_device *hdev) lua_remove() argument
194 lua_remove_specials(hdev); lua_remove()
195 hid_hw_stop(hdev); lua_remove()
H A Dhid-a4tech.c35 static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, a4_input_mapped() argument
39 struct a4tech_sc *a4 = hid_get_drvdata(hdev); a4_input_mapped()
50 static int a4_event(struct hid_device *hdev, struct hid_field *field, a4_event() argument
53 struct a4tech_sc *a4 = hid_get_drvdata(hdev); a4_event()
56 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || a4_event()
88 static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id) a4_probe() argument
93 a4 = devm_kzalloc(&hdev->dev, sizeof(*a4), GFP_KERNEL); a4_probe()
95 hid_err(hdev, "can't alloc device descriptor\n"); a4_probe()
101 hid_set_drvdata(hdev, a4); a4_probe()
103 ret = hid_parse(hdev); a4_probe()
105 hid_err(hdev, "parse failed\n"); a4_probe()
109 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); a4_probe()
111 hid_err(hdev, "hw start failed\n"); a4_probe()
H A Dhid-petalynx.c25 static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, pl_report_fixup() argument
31 hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); pl_report_fixup()
40 static int pl_input_mapping(struct hid_device *hdev, struct hid_input *hi, pl_input_mapping() argument
70 static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) pl_probe() argument
74 hdev->quirks |= HID_QUIRK_NOGET; pl_probe()
76 ret = hid_parse(hdev); pl_probe()
78 hid_err(hdev, "parse failed\n"); pl_probe()
82 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); pl_probe()
84 hid_err(hdev, "hw start failed\n"); pl_probe()
H A Dwacom_sys.c30 static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf, wacom_get_report() argument
36 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, wacom_get_report()
43 static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, wacom_set_report() argument
49 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, wacom_set_report()
56 static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, wacom_raw_event() argument
59 struct wacom *wacom = hid_get_drvdata(hdev); wacom_raw_event()
75 return hid_hw_open(wacom->hdev); wacom_open()
82 hid_hw_close(wacom->hdev); wacom_close()
101 static void wacom_feature_mapping(struct hid_device *hdev, wacom_feature_mapping() argument
104 struct wacom *wacom = hid_get_drvdata(hdev); wacom_feature_mapping()
119 ret = wacom_get_report(hdev, HID_FEATURE_REPORT, wacom_feature_mapping()
129 dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n"); wacom_feature_mapping()
171 static void wacom_usage_mapping(struct hid_device *hdev, wacom_usage_mapping() argument
174 struct wacom *wacom = hid_get_drvdata(hdev); wacom_usage_mapping()
228 wacom_wac_usage_mapping(hdev, field, usage); wacom_usage_mapping()
231 static void wacom_post_parse_hid(struct hid_device *hdev, wacom_post_parse_hid() argument
234 struct wacom *wacom = hid_get_drvdata(hdev); wacom_post_parse_hid()
246 static void wacom_parse_hid(struct hid_device *hdev, wacom_parse_hid() argument
254 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; wacom_parse_hid()
262 wacom_feature_mapping(hdev, hreport->field[i], wacom_parse_hid()
269 rep_enum = &hdev->report_enum[HID_INPUT_REPORT]; wacom_parse_hid()
277 wacom_usage_mapping(hdev, hreport->field[i], wacom_parse_hid()
281 wacom_post_parse_hid(hdev, features); wacom_parse_hid()
284 static int wacom_hid_set_device_mode(struct hid_device *hdev) wacom_hid_set_device_mode() argument
286 struct wacom *wacom = hid_get_drvdata(hdev); wacom_hid_set_device_mode()
294 re = &(hdev->report_enum[HID_FEATURE_REPORT]); wacom_hid_set_device_mode()
298 hid_hw_request(hdev, r, HID_REQ_SET_REPORT); wacom_hid_set_device_mode()
303 static int wacom_set_device_mode(struct hid_device *hdev, int report_id, wacom_set_device_mode() argument
317 error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, wacom_set_device_mode()
320 error = wacom_get_report(hdev, HID_FEATURE_REPORT, wacom_set_device_mode()
329 static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, wacom_bt_query_tablet_data() argument
332 struct wacom *wacom = hid_get_drvdata(hdev); wacom_bt_query_tablet_data()
340 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, wacom_bt_query_tablet_data()
347 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, wacom_bt_query_tablet_data()
360 hid_warn(hdev, "failed to poke device, command %d, err %d\n", wacom_bt_query_tablet_data()
372 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, wacom_bt_query_tablet_data()
389 static int wacom_query_tablet_data(struct hid_device *hdev, wacom_query_tablet_data() argument
392 if (hdev->bus == BUS_BLUETOOTH) wacom_query_tablet_data()
393 return wacom_bt_query_tablet_data(hdev, 1, features); wacom_query_tablet_data()
396 return wacom_hid_set_device_mode(hdev); wacom_query_tablet_data()
401 return wacom_set_device_mode(hdev, 3, 4, 4); wacom_query_tablet_data()
404 return wacom_set_device_mode(hdev, 18, 3, 2); wacom_query_tablet_data()
407 return wacom_set_device_mode(hdev, 131, 3, 2); wacom_query_tablet_data()
410 return wacom_set_device_mode(hdev, 2, 2, 2); wacom_query_tablet_data()
414 return wacom_set_device_mode(hdev, 2, 2, 2); wacom_query_tablet_data()
421 static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, wacom_retrieve_hid_descriptor() argument
424 struct wacom *wacom = hid_get_drvdata(hdev); wacom_retrieve_hid_descriptor()
453 wacom_parse_hid(hdev, features); wacom_retrieve_hid_descriptor()
466 static bool wacom_are_sibling(struct hid_device *hdev, wacom_are_sibling() argument
469 struct wacom *wacom = hid_get_drvdata(hdev); wacom_are_sibling()
476 vid = hdev->vendor; wacom_are_sibling()
477 pid = hdev->product; wacom_are_sibling()
484 n1 = strrchr(hdev->phys, '.') - hdev->phys; wacom_are_sibling()
489 return !strncmp(hdev->phys, sibling->phys, n1); wacom_are_sibling()
492 static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev) wacom_get_hdev_data() argument
497 if (wacom_are_sibling(hdev, data->dev)) { wacom_get_hdev_data()
506 static int wacom_add_shared_data(struct hid_device *hdev) wacom_add_shared_data() argument
508 struct wacom *wacom = hid_get_drvdata(hdev); wacom_add_shared_data()
515 data = wacom_get_hdev_data(hdev); wacom_add_shared_data()
524 data->dev = hdev; wacom_add_shared_data()
531 wacom_wac->shared->touch = hdev; wacom_add_shared_data()
533 wacom_wac->shared->pen = hdev; wacom_add_shared_data()
561 if (wacom_wac->shared->touch == wacom->hdev) wacom_remove_shared_data()
563 else if (wacom_wac->shared->pen == wacom->hdev) wacom_remove_shared_data()
600 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT, wacom_led_control()
621 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size, wacom_led_control()
642 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, wacom_led_putimage()
653 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, wacom_led_putimage()
662 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, wacom_led_putimage()
673 struct hid_device *hdev = container_of(dev, struct hid_device, dev); wacom_led_select_store() local
674 struct wacom *wacom = hid_get_drvdata(hdev); wacom_led_select_store()
701 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
702 struct wacom *wacom = hid_get_drvdata(hdev); \
737 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
738 struct wacom *wacom = hid_get_drvdata(hdev); \
760 struct hid_device *hdev = container_of(dev, struct hid_device, dev); wacom_button_image_store() local
761 struct wacom *wacom = hid_get_drvdata(hdev); wacom_button_image_store()
766 if (hdev->bus == BUS_BLUETOOTH) { wacom_button_image_store()
862 error = sysfs_create_group(&wacom->hdev->dev.kobj, wacom_initialize_leds()
874 error = sysfs_create_group(&wacom->hdev->dev.kobj, wacom_initialize_leds()
891 error = sysfs_create_group(&wacom->hdev->dev.kobj, wacom_initialize_leds()
902 hid_err(wacom->hdev, wacom_initialize_leds()
924 sysfs_remove_group(&wacom->hdev->dev.kobj, wacom_destroy_leds()
930 sysfs_remove_group(&wacom->hdev->dev.kobj, wacom_destroy_leds()
941 sysfs_remove_group(&wacom->hdev->dev.kobj, wacom_destroy_leds()
1047 wacom->battery = power_supply_register(&wacom->hdev->dev, wacom_initialize_battery()
1052 power_supply_powers(wacom->battery, &wacom->hdev->dev); wacom_initialize_battery()
1054 wacom->ac = power_supply_register(&wacom->hdev->dev, wacom_initialize_battery()
1062 power_supply_powers(wacom->ac, &wacom->hdev->dev); wacom_initialize_battery()
1082 struct hid_device *hdev = container_of(dev, struct hid_device, dev); wacom_show_speed() local
1083 struct wacom *wacom = hid_get_drvdata(hdev); wacom_show_speed()
1092 struct hid_device *hdev = container_of(dev, struct hid_device, dev); wacom_store_speed() local
1093 struct wacom *wacom = hid_get_drvdata(hdev); wacom_store_speed()
1102 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); wacom_store_speed()
1113 struct hid_device *hdev = wacom->hdev; wacom_allocate_input() local
1121 input_dev->phys = hdev->phys; wacom_allocate_input()
1122 input_dev->dev.parent = &hdev->dev; wacom_allocate_input()
1125 input_dev->uniq = hdev->uniq; wacom_allocate_input()
1126 input_dev->id.bustype = hdev->bus; wacom_allocate_input()
1127 input_dev->id.vendor = hdev->vendor; wacom_allocate_input()
1128 input_dev->id.product = wacom_wac->pid ? wacom_wac->pid : hdev->product; wacom_allocate_input()
1129 input_dev->id.version = hdev->version; wacom_allocate_input()
1265 hid_info(wacom->hdev, "wireless tablet disconnected\n"); wacom_wireless_work()
1270 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n", wacom_wireless_work()
1281 hid_info(wacom->hdev, "ignoring unknown PID.\n"); wacom_wireless_work()
1382 static size_t wacom_compute_pktlen(struct hid_device *hdev) wacom_compute_pktlen() argument
1388 report_enum = hdev->report_enum + HID_INPUT_REPORT; wacom_compute_pktlen()
1399 static int wacom_probe(struct hid_device *hdev, wacom_probe() argument
1402 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); wacom_probe()
1413 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; wacom_probe()
1416 hdev->quirks &= ~HID_QUIRK_NOGET; wacom_probe()
1422 hid_set_drvdata(hdev, wacom); wacom_probe()
1423 wacom->hdev = hdev; wacom_probe()
1426 error = hid_parse(hdev); wacom_probe()
1428 hid_err(hdev, "parse failed\n"); wacom_probe()
1435 features->pktlen = wacom_compute_pktlen(hdev); wacom_probe()
1441 if (features->check_for_hid_type && features->hid_type != hdev->type) { wacom_probe()
1476 wacom_retrieve_hid_descriptor(hdev, features); wacom_probe()
1512 if (hdev->bus == BUS_BLUETOOTH) wacom_probe()
1536 error = wacom_add_shared_data(hdev); wacom_probe()
1553 if (hdev->bus == BUS_BLUETOOTH) { wacom_probe()
1554 error = device_create_file(&hdev->dev, &dev_attr_speed); wacom_probe()
1556 hid_warn(hdev, wacom_probe()
1565 error = hid_hw_start(hdev, connect_mask); wacom_probe()
1567 hid_err(hdev, "hw start failed\n"); wacom_probe()
1572 wacom_query_tablet_data(hdev, features); wacom_probe()
1575 error = hid_hw_open(hdev); wacom_probe()
1585 if (hdev->bus == BUS_BLUETOOTH) wacom_probe()
1586 device_remove_file(&hdev->dev, &dev_attr_speed); wacom_probe()
1599 hid_set_drvdata(hdev, NULL); wacom_probe()
1603 static void wacom_remove(struct hid_device *hdev) wacom_remove() argument
1605 struct wacom *wacom = hid_get_drvdata(hdev); wacom_remove()
1607 hid_hw_stop(hdev); wacom_remove()
1611 if (hdev->bus == BUS_BLUETOOTH) wacom_remove()
1612 device_remove_file(&hdev->dev, &dev_attr_speed); wacom_remove()
1616 hid_set_drvdata(hdev, NULL); wacom_remove()
1621 static int wacom_resume(struct hid_device *hdev) wacom_resume() argument
1623 struct wacom *wacom = hid_get_drvdata(hdev); wacom_resume()
1629 wacom_query_tablet_data(hdev, features); wacom_resume()
1637 static int wacom_reset_resume(struct hid_device *hdev) wacom_reset_resume() argument
1639 return wacom_resume(hdev); wacom_reset_resume()
H A Dhid-gt683r.c55 struct hid_device *hdev; member in struct:gt683r_led
73 struct hid_device *hdev = container_of(dev, struct hid_device, dev); gt683r_brightness_set() local
74 struct gt683r_led *led = hid_get_drvdata(hdev); gt683r_brightness_set()
92 struct hid_device *hdev = container_of(dev->parent, mode_show() local
94 struct gt683r_led *led = hid_get_drvdata(hdev); mode_show()
111 struct hid_device *hdev = container_of(dev->parent, mode_store() local
113 struct gt683r_led *led = hid_get_drvdata(hdev); mode_store()
138 ret = hid_hw_raw_request(led->hdev, msg[0], msg, GT683R_BUFFER_SIZE, gt683r_led_snd_msg()
141 hid_err(led->hdev, gt683r_led_snd_msg()
234 static int gt683r_led_probe(struct hid_device *hdev, gt683r_led_probe() argument
243 led = devm_kzalloc(&hdev->dev, sizeof(*led), GFP_KERNEL); gt683r_led_probe()
251 led->hdev = hdev; gt683r_led_probe()
252 hid_set_drvdata(hdev, led); gt683r_led_probe()
254 ret = hid_parse(hdev); gt683r_led_probe()
256 hid_err(hdev, "hid parsing failed\n"); gt683r_led_probe()
260 ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); gt683r_led_probe()
262 hid_err(hdev, "hw start failed\n"); gt683r_led_probe()
267 name_sz = strlen(dev_name(&hdev->dev)) + gt683r_led_probe()
270 name = devm_kzalloc(&hdev->dev, name_sz, GFP_KERNEL); gt683r_led_probe()
277 dev_name(&hdev->dev), gt683r_panel_names[i]); gt683r_led_probe()
283 ret = led_classdev_register(&hdev->dev, &led->led_devs[i]); gt683r_led_probe()
285 hid_err(hdev, "could not register led device\n"); gt683r_led_probe()
295 hid_hw_stop(hdev); gt683r_led_probe()
299 static void gt683r_led_remove(struct hid_device *hdev) gt683r_led_remove() argument
302 struct gt683r_led *led = hid_get_drvdata(hdev); gt683r_led_remove()
307 hid_hw_stop(hdev); gt683r_led_remove()
H A Dhid-saitek.c40 static int saitek_probe(struct hid_device *hdev, saitek_probe() argument
47 ssc = devm_kzalloc(&hdev->dev, sizeof(*ssc), GFP_KERNEL); saitek_probe()
49 hid_err(hdev, "can't alloc saitek descriptor\n"); saitek_probe()
56 hid_set_drvdata(hdev, ssc); saitek_probe()
58 ret = hid_parse(hdev); saitek_probe()
60 hid_err(hdev, "parse failed\n"); saitek_probe()
64 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); saitek_probe()
66 hid_err(hdev, "hw start failed\n"); saitek_probe()
73 static __u8 *saitek_report_fixup(struct hid_device *hdev, __u8 *rdesc, saitek_report_fixup() argument
76 struct saitek_sc *ssc = hid_get_drvdata(hdev); saitek_report_fixup()
83 hid_info(hdev, "Fixing up Saitek PS1000 report descriptor\n"); saitek_report_fixup()
97 static int saitek_raw_event(struct hid_device *hdev, saitek_raw_event() argument
100 struct saitek_sc *ssc = hid_get_drvdata(hdev); saitek_raw_event()
116 hid_dbg(hdev, "entered mode %d\n", mode); saitek_raw_event()
139 hid_dbg(hdev, "entered mode %d\n", mode); saitek_raw_event()
154 static int saitek_event(struct hid_device *hdev, struct hid_field *field, saitek_event() argument
157 struct saitek_sc *ssc = hid_get_drvdata(hdev); saitek_event()
H A Dhid-picolcd_debugfs.c60 picolcd_reset(data->hdev); picolcd_debug_reset_write()
101 resp = picolcd_send_and_wait(data->hdev, REPORT_EE_READ, raw_data, picolcd_debug_eeprom_read()
143 resp = picolcd_send_and_wait(data->hdev, REPORT_EE_WRITE, raw_data, picolcd_debug_eeprom_write()
201 resp = picolcd_send_and_wait(data->hdev, report_id, raw_data, len_off+1); _picolcd_flash_read()
256 resp = picolcd_send_and_wait(data->hdev, report_id, raw_data, len_off); _picolcd_flash_erase64()
287 resp = picolcd_send_and_wait(data->hdev, report_id, raw_data, _picolcd_flash_write()
395 struct hid_device *hdev, struct hid_report *report) picolcd_debug_out_report()
403 if (list_empty(&hdev->debug_list)) picolcd_debug_out_report()
418 hid_debug_event(hdev, buff); picolcd_debug_out_report()
422 hid_debug_event(hdev, buff); picolcd_debug_out_report()
429 hid_debug_event(hdev, buff); picolcd_debug_out_report()
431 hid_debug_event(hdev, buff); picolcd_debug_out_report()
437 hid_debug_event(hdev, buff); picolcd_debug_out_report()
439 hid_debug_event(hdev, buff); picolcd_debug_out_report()
445 hid_debug_event(hdev, buff); picolcd_debug_out_report()
447 hid_debug_event(hdev, buff); picolcd_debug_out_report()
453 hid_debug_event(hdev, buff); picolcd_debug_out_report()
456 hid_debug_event(hdev, buff); picolcd_debug_out_report()
462 hid_debug_event(hdev, buff); picolcd_debug_out_report()
470 hid_debug_event(hdev, buff); picolcd_debug_out_report()
477 hid_debug_event(hdev, buff); picolcd_debug_out_report()
483 hid_debug_event(hdev, buff); picolcd_debug_out_report()
486 hid_debug_event(hdev, buff); picolcd_debug_out_report()
488 hid_debug_event(hdev, buff); picolcd_debug_out_report()
494 hid_debug_event(hdev, buff); picolcd_debug_out_report()
497 hid_debug_event(hdev, buff); picolcd_debug_out_report()
499 hid_debug_event(hdev, buff); picolcd_debug_out_report()
504 hid_debug_event(hdev, buff); picolcd_debug_out_report()
509 hid_debug_event(hdev, buff); picolcd_debug_out_report()
516 hid_debug_event(hdev, buff); picolcd_debug_out_report()
529 hid_debug_event(hdev, buff); picolcd_debug_out_report()
536 hid_debug_event(hdev, buff); picolcd_debug_out_report()
541 hid_debug_event(hdev, buff); picolcd_debug_out_report()
547 hid_debug_event(hdev, buff); picolcd_debug_out_report()
553 hid_debug_event(hdev, buff); picolcd_debug_out_report()
560 hid_debug_event(hdev, buff); picolcd_debug_out_report()
565 hid_debug_event(hdev, buff); picolcd_debug_out_report()
567 hid_debug_event(hdev, buff); picolcd_debug_out_report()
572 hid_debug_event(hdev, buff); picolcd_debug_out_report()
581 hid_debug_event(hdev, buff); picolcd_debug_out_report()
583 hid_debug_event(hdev, buff); picolcd_debug_out_report()
588 hid_debug_event(hdev, buff); picolcd_debug_out_report()
597 hid_debug_event(hdev, buff); picolcd_debug_out_report()
605 hid_debug_event(hdev, buff); picolcd_debug_out_report()
609 hid_debug_event(hdev, buff); picolcd_debug_out_report()
614 hid_debug_event(hdev, buff); picolcd_debug_out_report()
619 hid_debug_event(hdev, buff); picolcd_debug_out_report()
624 hid_debug_event(hdev, buff); picolcd_debug_out_report()
629 hid_debug_event(hdev, buff); picolcd_debug_out_report()
634 hid_debug_event(hdev, buff); picolcd_debug_out_report()
638 hid_debug_event(hdev, buff); picolcd_debug_out_report()
643 hid_debug_event(hdev, buff); picolcd_debug_out_report()
646 wake_up_interruptible(&hdev->debug_wait); picolcd_debug_out_report()
652 struct hid_device *hdev, struct hid_report *report, picolcd_debug_raw_event()
659 if (list_empty(&hdev->debug_list)) picolcd_debug_raw_event()
671 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
678 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
684 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
693 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
699 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
702 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
706 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
708 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
712 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
719 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
722 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
724 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
727 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
730 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
732 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
735 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
742 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
747 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
749 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
754 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
763 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
765 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
770 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
779 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
784 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
787 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
792 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
798 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
804 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
810 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
813 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
816 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
821 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
824 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
827 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
832 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
835 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
840 hid_debug_event(hdev, buff); picolcd_debug_raw_event()
843 wake_up_interruptible(&hdev->debug_wait); picolcd_debug_raw_event()
852 struct hid_device *hdev = data->hdev; picolcd_init_devfs() local
859 hdev->debug_dir, data, &picolcd_debug_reset_fops); picolcd_init_devfs()
865 hdev->debug_dir, data, &picolcd_debug_eeprom_fops); picolcd_init_devfs()
875 hdev->debug_dir, data, &picolcd_debug_flash_fops); picolcd_init_devfs()
877 hid_warn(hdev, "Unexpected FLASH access reports, please submit rdesc for review\n"); picolcd_init_devfs()
394 picolcd_debug_out_report(struct picolcd_data *data, struct hid_device *hdev, struct hid_report *report) picolcd_debug_out_report() argument
651 picolcd_debug_raw_event(struct picolcd_data *data, struct hid_device *hdev, struct hid_report *report, u8 *raw_data, int size) picolcd_debug_raw_event() argument
H A Dhid-thingm.c64 struct hid_device *hdev; member in struct:thingm_device
78 hid_dbg(tdev->hdev, "-> %d %c %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", thingm_send()
82 ret = hid_hw_raw_request(tdev->hdev, buf[0], buf, REPORT_SIZE, thingm_send()
92 ret = hid_hw_raw_request(tdev->hdev, buf[0], buf, REPORT_SIZE, thingm_recv()
97 hid_dbg(tdev->hdev, "<- %d %c %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", thingm_recv()
141 hid_err(rgb->tdev->hdev, "failed to write color\n"); thingm_work()
157 const int minor = ((struct hidraw *) rgb->tdev->hdev->hidraw)->minor; thingm_init_rgb()
168 err = led_classdev_register(&rgb->tdev->hdev->dev, &rgb->red.ldev); thingm_init_rgb()
180 err = led_classdev_register(&rgb->tdev->hdev->dev, &rgb->green.ldev); thingm_init_rgb()
192 err = led_classdev_register(&rgb->tdev->hdev->dev, &rgb->blue.ldev); thingm_init_rgb()
217 static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id) thingm_probe() argument
222 tdev = devm_kzalloc(&hdev->dev, sizeof(struct thingm_device), thingm_probe()
227 tdev->hdev = hdev; thingm_probe()
228 hid_set_drvdata(hdev, tdev); thingm_probe()
230 err = hid_parse(hdev); thingm_probe()
234 err = hid_hw_start(hdev, HID_CONNECT_HIDRAW); thingm_probe()
244 hid_dbg(hdev, "firmware version: %c.%c\n", thingm_probe()
252 hid_err(hdev, "unsupported firmware %c\n", tdev->version.major); thingm_probe()
257 tdev->rgb = devm_kzalloc(&hdev->dev, thingm_probe()
280 hid_hw_stop(hdev); thingm_probe()
285 static void thingm_remove(struct hid_device *hdev) thingm_remove() argument
287 struct thingm_device *tdev = hid_get_drvdata(hdev); thingm_remove()
290 hid_hw_stop(hdev); thingm_remove()
H A Dhid-axff.c132 static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id) ax_probe() argument
136 dev_dbg(&hdev->dev, "ACRUX HID hardware probe...\n"); ax_probe()
138 error = hid_parse(hdev); ax_probe()
140 hid_err(hdev, "parse failed\n"); ax_probe()
144 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); ax_probe()
146 hid_err(hdev, "hw start failed\n"); ax_probe()
150 error = axff_init(hdev); ax_probe()
156 hid_warn(hdev, ax_probe()
165 error = hid_hw_open(hdev); ax_probe()
167 dev_err(&hdev->dev, "hw open failed\n"); ax_probe()
168 hid_hw_stop(hdev); ax_probe()
175 static void ax_remove(struct hid_device *hdev) ax_remove() argument
177 hid_hw_close(hdev); ax_remove()
178 hid_hw_stop(hdev); ax_remove()
H A Dhid-zydacron.c30 static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, zc_report_fixup() argument
37 hid_info(hdev, zc_report_fixup()
48 static int zc_input_mapping(struct hid_device *hdev, struct hid_input *hi, zc_input_mapping() argument
53 struct zc_device *zc = hid_get_drvdata(hdev); zc_input_mapping()
112 static int zc_raw_event(struct hid_device *hdev, struct hid_report *report, zc_raw_event() argument
115 struct zc_device *zc = hid_get_drvdata(hdev); zc_raw_event()
167 static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id) zc_probe() argument
172 zc = devm_kzalloc(&hdev->dev, sizeof(*zc), GFP_KERNEL); zc_probe()
174 hid_err(hdev, "can't alloc descriptor\n"); zc_probe()
178 hid_set_drvdata(hdev, zc); zc_probe()
180 ret = hid_parse(hdev); zc_probe()
182 hid_err(hdev, "parse failed\n"); zc_probe()
186 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); zc_probe()
188 hid_err(hdev, "hw start failed\n"); zc_probe()
H A Dhid-prodikeys.c42 struct hid_device *hdev; member in struct:pk_device
106 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_channel() local
107 struct pk_device *pk = hid_get_drvdata(hdev); show_channel()
119 struct hid_device *hdev = container_of(dev, struct hid_device, dev); store_channel() local
120 struct pk_device *pk = hid_get_drvdata(hdev); store_channel()
143 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_sustain() local
144 struct pk_device *pk = hid_get_drvdata(hdev); show_sustain()
156 struct hid_device *hdev = container_of(dev, struct hid_device, dev); store_sustain() local
157 struct pk_device *pk = hid_get_drvdata(hdev); store_sustain()
182 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_octave() local
183 struct pk_device *pk = hid_get_drvdata(hdev); show_octave()
195 struct hid_device *hdev = container_of(dev, struct hid_device, dev); store_octave() local
196 struct pk_device *pk = hid_get_drvdata(hdev); store_octave()
278 struct hid_device *hdev = pm->pk->hdev; pcmidi_get_output_report() local
282 &hdev->report_enum[HID_OUTPUT_REPORT].report_list, list) { pcmidi_get_output_report()
287 hid_err(hdev, "output report is empty\n"); pcmidi_get_output_report()
291 hid_err(hdev, "field count too low\n"); pcmidi_get_output_report()
303 struct hid_device *hdev = pm->pk->hdev; pcmidi_submit_output_report() local
308 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); pcmidi_submit_output_report()
627 err = snd_card_new(&pm->pk->hdev->dev, index[dev], id[dev], pcmidi_snd_initialise()
665 err = device_create_file(&pm->pk->hdev->dev, pcmidi_snd_initialise()
673 err = device_create_file(&pm->pk->hdev->dev, pcmidi_snd_initialise()
681 err = device_create_file(&pm->pk->hdev->dev, pcmidi_snd_initialise()
707 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_octave); pcmidi_snd_initialise()
709 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_sustain); pcmidi_snd_initialise()
711 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_channel); pcmidi_snd_initialise()
725 device_remove_file(&pm->pk->hdev->dev, pcmidi_snd_terminate()
727 device_remove_file(&pm->pk->hdev->dev, pcmidi_snd_terminate()
729 device_remove_file(&pm->pk->hdev->dev, pcmidi_snd_terminate()
742 static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, pk_report_fixup() argument
748 hid_info(hdev, pk_report_fixup()
756 static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, pk_input_mapping() argument
760 struct pk_device *pk = hid_get_drvdata(hdev); pk_input_mapping()
775 static int pk_raw_event(struct hid_device *hdev, struct hid_report *report, pk_raw_event() argument
778 struct pk_device *pk = hid_get_drvdata(hdev); pk_raw_event()
796 static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) pk_probe() argument
799 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); pk_probe()
807 hid_err(hdev, "can't alloc descriptor\n"); pk_probe()
811 pk->hdev = hdev; pk_probe()
815 hid_err(hdev, "can't alloc descriptor\n"); pk_probe()
824 hid_set_drvdata(hdev, pk); pk_probe()
826 ret = hid_parse(hdev); pk_probe()
828 hid_err(hdev, "hid parse failed\n"); pk_probe()
833 hdev->quirks |= HID_QUIRK_NOGET; pk_probe()
836 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); pk_probe()
838 hid_err(hdev, "hw start failed\n"); pk_probe()
848 hid_hw_stop(hdev); pk_probe()
857 static void pk_remove(struct hid_device *hdev) pk_remove() argument
859 struct pk_device *pk = hid_get_drvdata(hdev); pk_remove()
868 hid_hw_stop(hdev); pk_remove()
H A Dhid-roccat-isku.c271 static int isku_init_specials(struct hid_device *hdev) isku_init_specials() argument
273 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); isku_init_specials()
280 hid_set_drvdata(hdev, NULL); isku_init_specials()
286 hid_err(hdev, "can't alloc device descriptor\n"); isku_init_specials()
289 hid_set_drvdata(hdev, isku); isku_init_specials()
293 hid_err(hdev, "couldn't init struct isku_device\n"); isku_init_specials()
297 retval = roccat_connect(isku_class, hdev, isku_init_specials()
300 hid_err(hdev, "couldn't init char dev\n"); isku_init_specials()
312 static void isku_remove_specials(struct hid_device *hdev) isku_remove_specials() argument
314 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); isku_remove_specials()
321 isku = hid_get_drvdata(hdev); isku_remove_specials()
327 static int isku_probe(struct hid_device *hdev, isku_probe() argument
332 retval = hid_parse(hdev); isku_probe()
334 hid_err(hdev, "parse failed\n"); isku_probe()
338 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); isku_probe()
340 hid_err(hdev, "hw start failed\n"); isku_probe()
344 retval = isku_init_specials(hdev); isku_probe()
346 hid_err(hdev, "couldn't install keyboard\n"); isku_probe()
353 hid_hw_stop(hdev); isku_probe()
358 static void isku_remove(struct hid_device *hdev) isku_remove() argument
360 isku_remove_specials(hdev); isku_remove()
361 hid_hw_stop(hdev); isku_remove()
400 static int isku_raw_event(struct hid_device *hdev, isku_raw_event() argument
403 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); isku_raw_event()
404 struct isku_device *isku = hid_get_drvdata(hdev); isku_raw_event()
H A Dhid-steelseries.c112 static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds) steelseries_srws1_set_leds() argument
114 struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list; steelseries_srws1_set_leds()
135 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); steelseries_srws1_set_leds()
228 static int steelseries_srws1_probe(struct hid_device *hdev, steelseries_srws1_probe() argument
239 hid_err(hdev, "can't alloc SRW-S1 memory\n"); steelseries_srws1_probe()
243 hid_set_drvdata(hdev, drv_data); steelseries_srws1_probe()
245 ret = hid_parse(hdev); steelseries_srws1_probe()
247 hid_err(hdev, "parse failed\n"); steelseries_srws1_probe()
251 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 16)) { steelseries_srws1_probe()
256 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); steelseries_srws1_probe()
258 hid_err(hdev, "hw start failed\n"); steelseries_srws1_probe()
267 steelseries_srws1_set_leds(hdev, 0); steelseries_srws1_probe()
269 name_sz = strlen(hdev->uniq) + 16; steelseries_srws1_probe()
274 hid_err(hdev, "can't allocate memory for LED ALL\n"); steelseries_srws1_probe()
279 snprintf(name, name_sz, "SRWS1::%s::RPMALL", hdev->uniq); steelseries_srws1_probe()
287 ret = led_classdev_register(&hdev->dev, led); steelseries_srws1_probe()
295 hid_err(hdev, "can't allocate memory for LED %d\n", i); steelseries_srws1_probe()
300 snprintf(name, name_sz, "SRWS1::%s::RPM%d", hdev->uniq, i+1); steelseries_srws1_probe()
308 ret = led_classdev_register(&hdev->dev, led); steelseries_srws1_probe()
311 hid_err(hdev, "failed to register LED %d. Aborting.\n", i); steelseries_srws1_probe()
332 static void steelseries_srws1_remove(struct hid_device *hdev) steelseries_srws1_remove() argument
337 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hdev); steelseries_srws1_remove()
352 hid_hw_stop(hdev); steelseries_srws1_remove()
358 static __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev, __u8 *rdesc, steelseries_srws1_report_fixup() argument
363 hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n"); steelseries_srws1_report_fixup()
H A Dhid-plantronics.c20 static int plantronics_input_mapping(struct hid_device *hdev, plantronics_input_mapping() argument
28 hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n", plantronics_input_mapping()
33 hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n", plantronics_input_mapping()
H A Dhid-roccat-arvo.c291 static int arvo_init_specials(struct hid_device *hdev) arvo_init_specials() argument
293 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); arvo_init_specials()
300 hid_set_drvdata(hdev, NULL); arvo_init_specials()
306 hid_err(hdev, "can't alloc device descriptor\n"); arvo_init_specials()
309 hid_set_drvdata(hdev, arvo); arvo_init_specials()
313 hid_err(hdev, "couldn't init struct arvo_device\n"); arvo_init_specials()
317 retval = roccat_connect(arvo_class, hdev, arvo_init_specials()
320 hid_err(hdev, "couldn't init char dev\n"); arvo_init_specials()
332 static void arvo_remove_specials(struct hid_device *hdev) arvo_remove_specials() argument
334 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); arvo_remove_specials()
341 arvo = hid_get_drvdata(hdev); arvo_remove_specials()
347 static int arvo_probe(struct hid_device *hdev, arvo_probe() argument
352 retval = hid_parse(hdev); arvo_probe()
354 hid_err(hdev, "parse failed\n"); arvo_probe()
358 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); arvo_probe()
360 hid_err(hdev, "hw start failed\n"); arvo_probe()
364 retval = arvo_init_specials(hdev); arvo_probe()
366 hid_err(hdev, "couldn't install keyboard\n"); arvo_probe()
373 hid_hw_stop(hdev); arvo_probe()
378 static void arvo_remove(struct hid_device *hdev) arvo_remove() argument
380 arvo_remove_specials(hdev); arvo_remove()
381 hid_hw_stop(hdev); arvo_remove()
405 static int arvo_raw_event(struct hid_device *hdev, arvo_raw_event() argument
408 struct arvo_device *arvo = hid_get_drvdata(hdev); arvo_raw_event()
H A Dhid-core.c1515 static bool hid_match_one_id(struct hid_device *hdev, hid_match_one_id() argument
1518 return (id->bus == HID_BUS_ANY || id->bus == hdev->bus) && hid_match_one_id()
1519 (id->group == HID_GROUP_ANY || id->group == hdev->group) && hid_match_one_id()
1520 (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && hid_match_one_id()
1521 (id->product == HID_ANY_ID || id->product == hdev->product); hid_match_one_id()
1524 const struct hid_device_id *hid_match_id(struct hid_device *hdev, hid_match_id() argument
1528 if (hid_match_one_id(hdev, id)) hid_match_id()
1540 static bool hid_hiddev(struct hid_device *hdev) hid_hiddev() argument
1542 return !!hid_match_id(hdev, hid_hiddev_list); hid_hiddev()
1552 struct hid_device *hdev = container_of(dev, struct hid_device, dev); read_report_descriptor() local
1554 if (off >= hdev->rsize) read_report_descriptor()
1557 if (off + count > hdev->rsize) read_report_descriptor()
1558 count = hdev->rsize - off; read_report_descriptor()
1560 memcpy(buf, hdev->rdesc + off, count); read_report_descriptor()
1569 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_country() local
1571 return sprintf(buf, "%02x\n", hdev->country & 0xff); show_country()
1585 int hid_connect(struct hid_device *hdev, unsigned int connect_mask) hid_connect() argument
1597 if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) hid_connect()
1599 if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) hid_connect()
1601 if (hdev->bus != BUS_USB) hid_connect()
1603 if (hid_hiddev(hdev)) hid_connect()
1606 if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, hid_connect()
1608 hdev->claimed |= HID_CLAIMED_INPUT; hid_connect()
1610 if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && hid_connect()
1611 !hdev->hiddev_connect(hdev, hid_connect()
1613 hdev->claimed |= HID_CLAIMED_HIDDEV; hid_connect()
1614 if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) hid_connect()
1615 hdev->claimed |= HID_CLAIMED_HIDRAW; hid_connect()
1618 hdev->claimed |= HID_CLAIMED_DRIVER; hid_connect()
1622 if (!hdev->claimed && !hdev->driver->raw_event) { hid_connect()
1623 hid_err(hdev, "device has no listeners, quitting\n"); hid_connect()
1627 if ((hdev->claimed & HID_CLAIMED_INPUT) && hid_connect()
1628 (connect_mask & HID_CONNECT_FF) && hdev->ff_init) hid_connect()
1629 hdev->ff_init(hdev); hid_connect()
1632 if (hdev->claimed & HID_CLAIMED_INPUT) hid_connect()
1634 if (hdev->claimed & HID_CLAIMED_HIDDEV) hid_connect()
1636 hdev->minor); hid_connect()
1637 if (hdev->claimed & HID_CLAIMED_HIDRAW) hid_connect()
1639 ((struct hidraw *)hdev->hidraw)->minor); hid_connect()
1642 for (i = 0; i < hdev->maxcollection; i++) { hid_connect()
1643 struct hid_collection *col = &hdev->collection[i]; hid_connect()
1652 switch (hdev->bus) { hid_connect()
1663 ret = device_create_file(&hdev->dev, &dev_attr_country); hid_connect()
1665 hid_warn(hdev, hid_connect()
1668 ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc); hid_connect()
1670 hid_warn(hdev, hid_connect()
1673 hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", hid_connect()
1674 buf, bus, hdev->version >> 8, hdev->version & 0xff, hid_connect()
1675 type, hdev->name, hdev->phys); hid_connect()
1681 void hid_disconnect(struct hid_device *hdev) hid_disconnect() argument
1683 device_remove_file(&hdev->dev, &dev_attr_country); hid_disconnect()
1684 device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc); hid_disconnect()
1685 if (hdev->claimed & HID_CLAIMED_INPUT) hid_disconnect()
1686 hidinput_disconnect(hdev); hid_disconnect()
1687 if (hdev->claimed & HID_CLAIMED_HIDDEV) hid_disconnect()
1688 hdev->hiddev_disconnect(hdev); hid_disconnect()
1689 if (hdev->claimed & HID_CLAIMED_HIDRAW) hid_disconnect()
1690 hidraw_disconnect(hdev); hid_disconnect()
1691 hdev->claimed = 0; hid_disconnect()
2080 static const struct hid_device_id *hid_match_device(struct hid_device *hdev, hid_match_device() argument
2087 if (hid_match_one_id(hdev, &dynid->id)) { hid_match_device()
2094 return hid_match_id(hdev, hdrv->id_table); hid_match_device()
2100 struct hid_device *hdev = container_of(dev, struct hid_device, dev); hid_bus_match() local
2102 return hid_match_device(hdev, hdrv) != NULL; hid_bus_match()
2109 struct hid_device *hdev = container_of(dev, struct hid_device, dev); hid_device_probe() local
2113 if (down_interruptible(&hdev->driver_lock)) hid_device_probe()
2115 if (down_interruptible(&hdev->driver_input_lock)) { hid_device_probe()
2119 hdev->io_started = false; hid_device_probe()
2121 if (!hdev->driver) { hid_device_probe()
2122 id = hid_match_device(hdev, hdrv); hid_device_probe()
2128 hdev->driver = hdrv; hid_device_probe()
2130 ret = hdrv->probe(hdev, id); hid_device_probe()
2132 ret = hid_open_report(hdev); hid_device_probe()
2134 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); hid_device_probe()
2137 hid_close_report(hdev); hid_device_probe()
2138 hdev->driver = NULL; hid_device_probe()
2142 if (!hdev->io_started) hid_device_probe()
2143 up(&hdev->driver_input_lock); hid_device_probe()
2145 up(&hdev->driver_lock); hid_device_probe()
2151 struct hid_device *hdev = container_of(dev, struct hid_device, dev); hid_device_remove() local
2155 if (down_interruptible(&hdev->driver_lock)) hid_device_remove()
2157 if (down_interruptible(&hdev->driver_input_lock)) { hid_device_remove()
2161 hdev->io_started = false; hid_device_remove()
2163 hdrv = hdev->driver; hid_device_remove()
2166 hdrv->remove(hdev); hid_device_remove()
2168 hid_hw_stop(hdev); hid_device_remove()
2169 hid_close_report(hdev); hid_device_remove()
2170 hdev->driver = NULL; hid_device_remove()
2173 if (!hdev->io_started) hid_device_remove()
2174 up(&hdev->driver_input_lock); hid_device_remove()
2176 up(&hdev->driver_lock); hid_device_remove()
2183 struct hid_device *hdev = container_of(dev, struct hid_device, dev); modalias_show() local
2187 hdev->bus, hdev->group, hdev->vendor, hdev->product); modalias_show()
2201 struct hid_device *hdev = container_of(dev, struct hid_device, dev); hid_uevent() local
2204 hdev->bus, hdev->vendor, hdev->product)) hid_uevent()
2207 if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) hid_uevent()
2210 if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) hid_uevent()
2213 if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) hid_uevent()
2217 hdev->bus, hdev->group, hdev->vendor, hdev->product)) hid_uevent()
2479 bool hid_ignore(struct hid_device *hdev) hid_ignore() argument
2481 if (hdev->quirks & HID_QUIRK_NO_IGNORE) hid_ignore()
2483 if (hdev->quirks & HID_QUIRK_IGNORE) hid_ignore()
2486 switch (hdev->vendor) { hid_ignore()
2489 if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && hid_ignore()
2490 hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) hid_ignore()
2494 if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && hid_ignore()
2495 hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) hid_ignore()
2504 if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB && hid_ignore()
2505 !strcmp(hdev->name, "HOLTEK B-LINK USB Audio ")) hid_ignore()
2509 if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && hid_ignore()
2510 hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) hid_ignore()
2514 if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && hid_ignore()
2515 hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) hid_ignore()
2519 if (hdev->product == USB_DEVICE_ID_JESS_YUREX && hid_ignore()
2520 hdev->type == HID_TYPE_USBNONE) hid_ignore()
2525 if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && hid_ignore()
2526 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8055_LAST) || hid_ignore()
2527 (hdev->product >= USB_DEVICE_ID_VELLEMAN_K8061_FIRST && hid_ignore()
2528 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) hid_ignore()
2538 if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && hid_ignore()
2539 hdev->bus == BUS_USB && hid_ignore()
2540 strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) hid_ignore()
2545 if (hdev->type == HID_TYPE_USBMOUSE && hid_ignore()
2546 hid_match_id(hdev, hid_mouse_ignore_list)) hid_ignore()
2549 return !!hid_match_id(hdev, hid_ignore_list); hid_ignore()
2553 int hid_add_device(struct hid_device *hdev) hid_add_device() argument
2558 if (WARN_ON(hdev->status & HID_STAT_ADDED)) hid_add_device()
2563 if (hid_ignore(hdev)) hid_add_device()
2569 if (!hdev->ll_driver->raw_request) { hid_add_device()
2570 hid_err(hdev, "transport driver missing .raw_request()\n"); hid_add_device()
2578 ret = hdev->ll_driver->parse(hdev); hid_add_device()
2581 if (!hdev->dev_rdesc) hid_add_device()
2588 hdev->group = HID_GROUP_GENERIC; hid_add_device()
2589 } else if (!hdev->group && hid_add_device()
2590 !hid_match_id(hdev, hid_have_special_driver)) { hid_add_device()
2591 ret = hid_scan_report(hdev); hid_add_device()
2593 hid_warn(hdev, "bad device descriptor (%d)\n", ret); hid_add_device()
2598 dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, hid_add_device()
2599 hdev->vendor, hdev->product, atomic_inc_return(&id)); hid_add_device()
2601 hid_debug_register(hdev, dev_name(&hdev->dev)); hid_add_device()
2602 ret = device_add(&hdev->dev); hid_add_device()
2604 hdev->status |= HID_STAT_ADDED; hid_add_device()
2606 hid_debug_unregister(hdev); hid_add_device()
2623 struct hid_device *hdev; hid_allocate_device() local
2626 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); hid_allocate_device()
2627 if (hdev == NULL) hid_allocate_device()
2630 device_initialize(&hdev->dev); hid_allocate_device()
2631 hdev->dev.release = hid_device_release; hid_allocate_device()
2632 hdev->dev.bus = &hid_bus_type; hid_allocate_device()
2634 hid_close_report(hdev); hid_allocate_device()
2636 init_waitqueue_head(&hdev->debug_wait); hid_allocate_device()
2637 INIT_LIST_HEAD(&hdev->debug_list); hid_allocate_device()
2638 spin_lock_init(&hdev->debug_list_lock); hid_allocate_device()
2639 sema_init(&hdev->driver_lock, 1); hid_allocate_device()
2640 sema_init(&hdev->driver_input_lock, 1); hid_allocate_device()
2642 return hdev; hid_allocate_device()
2646 static void hid_remove_device(struct hid_device *hdev) hid_remove_device() argument
2648 if (hdev->status & HID_STAT_ADDED) { hid_remove_device()
2649 device_del(&hdev->dev); hid_remove_device()
2650 hid_debug_unregister(hdev); hid_remove_device()
2651 hdev->status &= ~HID_STAT_ADDED; hid_remove_device()
2653 kfree(hdev->dev_rdesc); hid_remove_device()
2654 hdev->dev_rdesc = NULL; hid_remove_device()
2655 hdev->dev_rsize = 0; hid_remove_device()
2661 * @hdev: hid device
2666 void hid_destroy_device(struct hid_device *hdev) hid_destroy_device() argument
2668 hid_remove_device(hdev); hid_destroy_device()
2669 put_device(&hdev->dev); hid_destroy_device()
H A Dhid-emsff.c112 static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id) ems_probe() argument
116 ret = hid_parse(hdev); ems_probe()
118 hid_err(hdev, "parse failed\n"); ems_probe()
122 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); ems_probe()
124 hid_err(hdev, "hw start failed\n"); ems_probe()
128 ret = emsff_init(hdev); ems_probe()
130 dev_err(&hdev->dev, "force feedback init failed\n"); ems_probe()
131 hid_hw_stop(hdev); ems_probe()
H A Dhid-elo.c40 static void elo_input_configured(struct hid_device *hdev, elo_input_configured() argument
73 static int elo_raw_event(struct hid_device *hdev, struct hid_report *report, elo_raw_event() argument
78 if (!(hdev->claimed & HID_CLAIMED_INPUT) || list_empty(&hdev->inputs)) elo_raw_event()
81 hidinput = list_first_entry(&hdev->inputs, struct hid_input, list); elo_raw_event()
92 hid_info(hdev, "unknown report type %d\n", report->id); elo_raw_event()
220 static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) elo_probe() argument
230 priv->usbdev = interface_to_usbdev(to_usb_interface(hdev->dev.parent)); elo_probe()
232 hid_set_drvdata(hdev, priv); elo_probe()
234 ret = hid_parse(hdev); elo_probe()
236 hid_err(hdev, "parse failed\n"); elo_probe()
240 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); elo_probe()
242 hid_err(hdev, "hw start failed\n"); elo_probe()
247 hid_info(hdev, "broken firmware found, installing workaround\n"); elo_probe()
257 static void elo_remove(struct hid_device *hdev) elo_remove() argument
259 struct elo_priv *priv = hid_get_drvdata(hdev); elo_remove()
261 hid_hw_stop(hdev); elo_remove()
H A Dhid-logitech-hidpp.c133 static int __hidpp_send_report(struct hid_device *hdev, __hidpp_send_report() argument
155 ret = hid_hw_raw_request(hdev, hidpp_report->report_id, __hidpp_send_report()
704 static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, wtp_input_mapping() argument
825 static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) wtp_raw_event() argument
827 struct hidpp_device *hidpp = hid_get_drvdata(hdev); wtp_raw_event()
838 hid_err(hdev, "Received HID report of bad size (%d)", wtp_raw_event()
897 static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) wtp_allocate() argument
899 struct hidpp_device *hidpp = hid_get_drvdata(hdev); wtp_allocate()
902 wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), wtp_allocate()
912 static int wtp_connect(struct hid_device *hdev, bool connected) wtp_connect() argument
914 struct hidpp_device *hidpp = hid_get_drvdata(hdev); wtp_connect()
924 hid_err(hdev, "Can not get wtp config: %d\n", ret); wtp_connect()
937 static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, hidpp_input_mapping() argument
941 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_input_mapping()
944 return wtp_input_mapping(hdev, hi, field, usage, bit, max); hidpp_input_mapping()
956 static void hidpp_input_configured(struct hid_device *hdev, hidpp_input_configured() argument
959 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_input_configured()
1008 static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, hidpp_raw_event() argument
1011 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_raw_event()
1018 hid_err(hdev, "received hid++ report of bad size (%d)", hidpp_raw_event()
1026 hid_err(hdev, "received hid++ report of bad size (%d)", hidpp_raw_event()
1040 return wtp_raw_event(hdev, data, size); hidpp_raw_event()
1045 static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) hidpp_overwrite_name() argument
1047 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_overwrite_name()
1061 hid_err(hdev, "unable to retrieve the name of the device"); hidpp_overwrite_name()
1063 snprintf(hdev->name, sizeof(hdev->name), "%s", name); hidpp_overwrite_name()
1082 static struct input_dev *hidpp_allocate_input(struct hid_device *hdev) hidpp_allocate_input() argument
1084 struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); hidpp_allocate_input()
1085 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_allocate_input()
1090 input_set_drvdata(input_dev, hdev); hidpp_allocate_input()
1095 input_dev->phys = hdev->phys; hidpp_allocate_input()
1096 input_dev->uniq = hdev->uniq; hidpp_allocate_input()
1097 input_dev->id.bustype = hdev->bus; hidpp_allocate_input()
1098 input_dev->id.vendor = hdev->vendor; hidpp_allocate_input()
1099 input_dev->id.product = hdev->product; hidpp_allocate_input()
1100 input_dev->id.version = hdev->version; hidpp_allocate_input()
1101 input_dev->dev.parent = &hdev->dev; hidpp_allocate_input()
1108 struct hid_device *hdev = hidpp->hid_dev; hidpp_connect_event() local
1115 ret = wtp_connect(hdev, connected); hidpp_connect_event()
1126 hid_err(hdev, "Can not get the protocol version.\n"); hidpp_connect_event()
1133 hid_info(hdev, "HID++ %u.%u device connected.\n", hidpp_connect_event()
1136 if (!hidpp->name || hidpp->name == hdev->name) { hidpp_connect_event()
1139 hid_err(hdev, hidpp_connect_event()
1144 devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); hidpp_connect_event()
1152 input = hidpp_allocate_input(hdev); hidpp_connect_event()
1154 hid_err(hdev, "cannot allocate new input device: %d\n", ret); hidpp_connect_event()
1167 static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) hidpp_probe() argument
1174 hidpp = devm_kzalloc(&hdev->dev, sizeof(struct hidpp_device), hidpp_probe()
1179 hidpp->hid_dev = hdev; hidpp_probe()
1180 hidpp->name = hdev->name; hidpp_probe()
1181 hid_set_drvdata(hdev, hidpp); hidpp_probe()
1191 ret = wtp_allocate(hdev, id); hidpp_probe()
1200 ret = hid_parse(hdev); hidpp_probe()
1202 hid_err(hdev, "%s:parse failed\n", __func__); hidpp_probe()
1207 hid_device_io_start(hdev); hidpp_probe()
1213 hid_err(hdev, "Device not connected"); hidpp_probe()
1214 hid_device_io_stop(hdev); hidpp_probe()
1218 hid_info(hdev, "HID++ %u.%u device connected.\n", hidpp_probe()
1222 hidpp_overwrite_name(hdev, id->group == HID_GROUP_LOGITECH_DJ_DEVICE); hidpp_probe()
1232 hid_device_io_stop(hdev); hidpp_probe()
1237 ret = hid_hw_start(hdev, connect_mask); hidpp_probe()
1239 hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); hidpp_probe()
1245 hid_device_io_start(hdev); hidpp_probe()
1257 hid_set_drvdata(hdev, NULL); hidpp_probe()
1261 static void hidpp_remove(struct hid_device *hdev) hidpp_remove() argument
1263 struct hidpp_device *hidpp = hid_get_drvdata(hdev); hidpp_remove()
1267 hid_hw_stop(hdev); hidpp_remove()
H A Dhid-microsoft.c33 static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, ms_report_fixup() argument
36 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); ms_report_fixup()
44 hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); ms_report_fixup()
141 static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi, ms_input_mapping() argument
145 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); ms_input_mapping()
160 static int ms_input_mapped(struct hid_device *hdev, struct hid_input *hi, ms_input_mapped() argument
164 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); ms_input_mapped()
172 static int ms_event(struct hid_device *hdev, struct hid_field *field, ms_event() argument
175 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); ms_event()
178 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || ms_event()
230 static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id) ms_probe() argument
235 hid_set_drvdata(hdev, (void *)quirks); ms_probe()
238 hdev->quirks |= HID_QUIRK_NOGET; ms_probe()
240 ret = hid_parse(hdev); ms_probe()
242 hid_err(hdev, "parse failed\n"); ms_probe()
246 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ? ms_probe()
249 hid_err(hdev, "hw start failed\n"); ms_probe()
H A Dhid-magicmouse.c280 static int magicmouse_raw_event(struct hid_device *hdev, magicmouse_raw_event() argument
283 struct magicmouse_sc *msc = hid_get_drvdata(hdev); magicmouse_raw_event()
294 hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n", magicmouse_raw_event()
316 hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n", magicmouse_raw_event()
342 magicmouse_raw_event(hdev, report, data + 2, data[1]); magicmouse_raw_event()
343 magicmouse_raw_event(hdev, report, data + 2 + data[1], magicmouse_raw_event()
363 static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) magicmouse_setup_input() argument
457 static int magicmouse_input_mapping(struct hid_device *hdev, magicmouse_input_mapping() argument
461 struct magicmouse_sc *msc = hid_get_drvdata(hdev); magicmouse_input_mapping()
474 static void magicmouse_input_configured(struct hid_device *hdev, magicmouse_input_configured() argument
478 struct magicmouse_sc *msc = hid_get_drvdata(hdev); magicmouse_input_configured()
480 int ret = magicmouse_setup_input(msc->input, hdev); magicmouse_input_configured()
482 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); magicmouse_input_configured()
489 static int magicmouse_probe(struct hid_device *hdev, magicmouse_probe() argument
497 msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); magicmouse_probe()
499 hid_err(hdev, "can't alloc magicmouse descriptor\n"); magicmouse_probe()
506 hid_set_drvdata(hdev, msc); magicmouse_probe()
508 ret = hid_parse(hdev); magicmouse_probe()
510 hid_err(hdev, "magicmouse hid parse failed\n"); magicmouse_probe()
514 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); magicmouse_probe()
516 hid_err(hdev, "magicmouse hw start failed\n"); magicmouse_probe()
521 hid_err(hdev, "magicmouse input not registered\n"); magicmouse_probe()
527 report = hid_register_report(hdev, HID_INPUT_REPORT, magicmouse_probe()
530 report = hid_register_report(hdev, HID_INPUT_REPORT, magicmouse_probe()
532 report = hid_register_report(hdev, HID_INPUT_REPORT, magicmouse_probe()
537 hid_err(hdev, "unable to register touch report\n"); magicmouse_probe()
551 ret = hid_hw_raw_request(hdev, feature[0], feature, sizeof(feature), magicmouse_probe()
554 hid_err(hdev, "unable to request touch data (%d)\n", ret); magicmouse_probe()
560 hid_hw_stop(hdev); magicmouse_probe()
H A Dhid-logitech-dj.c112 struct hid_device *hdev; member in struct:dj_receiver_dev
122 struct hid_device *hdev; member in struct:dj_device
358 hid_destroy_device(dj_dev->hdev); logi_dj_recv_destroy_djhid_device()
361 dev_err(&djrcv_dev->hdev->dev, "%s: can't destroy a NULL device\n", logi_dj_recv_destroy_djhid_device()
370 struct hid_device *djrcv_hdev = djrcv_dev->hdev; logi_dj_recv_add_djhid_device()
430 dj_dev->hdev = dj_hiddev; logi_dj_recv_add_djhid_device()
470 dev_err(&djrcv_dev->hdev->dev, "%s: workitem triggered without " delayedwork_callback()
508 dev_err(&djrcv_dev->hdev->dev, delayedwork_callback()
544 if (hid_input_report(djdev->hdev, logi_dj_recv_forward_null_report()
569 if (hid_input_report(dj_device->hdev, logi_dj_recv_forward_report()
580 if (hid_input_report(dj_dev->hdev, HID_INPUT_REPORT, data, size, 1)) logi_dj_recv_forward_hidpp()
587 struct hid_device *hdev = djrcv_dev->hdev; logi_dj_recv_send_report() local
593 output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; logi_dj_recv_send_report()
597 dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__); logi_dj_recv_send_report()
604 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); logi_dj_recv_send_report()
633 struct hid_device *hdev = djrcv_dev->hdev; logi_dj_recv_switch_to_dj_mode() local
674 hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf, logi_dj_recv_switch_to_dj_mode()
720 return hid_hw_raw_request(djrcv_dev->hdev, reportnum, buf, logi_dj_ll_raw_request()
738 ret = hid_hw_raw_request(djrcv_dev->hdev, out_buf[0], out_buf, logi_dj_ll_raw_request()
760 djdev->hdev->version = 0x0111; logi_dj_ll_parse()
761 djdev->hdev->country = 0x00; logi_dj_ll_parse()
831 static int logi_dj_dj_event(struct hid_device *hdev, logi_dj_dj_event() argument
835 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); logi_dj_dj_event()
865 dev_err(&hdev->dev, "%s: invalid device index:%d\n", logi_dj_dj_event()
901 static int logi_dj_hidpp_event(struct hid_device *hdev, logi_dj_hidpp_event() argument
905 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); logi_dj_hidpp_event()
937 dev_err(&hdev->dev, "%s: invalid device index:%d\n", logi_dj_hidpp_event()
957 static int logi_dj_raw_event(struct hid_device *hdev, logi_dj_raw_event() argument
966 dev_err(&hdev->dev, "DJ report of bad size (%d)", size); logi_dj_raw_event()
969 return logi_dj_dj_event(hdev, report, data, size); logi_dj_raw_event()
972 dev_err(&hdev->dev, logi_dj_raw_event()
976 return logi_dj_hidpp_event(hdev, report, data, size); logi_dj_raw_event()
979 dev_err(&hdev->dev, logi_dj_raw_event()
983 return logi_dj_hidpp_event(hdev, report, data, size); logi_dj_raw_event()
989 static int logi_dj_probe(struct hid_device *hdev, logi_dj_probe() argument
992 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); logi_dj_probe()
1012 dev_err(&hdev->dev, logi_dj_probe()
1016 djrcv_dev->hdev = hdev; logi_dj_probe()
1022 dev_err(&hdev->dev, logi_dj_probe()
1027 hid_set_drvdata(hdev, djrcv_dev); logi_dj_probe()
1033 retval = hid_parse(hdev); logi_dj_probe()
1035 dev_err(&hdev->dev, logi_dj_probe()
1040 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, REPORT_ID_DJ_SHORT, logi_dj_probe()
1048 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); logi_dj_probe()
1050 dev_err(&hdev->dev, logi_dj_probe()
1057 dev_err(&hdev->dev, logi_dj_probe()
1064 retval = hid_hw_open(hdev); logi_dj_probe()
1066 dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n", logi_dj_probe()
1072 hid_device_io_start(hdev); logi_dj_probe()
1076 dev_err(&hdev->dev, "%s:logi_dj_recv_query_paired_devices " logi_dj_probe()
1084 hid_hw_close(hdev); logi_dj_probe()
1088 hid_hw_stop(hdev); logi_dj_probe()
1094 hid_set_drvdata(hdev, NULL); logi_dj_probe()
1100 static int logi_dj_reset_resume(struct hid_device *hdev) logi_dj_reset_resume() argument
1103 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); logi_dj_reset_resume()
1107 dev_err(&hdev->dev, logi_dj_reset_resume()
1116 static void logi_dj_remove(struct hid_device *hdev) logi_dj_remove() argument
1118 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); logi_dj_remove()
1126 hid_hw_close(hdev); logi_dj_remove()
1127 hid_hw_stop(hdev); logi_dj_remove()
1137 hid_destroy_device(dj_dev->hdev); logi_dj_remove()
1145 hid_set_drvdata(hdev, NULL); logi_dj_remove()
H A Dhid-ntrig.c113 static inline int ntrig_get_mode(struct hid_device *hdev) ntrig_get_mode() argument
115 struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT]. ntrig_get_mode()
122 hid_hw_request(hdev, report, HID_REQ_GET_REPORT); ntrig_get_mode()
123 hid_hw_wait(hdev); ntrig_get_mode()
127 static inline void ntrig_set_mode(struct hid_device *hdev, const int mode) ntrig_set_mode() argument
135 report = hdev->report_enum[HID_FEATURE_REPORT]. ntrig_set_mode()
141 hid_hw_request(hdev, report, HID_REQ_GET_REPORT); ntrig_set_mode()
144 static void ntrig_report_version(struct hid_device *hdev) ntrig_report_version() argument
148 struct usb_device *usb_dev = hid_to_usb_dev(hdev); ntrig_report_version()
164 hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n", ntrig_report_version()
176 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_phys_width() local
177 struct ntrig_data *nd = hid_get_drvdata(hdev); show_phys_width()
188 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_phys_height() local
189 struct ntrig_data *nd = hid_get_drvdata(hdev); show_phys_height()
200 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_log_width() local
201 struct ntrig_data *nd = hid_get_drvdata(hdev); show_log_width()
212 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_log_height() local
213 struct ntrig_data *nd = hid_get_drvdata(hdev); show_log_height()
224 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_min_width() local
225 struct ntrig_data *nd = hid_get_drvdata(hdev); show_min_width()
236 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_min_width() local
237 struct ntrig_data *nd = hid_get_drvdata(hdev); set_min_width()
259 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_min_height() local
260 struct ntrig_data *nd = hid_get_drvdata(hdev); show_min_height()
271 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_min_height() local
272 struct ntrig_data *nd = hid_get_drvdata(hdev); set_min_height()
295 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_activate_slack() local
296 struct ntrig_data *nd = hid_get_drvdata(hdev); show_activate_slack()
305 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_activate_slack() local
306 struct ntrig_data *nd = hid_get_drvdata(hdev); set_activate_slack()
328 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_activation_width() local
329 struct ntrig_data *nd = hid_get_drvdata(hdev); show_activation_width()
340 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_activation_width() local
341 struct ntrig_data *nd = hid_get_drvdata(hdev); set_activation_width()
364 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_activation_height() local
365 struct ntrig_data *nd = hid_get_drvdata(hdev); show_activation_height()
376 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_activation_height() local
377 struct ntrig_data *nd = hid_get_drvdata(hdev); set_activation_height()
400 struct hid_device *hdev = container_of(dev, struct hid_device, dev); show_deactivate_slack() local
401 struct ntrig_data *nd = hid_get_drvdata(hdev); show_deactivate_slack()
410 struct hid_device *hdev = container_of(dev, struct hid_device, dev); set_deactivate_slack() local
411 struct ntrig_data *nd = hid_get_drvdata(hdev); set_deactivate_slack()
458 static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, ntrig_input_mapping() argument
462 struct ntrig_data *nd = hid_get_drvdata(hdev); ntrig_input_mapping()
549 static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, ntrig_input_mapped() argument
895 static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) ntrig_probe() argument
902 hdev->quirks |= HID_QUIRK_MULTI_INPUT ntrig_probe()
907 hid_err(hdev, "cannot allocate N-Trig data\n"); ntrig_probe()
922 hid_set_drvdata(hdev, nd); ntrig_probe()
924 ret = hid_parse(hdev); ntrig_probe()
926 hid_err(hdev, "parse failed\n"); ntrig_probe()
930 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); ntrig_probe()
932 hid_err(hdev, "hw start failed\n"); ntrig_probe()
937 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; ntrig_probe()
941 hid_hw_wait(hdev); ntrig_probe()
942 hid_hw_request(hdev, report, HID_REQ_GET_REPORT); ntrig_probe()
948 if (ntrig_get_mode(hdev) >= 4) ntrig_probe()
949 ntrig_set_mode(hdev, 3); ntrig_probe()
952 ntrig_report_version(hdev); ntrig_probe()
954 ret = sysfs_create_group(&hdev->dev.kobj, ntrig_probe()
963 static void ntrig_remove(struct hid_device *hdev) ntrig_remove() argument
965 sysfs_remove_group(&hdev->dev.kobj, ntrig_remove()
967 hid_hw_stop(hdev); ntrig_remove()
968 kfree(hid_get_drvdata(hdev)); ntrig_remove()
H A Dhid-betopff.c118 static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id) betop_probe() argument
123 hdev->quirks |= HID_QUIRK_MULTI_INPUT; betop_probe()
125 ret = hid_parse(hdev); betop_probe()
127 hid_err(hdev, "parse failed\n"); betop_probe()
131 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); betop_probe()
133 hid_err(hdev, "hw start failed\n"); betop_probe()
137 betopff_init(hdev); betop_probe()
H A Dhid-holtek-mouse.c35 static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, holtek_mouse_report_fixup() argument
38 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); holtek_mouse_report_fixup()
43 switch (hdev->product) { holtek_mouse_report_fixup()
49 hid_info(hdev, "Fixing up report descriptor\n"); holtek_mouse_report_fixup()
58 hid_info(hdev, "Fixing up report descriptor\n"); holtek_mouse_report_fixup()
H A Dhid-roccat-pyra.c401 static int pyra_init_specials(struct hid_device *hdev) pyra_init_specials() argument
403 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); pyra_init_specials()
413 hid_err(hdev, "can't alloc device descriptor\n"); pyra_init_specials()
416 hid_set_drvdata(hdev, pyra); pyra_init_specials()
420 hid_err(hdev, "couldn't init struct pyra_device\n"); pyra_init_specials()
424 retval = roccat_connect(pyra_class, hdev, pyra_init_specials()
427 hid_err(hdev, "couldn't init char dev\n"); pyra_init_specials()
433 hid_set_drvdata(hdev, NULL); pyra_init_specials()
442 static void pyra_remove_specials(struct hid_device *hdev) pyra_remove_specials() argument
444 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); pyra_remove_specials()
449 pyra = hid_get_drvdata(hdev); pyra_remove_specials()
452 kfree(hid_get_drvdata(hdev)); pyra_remove_specials()
456 static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id) pyra_probe() argument
460 retval = hid_parse(hdev); pyra_probe()
462 hid_err(hdev, "parse failed\n"); pyra_probe()
466 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); pyra_probe()
468 hid_err(hdev, "hw start failed\n"); pyra_probe()
472 retval = pyra_init_specials(hdev); pyra_probe()
474 hid_err(hdev, "couldn't install mouse\n"); pyra_probe()
480 hid_hw_stop(hdev); pyra_probe()
485 static void pyra_remove(struct hid_device *hdev) pyra_remove() argument
487 pyra_remove_specials(hdev); pyra_remove()
488 hid_hw_stop(hdev); pyra_remove()
549 static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, pyra_raw_event() argument
552 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); pyra_raw_event()
553 struct pyra_device *pyra = hid_get_drvdata(hdev); pyra_raw_event()
H A Dhid-multitouch.c275 struct hid_device *hdev = container_of(dev, struct hid_device, dev); mt_show_quirks() local
276 struct mt_device *td = hid_get_drvdata(hdev); mt_show_quirks()
285 struct hid_device *hdev = container_of(dev, struct hid_device, dev); mt_set_quirks() local
286 struct mt_device *td = hid_get_drvdata(hdev); mt_set_quirks()
312 static void mt_feature_mapping(struct hid_device *hdev, mt_feature_mapping() argument
315 struct mt_device *td = hid_get_drvdata(hdev); mt_feature_mapping()
321 dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n"); mt_feature_mapping()
335 dev_info(&hdev->dev, mt_feature_mapping()
353 dev_err(&hdev->dev, "HID_DG_BUTTONTYPE out of range\n"); mt_feature_mapping()
385 static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, mt_touch_input_mapping() argument
389 struct mt_device *td = hid_get_drvdata(hdev); mt_touch_input_mapping()
534 static int mt_touch_input_mapped(struct hid_device *hdev, struct hid_input *hi, mt_touch_input_mapped() argument
739 static void mt_touch_input_configured(struct hid_device *hdev, mt_touch_input_configured() argument
742 struct mt_device *td = hid_get_drvdata(hdev); mt_touch_input_configured()
771 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, mt_input_mapping() argument
775 struct mt_device *td = hid_get_drvdata(hdev); mt_input_mapping()
798 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max); mt_input_mapping()
804 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, mt_input_mapped() argument
817 return mt_touch_input_mapped(hdev, hi, field, usage, bit, max); mt_input_mapped()
849 static void mt_set_input_mode(struct hid_device *hdev) mt_set_input_mode() argument
851 struct mt_device *td = hid_get_drvdata(hdev); mt_set_input_mode()
861 re = &(hdev->report_enum[HID_FEATURE_REPORT]); mt_set_input_mode()
868 hid_err(hdev, "failed to allocate buffer for report\n"); mt_set_input_mode()
871 hid_hw_raw_request(hdev, r->id, buf, report_len, mt_set_input_mode()
877 hid_hw_request(hdev, r, HID_REQ_SET_REPORT); mt_set_input_mode()
881 static void mt_set_maxcontacts(struct hid_device *hdev) mt_set_maxcontacts() argument
883 struct mt_device *td = hid_get_drvdata(hdev); mt_set_maxcontacts()
894 re = &hdev->report_enum[HID_FEATURE_REPORT]; mt_set_maxcontacts()
902 hid_hw_request(hdev, r, HID_REQ_SET_REPORT); mt_set_maxcontacts()
937 static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi) mt_input_configured() argument
939 struct mt_device *td = hid_get_drvdata(hdev); mt_input_configured()
945 mt_touch_input_configured(hdev, hi); mt_input_configured()
989 strlen(hdev->name) + strlen(suffix) + 2, mt_input_configured()
992 sprintf(name, "%s %s", hdev->name, suffix); mt_input_configured()
998 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) mt_probe() argument
1014 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; mt_probe()
1021 hdev->quirks |= HID_QUIRK_MULTI_INPUT; mt_probe()
1022 hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT; mt_probe()
1034 hdev->quirks |= HID_QUIRK_NO_INIT_INPUT_REPORTS; mt_probe()
1036 td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); mt_probe()
1038 dev_err(&hdev->dev, "cannot allocate multitouch data\n"); mt_probe()
1047 hid_set_drvdata(hdev, td); mt_probe()
1049 td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields), mt_probe()
1052 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n"); mt_probe()
1059 ret = hid_parse(hdev); mt_probe()
1063 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); mt_probe()
1067 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); mt_probe()
1069 mt_set_maxcontacts(hdev); mt_probe()
1070 mt_set_input_mode(hdev); mt_probe()
1073 devm_kfree(&hdev->dev, td->fields); mt_probe()
1080 static int mt_reset_resume(struct hid_device *hdev) mt_reset_resume() argument
1082 mt_set_maxcontacts(hdev); mt_reset_resume()
1083 mt_set_input_mode(hdev); mt_reset_resume()
1087 static int mt_resume(struct hid_device *hdev) mt_resume() argument
1093 hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE); mt_resume()
1099 static void mt_remove(struct hid_device *hdev) mt_remove() argument
1101 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); mt_remove()
1102 hid_hw_stop(hdev); mt_remove()
H A Dhid-sony.c815 struct hid_device *hdev; member in struct:sony_sc
840 static __u8 *sixaxis_fixup(struct hid_device *hdev, __u8 *rdesc, sixaxis_fixup() argument
847 static __u8 *ps3remote_fixup(struct hid_device *hdev, __u8 *rdesc, ps3remote_fixup() argument
854 static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi, ps3remote_mapping() argument
888 static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, sony_report_fixup() argument
891 struct sony_sc *sc = hid_get_drvdata(hdev); sony_report_fixup()
904 hid_info(hdev, "Fixing up Sony RF Receiver report descriptor\n"); sony_report_fixup()
915 hid_info(hdev, "Using modified Dualshock 4 report descriptor with gyroscope axes\n"); sony_report_fixup()
919 hid_info(hdev, "Using modified Dualshock 4 Bluetooth report descriptor\n"); sony_report_fixup()
925 return sixaxis_fixup(hdev, rdesc, rsize); sony_report_fixup()
928 return ps3remote_fixup(hdev, rdesc, rsize); sony_report_fixup()
965 struct hid_input *hidinput = list_entry(sc->hdev->inputs.next, dualshock4_parse_report()
1035 static int sony_raw_event(struct hid_device *hdev, struct hid_report *report, sony_raw_event() argument
1038 struct sony_sc *sc = hid_get_drvdata(hdev); sony_raw_event()
1060 static int sony_mapping(struct hid_device *hdev, struct hid_input *hi, sony_mapping() argument
1064 struct sony_sc *sc = hid_get_drvdata(hdev); sony_mapping()
1090 return ps3remote_mapping(hdev, hi, field, usage, bit, max); sony_mapping()
1112 static void sony_input_configured(struct hid_device *hdev, sony_input_configured() argument
1115 struct sony_sc *sc = hid_get_drvdata(hdev); sony_input_configured()
1123 hid_err(sc->hdev, sony_input_configured()
1133 static int sixaxis_set_operational_usb(struct hid_device *hdev) sixaxis_set_operational_usb() argument
1144 ret = hid_hw_raw_request(hdev, 0xf2, buf, SIXAXIS_REPORT_0xF2_SIZE, sixaxis_set_operational_usb()
1147 hid_err(hdev, "can't set operational mode: step 1\n"); sixaxis_set_operational_usb()
1155 ret = hid_hw_raw_request(hdev, 0xf5, buf, SIXAXIS_REPORT_0xF5_SIZE, sixaxis_set_operational_usb()
1158 hid_err(hdev, "can't set operational mode: step 2\n"); sixaxis_set_operational_usb()
1162 ret = hid_hw_output_report(hdev, buf, 1); sixaxis_set_operational_usb()
1164 hid_err(hdev, "can't set operational mode: step 3\n"); sixaxis_set_operational_usb()
1172 static int sixaxis_set_operational_bt(struct hid_device *hdev) sixaxis_set_operational_bt() argument
1182 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(report), sixaxis_set_operational_bt()
1194 static int dualshock4_set_operational_bt(struct hid_device *hdev) dualshock4_set_operational_bt() argument
1203 ret = hid_hw_raw_request(hdev, 0x02, buf, DS4_REPORT_0x02_SIZE, dualshock4_set_operational_bt()
1257 static void buzz_set_leds(struct hid_device *hdev, const __u8 *leds) buzz_set_leds() argument
1260 &hdev->report_enum[HID_OUTPUT_REPORT].report_list; buzz_set_leds()
1272 hid_hw_request(hdev, report, HID_REQ_SET_REPORT); buzz_set_leds()
1282 buzz_set_leds(sc->hdev, leds); sony_set_leds()
1294 struct hid_device *hdev = container_of(dev, struct hid_device, dev); sony_led_set_brightness() local
1300 drv_data = hid_get_drvdata(hdev); sony_led_set_brightness()
1302 hid_err(hdev, "No device data\n"); sony_led_set_brightness()
1337 struct hid_device *hdev = container_of(dev, struct hid_device, dev); sony_led_get_brightness() local
1342 drv_data = hid_get_drvdata(hdev); sony_led_get_brightness()
1344 hid_err(hdev, "No device data\n"); sony_led_get_brightness()
1360 struct hid_device *hdev = container_of(dev, struct hid_device, dev); sony_led_blink_set() local
1361 struct sony_sc *drv_data = hid_get_drvdata(hdev); sony_led_blink_set()
1366 hid_err(hdev, "No device data\n"); sony_led_blink_set()
1424 struct hid_device *hdev = sc->hdev; sony_leds_init() local
1446 if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7)) sony_leds_init()
1473 name_sz = strlen(dev_name(&hdev->dev)) + name_len + 1; sony_leds_init()
1478 name_sz = strlen(dev_name(&hdev->dev)) + strlen(ds4_name_str[n]) + 2; sony_leds_init()
1482 hid_err(hdev, "Couldn't allocate memory for LED %d\n", n); sony_leds_init()
1489 snprintf(name, name_sz, name_fmt, dev_name(&hdev->dev), sony_leds_init()
1492 snprintf(name, name_sz, name_fmt, dev_name(&hdev->dev), n + 1); sony_leds_init()
1504 ret = led_classdev_register(&hdev->dev, led); sony_leds_init()
1506 hid_err(hdev, "Failed to register LED %d\n", n); sony_leds_init()
1573 hid_hw_raw_request(sc->hdev, report->report_id, (__u8 *)report, sixaxis_state_worker()
1581 struct hid_device *hdev = sc->hdev; dualshock4_state_worker() local
1619 hid_hw_output_report(hdev, buf, DS4_REPORT_0x05_SIZE); dualshock4_state_worker()
1621 hid_hw_raw_request(hdev, 0x11, buf, DS4_REPORT_0x11_SIZE, dualshock4_state_worker()
1665 struct hid_input *hidinput = list_entry(sc->hdev->inputs.next, sony_init_ff()
1725 struct hid_device *hdev = sc->hdev; sony_battery_probe() local
1745 sc->battery = power_supply_register(&hdev->dev, &sc->battery_desc, sony_battery_probe()
1749 hid_err(hdev, "Unable to register battery device\n"); sony_battery_probe()
1753 power_supply_powers(sc->battery, &hdev->dev); sony_battery_probe()
1791 hid_info(sc->hdev, "controller with MAC address %pMR already connected\n", sony_check_add_dev_list()
1821 ret = strlen(sc->hdev->uniq); sony_get_bt_devaddr()
1825 ret = sscanf(sc->hdev->uniq, sony_get_bt_devaddr()
1850 hid_warn(sc->hdev, "UNIQ does not contain a MAC address; duplicate check skipped\n"); sony_check_add()
1863 ret = hid_hw_raw_request(sc->hdev, 0x81, buf, sony_check_add()
1868 hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n"); sony_check_add()
1884 ret = hid_hw_raw_request(sc->hdev, 0xf2, buf, sony_check_add()
1889 hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n"); sony_check_add()
1960 static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) sony_probe() argument
1967 sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); sony_probe()
1969 hid_err(hdev, "can't alloc sony descriptor\n"); sony_probe()
1976 hid_set_drvdata(hdev, sc); sony_probe()
1977 sc->hdev = hdev; sony_probe()
1979 ret = hid_parse(hdev); sony_probe()
1981 hid_err(hdev, "parse failed\n"); sony_probe()
1990 ret = hid_hw_start(hdev, connect_mask); sony_probe()
1992 hid_err(hdev, "hw start failed\n"); sony_probe()
1998 hid_err(hdev, "failed to allocate the output report buffer\n"); sony_probe()
2004 hid_err(hdev, "failed to allocate the device id\n"); sony_probe()
2019 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP; sony_probe()
2020 hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID; sony_probe()
2021 ret = sixaxis_set_operational_usb(hdev); sony_probe()
2028 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP; sony_probe()
2029 ret = sixaxis_set_operational_bt(hdev); sony_probe()
2037 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP; sony_probe()
2038 ret = dualshock4_set_operational_bt(hdev); sony_probe()
2040 hid_err(hdev, "failed to set the Dualshock 4 operational mode\n"); sony_probe()
2069 ret = hid_hw_open(hdev); sony_probe()
2071 hid_err(hdev, "hw open failed\n"); sony_probe()
2084 hid_hw_close(hdev); sony_probe()
2094 hid_hw_stop(hdev); sony_probe()
2098 static void sony_remove(struct hid_device *hdev) sony_remove() argument
2100 struct sony_sc *sc = hid_get_drvdata(hdev); sony_remove()
2106 hid_hw_close(hdev); sony_remove()
2118 hid_hw_stop(hdev); sony_remove()
H A Dhid-picolcd_leds.c49 report = picolcd_out_report(REPORT_LED_STATE, data->hdev); picolcd_leds_set()
56 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_leds_set()
64 struct hid_device *hdev; picolcd_led_set_brightness() local
69 hdev = container_of(dev, struct hid_device, dev); picolcd_led_set_brightness()
70 data = hid_get_drvdata(hdev); picolcd_led_set_brightness()
91 struct hid_device *hdev; picolcd_led_get_brightness() local
96 hdev = container_of(dev, struct hid_device, dev); picolcd_led_get_brightness()
97 data = hid_get_drvdata(hdev); picolcd_led_get_brightness()
108 struct device *dev = &data->hdev->dev; picolcd_init_leds()
H A Dhid-roccat-koneplus.c381 static int koneplus_init_specials(struct hid_device *hdev) koneplus_init_specials() argument
383 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); koneplus_init_specials()
393 hid_err(hdev, "can't alloc device descriptor\n"); koneplus_init_specials()
396 hid_set_drvdata(hdev, koneplus); koneplus_init_specials()
400 hid_err(hdev, "couldn't init struct koneplus_device\n"); koneplus_init_specials()
404 retval = roccat_connect(koneplus_class, hdev, koneplus_init_specials()
407 hid_err(hdev, "couldn't init char dev\n"); koneplus_init_specials()
413 hid_set_drvdata(hdev, NULL); koneplus_init_specials()
422 static void koneplus_remove_specials(struct hid_device *hdev) koneplus_remove_specials() argument
424 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); koneplus_remove_specials()
429 koneplus = hid_get_drvdata(hdev); koneplus_remove_specials()
436 static int koneplus_probe(struct hid_device *hdev, koneplus_probe() argument
441 retval = hid_parse(hdev); koneplus_probe()
443 hid_err(hdev, "parse failed\n"); koneplus_probe()
447 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); koneplus_probe()
449 hid_err(hdev, "hw start failed\n"); koneplus_probe()
453 retval = koneplus_init_specials(hdev); koneplus_probe()
455 hid_err(hdev, "couldn't install mouse\n"); koneplus_probe()
462 hid_hw_stop(hdev); koneplus_probe()
467 static void koneplus_remove(struct hid_device *hdev) koneplus_remove() argument
469 koneplus_remove_specials(hdev); koneplus_remove()
470 hid_hw_stop(hdev); koneplus_remove()
514 static int koneplus_raw_event(struct hid_device *hdev, koneplus_raw_event() argument
517 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); koneplus_raw_event()
518 struct koneplus_device *koneplus = hid_get_drvdata(hdev); koneplus_raw_event()
H A Dhid-roccat-kovaplus.c448 static int kovaplus_init_specials(struct hid_device *hdev) kovaplus_init_specials() argument
450 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); kovaplus_init_specials()
460 hid_err(hdev, "can't alloc device descriptor\n"); kovaplus_init_specials()
463 hid_set_drvdata(hdev, kovaplus); kovaplus_init_specials()
467 hid_err(hdev, "couldn't init struct kovaplus_device\n"); kovaplus_init_specials()
471 retval = roccat_connect(kovaplus_class, hdev, kovaplus_init_specials()
474 hid_err(hdev, "couldn't init char dev\n"); kovaplus_init_specials()
481 hid_set_drvdata(hdev, NULL); kovaplus_init_specials()
490 static void kovaplus_remove_specials(struct hid_device *hdev) kovaplus_remove_specials() argument
492 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); kovaplus_remove_specials()
497 kovaplus = hid_get_drvdata(hdev); kovaplus_remove_specials()
504 static int kovaplus_probe(struct hid_device *hdev, kovaplus_probe() argument
509 retval = hid_parse(hdev); kovaplus_probe()
511 hid_err(hdev, "parse failed\n"); kovaplus_probe()
515 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); kovaplus_probe()
517 hid_err(hdev, "hw start failed\n"); kovaplus_probe()
521 retval = kovaplus_init_specials(hdev); kovaplus_probe()
523 hid_err(hdev, "couldn't install mouse\n"); kovaplus_probe()
530 hid_hw_stop(hdev); kovaplus_probe()
535 static void kovaplus_remove(struct hid_device *hdev) kovaplus_remove() argument
537 kovaplus_remove_specials(hdev); kovaplus_remove()
538 hid_hw_stop(hdev); kovaplus_remove()
603 static int kovaplus_raw_event(struct hid_device *hdev, kovaplus_raw_event() argument
606 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); kovaplus_raw_event()
607 struct kovaplus_device *kovaplus = hid_get_drvdata(hdev); kovaplus_raw_event()
H A Dhid-zpff.c110 static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id) zp_probe() argument
114 ret = hid_parse(hdev); zp_probe()
116 hid_err(hdev, "parse failed\n"); zp_probe()
120 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); zp_probe()
122 hid_err(hdev, "hw start failed\n"); zp_probe()
126 zpff_init(hdev); zp_probe()
H A Dhid-wiimote-core.c25 static int wiimote_hid_send(struct hid_device *hdev, __u8 *buffer, wiimote_hid_send() argument
31 if (!hdev->ll_driver->output_report) wiimote_hid_send()
38 ret = hid_hw_output_report(hdev, buf, count); wiimote_hid_send()
57 ret = wiimote_hid_send(wdata->hdev, wiimote_queue_worker()
80 hid_warn(wdata->hdev, "Sending too large output report\n"); wiimote_queue()
108 hid_warn(wdata->hdev, "Output queue is full"); wiimote_queue()
320 hid_warn(wdata->hdev, "Invalid length %d wmem request\n", size); wiiproto_req_wmem()
345 hid_warn(wdata->hdev, "Invalid length %d rmem request\n", size); wiiproto_req_rmem()
444 hid_dbg(wdata->hdev, "extension ID: %6phC\n", rmem); wiimote_cmd_read_ext()
514 hid_dbg(wdata->hdev, "motion plus ID: %6phC\n", rmem); wiimote_cmd_read_mp()
519 hid_info(wdata->hdev, "unknown motion plus ID: %6phC\n", rmem); wiimote_cmd_read_mp()
535 hid_dbg(wdata->hdev, "mapped motion plus ID: %6phC\n", rmem); wiimote_cmd_read_mp_mapped()
638 wdata->input->dev.parent = &wdata->hdev->dev; wiimote_modules_load()
639 wdata->input->id.bustype = wdata->hdev->bus; wiimote_modules_load()
640 wdata->input->id.vendor = wdata->hdev->vendor; wiimote_modules_load()
641 wdata->input->id.product = wdata->hdev->product; wiimote_modules_load()
642 wdata->input->id.version = wdata->hdev->version; wiimote_modules_load()
811 vendor = wdata->hdev->vendor; wiimote_init_set_type()
812 product = wdata->hdev->product; wiimote_init_set_type()
813 name = wdata->hdev->name; wiimote_init_set_type()
849 hid_info(wdata->hdev, "cannot detect device; NAME: %s VID: %04x PID: %04x EXT: %04x\n", wiimote_init_set_type()
852 hid_info(wdata->hdev, "detected device: %s\n", wiimote_init_set_type()
917 hid_info(wdata->hdev, "detected extension: Nintendo Wii Motion Plus\n"); wiimote_init_poll_mp()
968 hid_dbg(wdata->hdev, "state left: !EXT && MP\n"); wiimote_init_check()
992 hid_dbg(wdata->hdev, "state left: EXT && !MP\n"); wiimote_init_check()
1019 hid_dbg(wdata->hdev, "state left: !EXT && !MP\n"); wiimote_init_check()
1049 hid_dbg(wdata->hdev, "state left: EXT && MP\n"); wiimote_init_check()
1094 hid_dbg(wdata->hdev, "detect extensions..\n"); wiimote_init_hotplug()
1127 hid_info(wdata->hdev, "cannot detect extension; %6phC\n", wiimote_init_hotplug()
1134 hid_info(wdata->hdev, "detected extension: %s\n", wiimote_init_hotplug()
1144 hid_info(wdata->hdev, "detected extension: Nintendo Wii Motion Plus\n"); wiimote_init_hotplug()
1192 hid_dbg(wdata->hdev, "detected extensions: MP: %d EXT: %d\n", wiimote_init_hotplug()
1211 kobject_uevent(&wdata->hdev->dev.kobj, KOBJ_CHANGE); wiimote_init_worker()
1318 hid_dbg(wdata->hdev, "MP hotplug: 1\n"); handler_ext()
1324 hid_dbg(wdata->hdev, "MP hotplug: 0\n"); handler_ext()
1420 hid_dbg(wdata->hdev, "EXT hotplug: 1\n"); handler_status()
1426 hid_dbg(wdata->hdev, "EXT hotplug: 0\n"); handler_status()
1478 hid_warn(wdata->hdev, "Remote error %hhu on req %hhu\n", err, handler_return()
1610 static int wiimote_hid_event(struct hid_device *hdev, struct hid_report *report, wiimote_hid_event() argument
1613 struct wiimote_data *wdata = hid_get_drvdata(hdev); wiimote_hid_event()
1632 hid_warn(hdev, "Unhandled report %hhu size %d\n", raw_data[0], wiimote_hid_event()
1722 static struct wiimote_data *wiimote_create(struct hid_device *hdev) wiimote_create() argument
1730 wdata->hdev = hdev; wiimote_create()
1731 hid_set_drvdata(hdev, wdata); wiimote_create()
1762 device_remove_file(&wdata->hdev->dev, &dev_attr_devtype); wiimote_destroy()
1763 device_remove_file(&wdata->hdev->dev, &dev_attr_extension); wiimote_destroy()
1769 hid_hw_close(wdata->hdev); wiimote_destroy()
1770 hid_hw_stop(wdata->hdev); wiimote_destroy()
1775 static int wiimote_hid_probe(struct hid_device *hdev, wiimote_hid_probe() argument
1781 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; wiimote_hid_probe()
1783 wdata = wiimote_create(hdev); wiimote_hid_probe()
1785 hid_err(hdev, "Can't alloc device\n"); wiimote_hid_probe()
1789 ret = hid_parse(hdev); wiimote_hid_probe()
1791 hid_err(hdev, "HID parse failed\n"); wiimote_hid_probe()
1795 ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); wiimote_hid_probe()
1797 hid_err(hdev, "HW start failed\n"); wiimote_hid_probe()
1801 ret = hid_hw_open(hdev); wiimote_hid_probe()
1803 hid_err(hdev, "cannot start hardware I/O\n"); wiimote_hid_probe()
1807 ret = device_create_file(&hdev->dev, &dev_attr_extension); wiimote_hid_probe()
1809 hid_err(hdev, "cannot create sysfs attribute\n"); wiimote_hid_probe()
1813 ret = device_create_file(&hdev->dev, &dev_attr_devtype); wiimote_hid_probe()
1815 hid_err(hdev, "cannot create sysfs attribute\n"); wiimote_hid_probe()
1823 hid_info(hdev, "New device registered\n"); wiimote_hid_probe()
1835 device_remove_file(&wdata->hdev->dev, &dev_attr_extension); wiimote_hid_probe()
1837 hid_hw_close(hdev); wiimote_hid_probe()
1839 hid_hw_stop(hdev); wiimote_hid_probe()
1847 static void wiimote_hid_remove(struct hid_device *hdev) wiimote_hid_remove() argument
1849 struct wiimote_data *wdata = hid_get_drvdata(hdev); wiimote_hid_remove()
1851 hid_info(hdev, "Device removed\n"); wiimote_hid_remove()
H A Dhid-aureal.c20 static __u8 *aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc, aureal_report_fixup() argument
24 dev_info(&hdev->dev, "fixing Aureal Cy se W-01RN USB_V3.1 report descriptor.\n"); aureal_report_fixup()
H A Dhid-elecom.c23 static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, elecom_report_fixup() argument
27 hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n"); elecom_report_fixup()
H A Dhid-gaff.c135 static inline int gaff_init(struct hid_device *hdev) gaff_init() argument
141 static int ga_probe(struct hid_device *hdev, const struct hid_device_id *id) ga_probe() argument
145 dev_dbg(&hdev->dev, "Greenasia HID hardware probe..."); ga_probe()
147 ret = hid_parse(hdev); ga_probe()
149 hid_err(hdev, "parse failed\n"); ga_probe()
153 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); ga_probe()
155 hid_err(hdev, "hw start failed\n"); ga_probe()
159 gaff_init(hdev); ga_probe()
H A Dhid-cherry.c28 static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, ch_report_fixup() argument
32 hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); ch_report_fixup()
41 static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, ch_input_mapping() argument
H A Dhid-dr.c237 static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc, dr_report_fixup() argument
240 switch (hdev->product) { dr_report_fixup()
251 static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id) dr_probe() argument
255 dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe..."); dr_probe()
257 ret = hid_parse(hdev); dr_probe()
259 hid_err(hdev, "parse failed\n"); dr_probe()
263 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); dr_probe()
265 hid_err(hdev, "hw start failed\n"); dr_probe()
269 switch (hdev->product) { dr_probe()
271 ret = drff_init(hdev); dr_probe()
273 dev_err(&hdev->dev, "force feedback init failed\n"); dr_probe()
274 hid_hw_stop(hdev); dr_probe()
H A Dhid-ezkey.c28 static int ez_input_mapping(struct hid_device *hdev, struct hid_input *hi, ez_input_mapping() argument
50 static int ez_event(struct hid_device *hdev, struct hid_field *field, ez_event() argument
53 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || ez_event()
H A Dhid-monterey.c24 static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, mr_report_fixup() argument
28 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); mr_report_fixup()
36 static int mr_input_mapping(struct hid_device *hdev, struct hid_input *hi, mr_input_mapping() argument
H A Dhid-ortek.c27 static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, ortek_report_fixup() argument
31 hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n"); ortek_report_fixup()
34 hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n"); ortek_report_fixup()
H A Dhid-sunplus.c24 static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, sp_report_fixup() argument
29 hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); sp_report_fixup()
38 static int sp_input_mapping(struct hid_device *hdev, struct hid_input *hi, sp_input_mapping() argument
H A Dhid-holtek-kbd.c108 static __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc, holtek_kbd_report_fixup() argument
111 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); holtek_kbd_report_fixup()
138 static int holtek_kbd_probe(struct hid_device *hdev, holtek_kbd_probe() argument
141 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); holtek_kbd_probe()
142 int ret = hid_parse(hdev); holtek_kbd_probe()
145 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); holtek_kbd_probe()
149 list_for_each_entry(hidinput, &hdev->inputs, list) { holtek_kbd_probe()
H A Dhid-picolcd_cir.c120 rdev->input_name = data->hdev->name; picolcd_init_cir()
121 rdev->input_phys = data->hdev->phys; picolcd_init_cir()
122 rdev->input_id.bustype = data->hdev->bus; picolcd_init_cir()
123 rdev->input_id.vendor = data->hdev->vendor; picolcd_init_cir()
124 rdev->input_id.product = data->hdev->product; picolcd_init_cir()
125 rdev->input_id.version = data->hdev->version; picolcd_init_cir()
126 rdev->dev.parent = &data->hdev->dev; picolcd_init_cir()
H A Dhid-sjoy.c130 static int sjoy_probe(struct hid_device *hdev, const struct hid_device_id *id) sjoy_probe() argument
134 hdev->quirks |= id->driver_data; sjoy_probe()
136 ret = hid_parse(hdev); sjoy_probe()
138 hid_err(hdev, "parse failed\n"); sjoy_probe()
142 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); sjoy_probe()
144 hid_err(hdev, "hw start failed\n"); sjoy_probe()
148 sjoyff_init(hdev); sjoy_probe()
H A Dhid-debug.c660 void hid_debug_event(struct hid_device *hdev, char *buf) hid_debug_event() argument
666 spin_lock_irqsave(&hdev->debug_list_lock, flags); hid_debug_event()
667 list_for_each_entry(list, &hdev->debug_list, node) { hid_debug_event()
673 spin_unlock_irqrestore(&hdev->debug_list_lock, flags); hid_debug_event()
675 wake_up_interruptible(&hdev->debug_wait); hid_debug_event()
709 void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 value) hid_dump_input() argument
720 hid_debug_event(hdev, buf); hid_dump_input()
723 wake_up_interruptible(&hdev->debug_wait); hid_dump_input()
1050 struct hid_device *hdev = f->private; hid_debug_rdesc_show() local
1051 const __u8 *rdesc = hdev->rdesc; hid_debug_rdesc_show()
1052 unsigned rsize = hdev->rsize; hid_debug_rdesc_show()
1056 rdesc = hdev->dev_rdesc; hid_debug_rdesc_show()
1057 rsize = hdev->dev_rsize; hid_debug_rdesc_show()
1066 hid_dump_device(hdev, f); hid_debug_rdesc_show()
1068 hid_dump_input_mapping(hdev, f); hid_debug_rdesc_show()
1094 list->hdev = (struct hid_device *) inode->i_private; hid_debug_events_open()
1098 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); hid_debug_events_open()
1099 list_add_tail(&list->node, &list->hdev->debug_list); hid_debug_events_open()
1100 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); hid_debug_events_open()
1116 add_wait_queue(&list->hdev->debug_wait, &wait); hid_debug_events_read()
1129 if (!list->hdev || !list->hdev->debug) { hid_debug_events_read()
1143 remove_wait_queue(&list->hdev->debug_wait, &wait); hid_debug_events_read()
1184 poll_wait(file, &list->hdev->debug_wait, wait); hid_debug_events_poll()
1187 if (!list->hdev->debug) hid_debug_events_poll()
1197 spin_lock_irqsave(&list->hdev->debug_list_lock, flags); hid_debug_events_release()
1199 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); hid_debug_events_release()
1223 void hid_debug_register(struct hid_device *hdev, const char *name) hid_debug_register() argument
1225 hdev->debug_dir = debugfs_create_dir(name, hid_debug_root); hid_debug_register()
1226 hdev->debug_rdesc = debugfs_create_file("rdesc", 0400, hid_debug_register()
1227 hdev->debug_dir, hdev, &hid_debug_rdesc_fops); hid_debug_register()
1228 hdev->debug_events = debugfs_create_file("events", 0400, hid_debug_register()
1229 hdev->debug_dir, hdev, &hid_debug_events_fops); hid_debug_register()
1230 hdev->debug = 1; hid_debug_register()
1233 void hid_debug_unregister(struct hid_device *hdev) hid_debug_unregister() argument
1235 hdev->debug = 0; hid_debug_unregister()
1236 wake_up_interruptible(&hdev->debug_wait); hid_debug_unregister()
1237 debugfs_remove(hdev->debug_rdesc); hid_debug_unregister()
1238 debugfs_remove(hdev->debug_events); hid_debug_unregister()
1239 debugfs_remove(hdev->debug_dir); hid_debug_unregister()
H A Dhid-lg.c342 static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, lg_report_fixup() argument
345 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); lg_report_fixup()
351 hid_info(hdev, lg_report_fixup()
359 hid_info(hdev, lg_report_fixup()
364 switch (hdev->product) { lg_report_fixup()
368 udesc = &(hid_to_usb_dev(hdev)->descriptor); lg_report_fixup()
370 hid_err(hdev, "NULL USB device descriptor\n"); lg_report_fixup()
380 hid_info(hdev, lg_report_fixup()
389 hid_info(hdev, lg_report_fixup()
398 hid_info(hdev, lg_report_fixup()
407 hid_info(hdev, lg_report_fixup()
416 hid_info(hdev, lg_report_fixup()
426 hid_info(hdev, "fixing up Logitech Speed Force Wireless report descriptor\n"); lg_report_fixup()
551 static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi, lg_input_mapping() argument
567 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); lg_input_mapping()
570 if (hdev->product == USB_DEVICE_ID_LOGITECH_RECEIVER && lg_input_mapping()
574 if (hdev->product == USB_DEVICE_ID_DINOVO_MINI && lg_input_mapping()
604 static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi, lg_input_mapped() argument
608 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); lg_input_mapped()
622 switch (hdev->product) { lg_input_mapped()
642 static int lg_event(struct hid_device *hdev, struct hid_field *field, lg_event() argument
645 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); lg_event()
653 return lg4ff_adjust_input_event(hdev, field, usage, value, drv_data); lg_event()
659 static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) lg_probe() argument
667 hid_err(hdev, "Insufficient memory, cannot allocate driver data\n"); lg_probe()
672 hid_set_drvdata(hdev, (void *)drv_data); lg_probe()
675 hdev->quirks |= HID_QUIRK_NOGET; lg_probe()
677 ret = hid_parse(hdev); lg_probe()
679 hid_err(hdev, "parse failed\n"); lg_probe()
686 ret = hid_hw_start(hdev, connect_mask); lg_probe()
688 hid_err(hdev, "hw start failed\n"); lg_probe()
693 if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { lg_probe()
696 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), lg_probe()
709 ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), lg_probe()
715 lgff_init(hdev); lg_probe()
717 lg2ff_init(hdev); lg_probe()
719 lg3ff_init(hdev); lg_probe()
721 lg4ff_init(hdev); lg_probe()
729 static void lg_remove(struct hid_device *hdev) lg_remove() argument
731 struct lg_drv_data *drv_data = hid_get_drvdata(hdev); lg_remove()
733 lg4ff_deinit(hdev); lg_remove()
735 hid_hw_stop(hdev); lg_remove()
H A Dhid-apple.c270 static int apple_event(struct hid_device *hdev, struct hid_field *field, apple_event() argument
273 struct apple_sc *asc = hid_get_drvdata(hdev); apple_event()
275 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || apple_event()
287 hidinput_apple_event(hdev, field->hidinput->input, apple_event()
298 static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, apple_report_fixup() argument
301 struct apple_sc *asc = hid_get_drvdata(hdev); apple_report_fixup()
305 hid_info(hdev, apple_report_fixup()
332 static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, apple_input_mapping() argument
348 static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi, apple_input_mapped() argument
352 struct apple_sc *asc = hid_get_drvdata(hdev); apple_input_mapped()
366 static int apple_probe(struct hid_device *hdev, apple_probe() argument
374 asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL); apple_probe()
376 hid_err(hdev, "can't alloc apple descriptor\n"); apple_probe()
382 hid_set_drvdata(hdev, asc); apple_probe()
384 ret = hid_parse(hdev); apple_probe()
386 hid_err(hdev, "parse failed\n"); apple_probe()
395 ret = hid_hw_start(hdev, connect_mask); apple_probe()
397 hid_err(hdev, "hw start failed\n"); apple_probe()
H A Dhid-kye.c402 static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, kye_consumer_control_fixup() argument
416 hid_info(hdev, "fixing up %s report descriptor\n", device_name); kye_consumer_control_fixup()
422 static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, kye_report_fixup() argument
425 switch (hdev->product) { kye_report_fixup()
440 hid_info(hdev, kye_report_fixup()
476 rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, kye_report_fixup()
480 rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, kye_report_fixup()
484 rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, kye_report_fixup()
494 * @hdev: HID device
499 static int kye_tablet_enable(struct hid_device *hdev) kye_tablet_enable() argument
506 list = &hdev->report_enum[HID_FEATURE_REPORT].report_list; list_for_each()
514 hid_err(hdev, "tablet-enabling feature report not found\n");
519 hid_err(hdev, "invalid tablet-enabling feature report\n");
532 hid_hw_request(hdev, report, HID_REQ_SET_REPORT);
537 static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) kye_probe() argument
541 ret = hid_parse(hdev); kye_probe()
543 hid_err(hdev, "parse failed\n"); kye_probe()
547 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); kye_probe()
549 hid_err(hdev, "hw start failed\n"); kye_probe()
559 ret = kye_tablet_enable(hdev); kye_probe()
561 hid_err(hdev, "tablet enabling failed\n"); kye_probe()
570 if (hid_hw_open(hdev)) kye_probe()
571 hid_hw_close(hdev); kye_probe()
577 hid_hw_stop(hdev); kye_probe()
H A Dhid-roccat-kone.c692 static int kone_init_specials(struct hid_device *hdev) kone_init_specials() argument
694 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); kone_init_specials()
705 hid_set_drvdata(hdev, kone); kone_init_specials()
709 hid_err(hdev, "couldn't init struct kone_device\n"); kone_init_specials()
713 retval = roccat_connect(kone_class, hdev, kone_init_specials()
716 hid_err(hdev, "couldn't init char dev\n"); kone_init_specials()
723 hid_set_drvdata(hdev, NULL); kone_init_specials()
732 static void kone_remove_specials(struct hid_device *hdev) kone_remove_specials() argument
734 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); kone_remove_specials()
739 kone = hid_get_drvdata(hdev); kone_remove_specials()
742 kfree(hid_get_drvdata(hdev)); kone_remove_specials()
746 static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id) kone_probe() argument
750 retval = hid_parse(hdev); kone_probe()
752 hid_err(hdev, "parse failed\n"); kone_probe()
756 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); kone_probe()
758 hid_err(hdev, "hw start failed\n"); kone_probe()
762 retval = kone_init_specials(hdev); kone_probe()
764 hid_err(hdev, "couldn't install mouse\n"); kone_probe()
771 hid_hw_stop(hdev); kone_probe()
776 static void kone_remove(struct hid_device *hdev) kone_remove() argument
778 kone_remove_specials(hdev); kone_remove()
779 hid_hw_stop(hdev); kone_remove()
835 static int kone_raw_event(struct hid_device *hdev, struct hid_report *report, kone_raw_event() argument
838 struct kone_device *kone = hid_get_drvdata(hdev); kone_raw_event()
H A Dhid-gyration.c27 static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi, gyration_input_mapping() argument
57 static int gyration_event(struct hid_device *hdev, struct hid_field *field, gyration_event() argument
61 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput) gyration_event()
H A Dhid-picolcd_lcd.c39 struct hid_report *report = picolcd_out_report(REPORT_CONTRAST, data->hdev); picolcd_set_contrast()
49 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_set_contrast()
67 struct device *dev = &data->hdev->dev; picolcd_init_lcd()
H A Dhid-uclogic.c633 static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, uclogic_report_fixup() argument
636 struct usb_interface *iface = to_usb_interface(hdev->dev.parent); uclogic_report_fixup()
638 struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); uclogic_report_fixup()
640 switch (hdev->product) { uclogic_report_fixup()
719 static int uclogic_input_mapping(struct hid_device *hdev, struct hid_input *hi, uclogic_input_mapping() argument
723 struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); uclogic_input_mapping()
734 static void uclogic_input_configured(struct hid_device *hdev, uclogic_input_configured() argument
770 len = strlen(hdev->name) + 2 + strlen(suffix); uclogic_input_configured()
773 snprintf(name, len, "%s %s", hdev->name, suffix); uclogic_input_configured()
782 * @hdev: HID device
784 static int uclogic_tablet_enable(struct hid_device *hdev) uclogic_tablet_enable() argument
787 struct usb_device *usb_dev = hid_to_usb_dev(hdev); uclogic_tablet_enable()
788 struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); uclogic_tablet_enable()
805 hid_err(hdev, "failed to allocate parameter buffer\n"); uclogic_tablet_enable()
815 hid_err(hdev, "device parameters not found\n"); uclogic_tablet_enable()
819 hid_err(hdev, "failed to get device parameters: %d\n", rc); uclogic_tablet_enable()
823 hid_err(hdev, "invalid device parameters\n"); uclogic_tablet_enable()
845 drvdata->rdesc = devm_kzalloc(&hdev->dev, uclogic_tablet_enable()
849 hid_err(hdev, "failed to allocate fixed rdesc\n"); uclogic_tablet_enable()
877 static int uclogic_probe(struct hid_device *hdev, uclogic_probe() argument
881 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); uclogic_probe()
888 hdev->quirks |= HID_QUIRK_MULTI_INPUT; uclogic_probe()
889 hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT; uclogic_probe()
892 drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); uclogic_probe()
896 hid_set_drvdata(hdev, drvdata); uclogic_probe()
902 rc = uclogic_tablet_enable(hdev); uclogic_probe()
904 hid_err(hdev, "tablet enabling failed\n"); uclogic_probe()
914 rc = hid_parse(hdev); uclogic_probe()
916 hid_err(hdev, "parse failed\n"); uclogic_probe()
920 rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT); uclogic_probe()
922 hid_err(hdev, "hw start failed\n"); uclogic_probe()
929 static int uclogic_raw_event(struct hid_device *hdev, struct hid_report *report, uclogic_raw_event() argument
932 struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); uclogic_raw_event()
H A Dhid-keytouch.c30 static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc, keytouch_report_fixup() argument
33 hid_info(hdev, "fixing up Keytouch IEC report descriptor\n"); keytouch_report_fixup()
H A Dhid-picolcd.h75 struct hid_device *hdev; member in struct:picolcd_data
140 struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir);
144 struct hid_device *hdev, struct hid_report *report);
152 struct hid_device *hdev, struct hid_report *report,
163 struct hid_device *hdev, struct hid_report *report) picolcd_debug_out_report()
167 struct hid_device *hdev, struct hid_report *report, picolcd_debug_raw_event()
307 int picolcd_reset(struct hid_device *hdev);
308 struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev,
162 picolcd_debug_out_report(struct picolcd_data *data, struct hid_device *hdev, struct hid_report *report) picolcd_debug_out_report() argument
166 picolcd_debug_raw_event(struct picolcd_data *data, struct hid_device *hdev, struct hid_report *report, u8 *raw_data, int size) picolcd_debug_raw_event() argument
H A Dhid-wiimote-modules.c249 wdata->hdev->uniq); wiimod_battery_probe()
253 wdata->battery = power_supply_register(&wdata->hdev->dev, wiimod_battery_probe()
257 hid_err(wdata->hdev, "cannot register battery device\n"); wiimod_battery_probe()
262 power_supply_powers(wdata->battery, &wdata->hdev->dev); wiimod_battery_probe()
348 struct device *dev = &wdata->hdev->dev; wiimod_led_probe()
500 wdata->accel->dev.parent = &wdata->hdev->dev; wiimod_accel_probe()
501 wdata->accel->id.bustype = wdata->hdev->bus; wiimod_accel_probe()
502 wdata->accel->id.vendor = wdata->hdev->vendor; wiimod_accel_probe()
503 wdata->accel->id.product = wdata->hdev->product; wiimod_accel_probe()
504 wdata->accel->id.version = wdata->hdev->version; wiimod_accel_probe()
517 hid_err(wdata->hdev, "cannot register input device\n"); wiimod_accel_probe()
752 wdata->ir->dev.parent = &wdata->hdev->dev; wiimod_ir_probe()
753 wdata->ir->id.bustype = wdata->hdev->bus; wiimod_ir_probe()
754 wdata->ir->id.vendor = wdata->hdev->vendor; wiimod_ir_probe()
755 wdata->ir->id.product = wdata->hdev->product; wiimod_ir_probe()
756 wdata->ir->id.version = wdata->hdev->version; wiimod_ir_probe()
779 hid_err(wdata->hdev, "cannot register input device\n"); wiimod_ir_probe()
947 wdata->extension.input->dev.parent = &wdata->hdev->dev; wiimod_nunchuk_probe()
948 wdata->extension.input->id.bustype = wdata->hdev->bus; wiimod_nunchuk_probe()
949 wdata->extension.input->id.vendor = wdata->hdev->vendor; wiimod_nunchuk_probe()
950 wdata->extension.input->id.product = wdata->hdev->product; wiimod_nunchuk_probe()
951 wdata->extension.input->id.version = wdata->hdev->version; wiimod_nunchuk_probe()
1222 wdata->extension.input->dev.parent = &wdata->hdev->dev; wiimod_classic_probe()
1223 wdata->extension.input->id.bustype = wdata->hdev->bus; wiimod_classic_probe()
1224 wdata->extension.input->id.vendor = wdata->hdev->vendor; wiimod_classic_probe()
1225 wdata->extension.input->id.product = wdata->hdev->product; wiimod_classic_probe()
1226 wdata->extension.input->id.version = wdata->hdev->version; wiimod_classic_probe()
1490 ret = device_create_file(&wdata->hdev->dev, wiimod_bboard_probe()
1493 hid_err(wdata->hdev, "cannot create sysfs attribute\n"); wiimod_bboard_probe()
1500 wdata->extension.input->dev.parent = &wdata->hdev->dev; wiimod_bboard_probe()
1501 wdata->extension.input->id.bustype = wdata->hdev->bus; wiimod_bboard_probe()
1502 wdata->extension.input->id.vendor = wdata->hdev->vendor; wiimod_bboard_probe()
1503 wdata->extension.input->id.product = wdata->hdev->product; wiimod_bboard_probe()
1504 wdata->extension.input->id.version = wdata->hdev->version; wiimod_bboard_probe()
1531 device_remove_file(&wdata->hdev->dev, wiimod_bboard_probe()
1547 device_remove_file(&wdata->hdev->dev, wiimod_bboard_remove()
1879 ret = device_create_file(&wdata->hdev->dev, wiimod_pro_probe()
1882 hid_err(wdata->hdev, "cannot create sysfs attribute\n"); wiimod_pro_probe()
1888 wdata->extension.input->dev.parent = &wdata->hdev->dev; wiimod_pro_probe()
1889 wdata->extension.input->id.bustype = wdata->hdev->bus; wiimod_pro_probe()
1890 wdata->extension.input->id.vendor = wdata->hdev->vendor; wiimod_pro_probe()
1891 wdata->extension.input->id.product = wdata->hdev->product; wiimod_pro_probe()
1892 wdata->extension.input->id.version = wdata->hdev->version; wiimod_pro_probe()
1921 device_remove_file(&wdata->hdev->dev, wiimod_pro_probe()
1940 device_remove_file(&wdata->hdev->dev, wiimod_pro_remove()
2133 wdata->mp->dev.parent = &wdata->hdev->dev; wiimod_mp_probe()
2134 wdata->mp->id.bustype = wdata->hdev->bus; wiimod_mp_probe()
2135 wdata->mp->id.vendor = wdata->hdev->vendor; wiimod_mp_probe()
2136 wdata->mp->id.product = wdata->hdev->product; wiimod_mp_probe()
2137 wdata->mp->id.version = wdata->hdev->version; wiimod_mp_probe()
H A Dhid-pl.c190 static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) pl_probe() argument
195 hdev->quirks |= HID_QUIRK_MULTI_INPUT; pl_probe()
197 ret = hid_parse(hdev); pl_probe()
199 hid_err(hdev, "parse failed\n"); pl_probe()
203 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); pl_probe()
205 hid_err(hdev, "hw start failed\n"); pl_probe()
209 plff_init(hdev); pl_probe()
H A Dhid-picolcd_backlight.c36 struct hid_report *report = picolcd_out_report(REPORT_BRIGHTNESS, data->hdev); picolcd_set_brightness()
47 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_set_brightness()
65 struct device *dev = &data->hdev->dev; picolcd_init_backlight()
H A Dhid-icade.c167 static int icade_event(struct hid_device *hdev, struct hid_field *field, icade_event() argument
172 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || icade_event()
191 static int icade_input_mapping(struct hid_device *hdev, struct hid_input *hi, icade_input_mapping() argument
214 static int icade_input_mapped(struct hid_device *hdev, struct hid_input *hi, icade_input_mapped() argument
H A Dhid-kensington.c23 static int ks_input_mapping(struct hid_device *hdev, struct hid_input *hi, ks_input_mapping() argument
H A Dhid-penmount.c21 static int penmount_input_mapping(struct hid_device *hdev, penmount_input_mapping() argument
H A Dhid-speedlink.c27 static int speedlink_input_mapping(struct hid_device *hdev, speedlink_input_mapping() argument
45 static int speedlink_event(struct hid_device *hdev, struct hid_field *field, speedlink_event() argument
H A Dhid-holtekff.c191 static int holtek_probe(struct hid_device *hdev, const struct hid_device_id *id) holtek_probe() argument
195 ret = hid_parse(hdev); holtek_probe()
197 hid_err(hdev, "parse failed\n"); holtek_probe()
201 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); holtek_probe()
203 hid_err(hdev, "hw start failed\n"); holtek_probe()
207 holtekff_init(hdev); holtek_probe()
H A Dhid-tmff.c213 static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id) tm_probe() argument
217 ret = hid_parse(hdev); tm_probe()
219 hid_err(hdev, "parse failed\n"); tm_probe()
223 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); tm_probe()
225 hid_err(hdev, "hw start failed\n"); tm_probe()
229 tmff_init(hdev, (void *)id->driver_data); tm_probe()
H A Dhid-picolcd_fb.c108 report1 = picolcd_out_report(REPORT_LCD_CMD_DATA, data->hdev); picolcd_fb_send_tile()
111 report2 = picolcd_out_report(REPORT_LCD_DATA, data->hdev); picolcd_fb_send_tile()
144 hid_hw_request(data->hdev, report1, HID_REQ_SET_REPORT); picolcd_fb_send_tile()
145 hid_hw_request(data->hdev, report2, HID_REQ_SET_REPORT); picolcd_fb_send_tile()
197 struct hid_report *report = picolcd_out_report(REPORT_LCD_CMD, data->hdev); picolcd_fb_reset()
215 hid_hw_request(data->hdev, report, HID_REQ_SET_REPORT); picolcd_fb_reset()
271 hid_hw_wait(data->hdev); picolcd_fb_update()
289 hid_hw_wait(data->hdev); picolcd_fb_update()
510 struct device *dev = &data->hdev->dev; picolcd_init_framebuffer()
602 device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate); picolcd_exit_framebuffer()
H A Dhid-chicony.c28 static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, ch_input_mapping() argument
H A Dhid-lcpower.c23 static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi, ts_input_mapping() argument
H A Dhid-tivo.c25 static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, tivo_input_mapping() argument
H A Dhid-xinmo.c28 static int xinmo_event(struct hid_device *hdev, struct hid_field *field, xinmo_event() argument
H A Dwacom.h112 struct hid_device *hdev; member in struct:wacom
142 void wacom_wac_usage_mapping(struct hid_device *hdev,
144 int wacom_wac_event(struct hid_device *hdev, struct hid_field *field,
146 void wacom_wac_report(struct hid_device *hdev, struct hid_report *report);
H A Dhid-wiimote-debug.c188 dbg->wdata->hdev->debug_dir, dbg, &wiidebug_eeprom_fops); wiidebug_init()
193 dbg->wdata->hdev->debug_dir, dbg, &wiidebug_drm_fops); wiidebug_init()
H A Dhid-topseed.c29 static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi, ts_input_mapping() argument
H A Dhid-sensor-custom.c212 hid_err(sensor_inst->hsdev->hdev, set_power_report_state()
227 hid_err(sensor_inst->hsdev->hdev, set_power_report_state()
433 hid_err(sensor_inst->hsdev->hdev, "Skipped remaining data\n"); hid_sensor_capture_sample()
437 hid_dbg(sensor_inst->hsdev->hdev, "%s received %d of %d\n", __func__, hid_sensor_capture_sample()
573 struct hid_device *hdev = hsdev->hdev; hid_sensor_custom_add_attributes() local
582 &hdev->report_enum[j], j); hid_sensor_custom_add_attributes()
H A Dwacom_wac.c456 re = &(wacom->hdev->report_enum[HID_FEATURE_REPORT]); wacom_intuos_schedule_prox_event()
459 hid_hw_request(wacom->hdev, r, HID_REQ_GET_REPORT); wacom_intuos_schedule_prox_event()
1369 static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, wacom_wac_pen_usage_mapping() argument
1372 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_pen_usage_mapping()
1407 static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field, wacom_wac_pen_event() argument
1410 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_pen_event()
1437 static void wacom_wac_pen_report(struct hid_device *hdev, wacom_wac_pen_report() argument
1440 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_pen_report()
1465 static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, wacom_wac_finger_usage_mapping() argument
1468 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_finger_usage_mapping()
1533 static int wacom_wac_finger_event(struct hid_device *hdev, wacom_wac_finger_event() argument
1536 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_finger_event()
1563 static void wacom_wac_finger_report(struct hid_device *hdev, wacom_wac_finger_report() argument
1566 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_finger_report()
1580 void wacom_wac_usage_mapping(struct hid_device *hdev, wacom_wac_usage_mapping() argument
1583 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_usage_mapping()
1591 return wacom_wac_pen_usage_mapping(hdev, field, usage); wacom_wac_usage_mapping()
1594 return wacom_wac_finger_usage_mapping(hdev, field, usage); wacom_wac_usage_mapping()
1597 int wacom_wac_event(struct hid_device *hdev, struct hid_field *field, wacom_wac_event() argument
1600 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_event()
1606 return wacom_wac_pen_event(hdev, field, usage, value); wacom_wac_event()
1609 return wacom_wac_finger_event(hdev, field, usage, value); wacom_wac_event()
1614 void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) wacom_wac_report() argument
1616 struct wacom *wacom = hid_get_drvdata(hdev); wacom_wac_report()
1624 return wacom_wac_pen_report(hdev, report); wacom_wac_report()
1627 return wacom_wac_finger_report(hdev, report); wacom_wac_report()
H A Dhid-twinhan.c63 static int twinhan_input_mapping(struct hid_device *hdev, struct hid_input *hi, twinhan_input_mapping() argument
H A Dhid-waltop.c641 static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc, waltop_report_fixup() argument
644 switch (hdev->product) { waltop_report_fixup()
691 static int waltop_raw_event(struct hid_device *hdev, struct hid_report *report, waltop_raw_event() argument
710 if (hdev->product == USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET && waltop_raw_event()
H A Dhid-wiimote.h144 struct hid_device *hdev; member in struct:wiimote_data
/linux-4.1.27/drivers/bluetooth/
H A Dbpa10x.c50 struct hci_dev *hdev; member in struct:bpa10x_data
67 static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) bpa10x_recv() argument
69 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_recv()
71 BT_DBG("%s queue %d buffer %p count %d", hdev->name, bpa10x_recv()
77 hdev->stat.byte_rx += count; bpa10x_recv()
128 BT_ERR("%s no memory for packet", hdev->name); bpa10x_recv()
156 hci_recv_frame(hdev, skb); bpa10x_recv()
168 struct hci_dev *hdev = (struct hci_dev *) skb->dev; bpa10x_tx_complete() local
170 BT_DBG("%s urb %p status %d count %d", hdev->name, bpa10x_tx_complete()
173 if (!test_bit(HCI_RUNNING, &hdev->flags)) bpa10x_tx_complete()
177 hdev->stat.byte_tx += urb->transfer_buffer_length; bpa10x_tx_complete()
179 hdev->stat.err_tx++; bpa10x_tx_complete()
189 struct hci_dev *hdev = urb->context; bpa10x_rx_complete() local
190 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_rx_complete()
193 BT_DBG("%s urb %p status %d count %d", hdev->name, bpa10x_rx_complete()
196 if (!test_bit(HCI_RUNNING, &hdev->flags)) bpa10x_rx_complete()
200 if (bpa10x_recv(hdev, usb_pipebulk(urb->pipe), bpa10x_rx_complete()
203 BT_ERR("%s corrupted event packet", hdev->name); bpa10x_rx_complete()
204 hdev->stat.err_rx++; bpa10x_rx_complete()
213 hdev->name, urb, -err); bpa10x_rx_complete()
218 static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) bpa10x_submit_intr_urb() argument
220 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_submit_intr_urb()
226 BT_DBG("%s", hdev->name); bpa10x_submit_intr_urb()
241 bpa10x_rx_complete, hdev, 1); bpa10x_submit_intr_urb()
250 hdev->name, urb, -err); bpa10x_submit_intr_urb()
259 static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) bpa10x_submit_bulk_urb() argument
261 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_submit_bulk_urb()
267 BT_DBG("%s", hdev->name); bpa10x_submit_bulk_urb()
282 buf, size, bpa10x_rx_complete, hdev); bpa10x_submit_bulk_urb()
291 hdev->name, urb, -err); bpa10x_submit_bulk_urb()
300 static int bpa10x_open(struct hci_dev *hdev) bpa10x_open() argument
302 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_open()
305 BT_DBG("%s", hdev->name); bpa10x_open()
307 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) bpa10x_open()
310 err = bpa10x_submit_intr_urb(hdev); bpa10x_open()
314 err = bpa10x_submit_bulk_urb(hdev); bpa10x_open()
323 clear_bit(HCI_RUNNING, &hdev->flags); bpa10x_open()
328 static int bpa10x_close(struct hci_dev *hdev) bpa10x_close() argument
330 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_close()
332 BT_DBG("%s", hdev->name); bpa10x_close()
334 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) bpa10x_close()
342 static int bpa10x_flush(struct hci_dev *hdev) bpa10x_flush() argument
344 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_flush()
346 BT_DBG("%s", hdev->name); bpa10x_flush()
353 static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) bpa10x_send_frame() argument
355 struct bpa10x_data *data = hci_get_drvdata(hdev); bpa10x_send_frame()
361 BT_DBG("%s", hdev->name); bpa10x_send_frame()
363 if (!test_bit(HCI_RUNNING, &hdev->flags)) bpa10x_send_frame()
366 skb->dev = (void *) hdev; bpa10x_send_frame()
394 hdev->stat.cmd_tx++; bpa10x_send_frame()
403 hdev->stat.acl_tx++; bpa10x_send_frame()
412 hdev->stat.sco_tx++; bpa10x_send_frame()
424 BT_ERR("%s urb %p submission failed", hdev->name, urb); bpa10x_send_frame()
437 struct hci_dev *hdev; bpa10x_probe() local
454 hdev = hci_alloc_dev(); bpa10x_probe()
455 if (!hdev) bpa10x_probe()
458 hdev->bus = HCI_USB; bpa10x_probe()
459 hci_set_drvdata(hdev, data); bpa10x_probe()
461 data->hdev = hdev; bpa10x_probe()
463 SET_HCIDEV_DEV(hdev, &intf->dev); bpa10x_probe()
465 hdev->open = bpa10x_open; bpa10x_probe()
466 hdev->close = bpa10x_close; bpa10x_probe()
467 hdev->flush = bpa10x_flush; bpa10x_probe()
468 hdev->send = bpa10x_send_frame; bpa10x_probe()
470 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); bpa10x_probe()
472 err = hci_register_dev(hdev); bpa10x_probe()
474 hci_free_dev(hdev); bpa10x_probe()
494 hci_unregister_dev(data->hdev); bpa10x_disconnect()
496 hci_free_dev(data->hdev); bpa10x_disconnect()
H A Dbtsdio.c58 struct hci_dev *hdev; member in struct:btsdio_data
82 BT_DBG("%s", data->hdev->name); btsdio_tx_packet()
98 data->hdev->stat.byte_tx += skb->len; btsdio_tx_packet()
111 BT_DBG("%s", data->hdev->name); btsdio_work()
118 data->hdev->stat.err_tx++; btsdio_work()
133 BT_DBG("%s", data->hdev->name); btsdio_rx_packet()
159 data->hdev->stat.byte_rx += len; btsdio_rx_packet()
163 err = hci_recv_frame(data->hdev, skb); btsdio_rx_packet()
177 BT_DBG("%s", data->hdev->name); btsdio_interrupt()
184 data->hdev->stat.err_rx++; btsdio_interrupt()
190 static int btsdio_open(struct hci_dev *hdev) btsdio_open() argument
192 struct btsdio_data *data = hci_get_drvdata(hdev); btsdio_open()
195 BT_DBG("%s", hdev->name); btsdio_open()
197 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) btsdio_open()
204 clear_bit(HCI_RUNNING, &hdev->flags); btsdio_open()
211 clear_bit(HCI_RUNNING, &hdev->flags); btsdio_open()
226 static int btsdio_close(struct hci_dev *hdev) btsdio_close() argument
228 struct btsdio_data *data = hci_get_drvdata(hdev); btsdio_close()
230 BT_DBG("%s", hdev->name); btsdio_close()
232 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) btsdio_close()
247 static int btsdio_flush(struct hci_dev *hdev) btsdio_flush() argument
249 struct btsdio_data *data = hci_get_drvdata(hdev); btsdio_flush()
251 BT_DBG("%s", hdev->name); btsdio_flush()
258 static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb) btsdio_send_frame() argument
260 struct btsdio_data *data = hci_get_drvdata(hdev); btsdio_send_frame()
262 BT_DBG("%s", hdev->name); btsdio_send_frame()
264 if (!test_bit(HCI_RUNNING, &hdev->flags)) btsdio_send_frame()
269 hdev->stat.cmd_tx++; btsdio_send_frame()
273 hdev->stat.acl_tx++; btsdio_send_frame()
277 hdev->stat.sco_tx++; btsdio_send_frame()
295 struct hci_dev *hdev; btsdio_probe() local
316 hdev = hci_alloc_dev(); btsdio_probe()
317 if (!hdev) btsdio_probe()
320 hdev->bus = HCI_SDIO; btsdio_probe()
321 hci_set_drvdata(hdev, data); btsdio_probe()
324 hdev->dev_type = HCI_AMP; btsdio_probe()
326 hdev->dev_type = HCI_BREDR; btsdio_probe()
328 data->hdev = hdev; btsdio_probe()
330 SET_HCIDEV_DEV(hdev, &func->dev); btsdio_probe()
332 hdev->open = btsdio_open; btsdio_probe()
333 hdev->close = btsdio_close; btsdio_probe()
334 hdev->flush = btsdio_flush; btsdio_probe()
335 hdev->send = btsdio_send_frame; btsdio_probe()
338 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); btsdio_probe()
340 err = hci_register_dev(hdev); btsdio_probe()
342 hci_free_dev(hdev); btsdio_probe()
354 struct hci_dev *hdev; btsdio_remove() local
361 hdev = data->hdev; btsdio_remove()
365 hci_unregister_dev(hdev); btsdio_remove()
367 hci_free_dev(hdev); btsdio_remove()
H A Dbtbcm.c37 int btbcm_check_bdaddr(struct hci_dev *hdev) btbcm_check_bdaddr() argument
42 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL, btbcm_check_bdaddr()
47 hdev->name, err); btbcm_check_bdaddr()
52 BT_ERR("%s: BCM: Device address length mismatch", hdev->name); btbcm_check_bdaddr()
60 hdev->name, bda->status); btbcm_check_bdaddr()
70 hdev->name, &bda->bdaddr); btbcm_check_bdaddr()
71 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); btbcm_check_bdaddr()
80 int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) btbcm_set_bdaddr() argument
85 skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT); btbcm_set_bdaddr()
89 hdev->name, err); btbcm_set_bdaddr()
98 int btbcm_patchram(struct hci_dev *hdev, const char *firmware) btbcm_patchram() argument
108 err = request_firmware(&fw, firmware, &hdev->dev); btbcm_patchram()
110 BT_INFO("%s: BCM: Patch %s not found", hdev->name, firmware); btbcm_patchram()
115 skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT); btbcm_patchram()
119 hdev->name, err); btbcm_patchram()
138 BT_ERR("%s: BCM: Patch %s is corrupted", hdev->name, btbcm_patchram()
150 skb = __hci_cmd_sync(hdev, opcode, cmd->plen, cmd_param, btbcm_patchram()
155 hdev->name, opcode, err); btbcm_patchram()
170 static int btbcm_reset(struct hci_dev *hdev) btbcm_reset() argument
174 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); btbcm_reset()
177 BT_ERR("%s: BCM: Reset failed (%d)", hdev->name, err); btbcm_reset()
185 static struct sk_buff *btbcm_read_local_version(struct hci_dev *hdev) btbcm_read_local_version() argument
189 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, btbcm_read_local_version()
193 hdev->name, PTR_ERR(skb)); btbcm_read_local_version()
198 BT_ERR("%s: BCM: Local version length mismatch", hdev->name); btbcm_read_local_version()
206 static struct sk_buff *btbcm_read_verbose_config(struct hci_dev *hdev) btbcm_read_verbose_config() argument
210 skb = __hci_cmd_sync(hdev, 0xfc79, 0, NULL, HCI_INIT_TIMEOUT); btbcm_read_verbose_config()
213 hdev->name, PTR_ERR(skb)); btbcm_read_verbose_config()
218 BT_ERR("%s: BCM: Verbose config length mismatch", hdev->name); btbcm_read_verbose_config()
226 static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) btbcm_read_usb_product() argument
230 skb = __hci_cmd_sync(hdev, 0xfc5a, 0, NULL, HCI_INIT_TIMEOUT); btbcm_read_usb_product()
233 hdev->name, PTR_ERR(skb)); btbcm_read_usb_product()
238 BT_ERR("%s: BCM: USB product length mismatch", hdev->name); btbcm_read_usb_product()
271 int btbcm_setup_patchram(struct hci_dev *hdev) btbcm_setup_patchram() argument
281 err = btbcm_reset(hdev); btbcm_setup_patchram()
286 skb = btbcm_read_local_version(hdev); btbcm_setup_patchram()
296 skb = btbcm_read_verbose_config(hdev); btbcm_setup_patchram()
300 BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]); btbcm_setup_patchram()
318 skb = btbcm_read_usb_product(hdev); btbcm_setup_patchram()
340 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name, btbcm_setup_patchram()
344 err = btbcm_patchram(hdev, fw_name); btbcm_setup_patchram()
349 err = btbcm_reset(hdev); btbcm_setup_patchram()
354 skb = btbcm_read_local_version(hdev); btbcm_setup_patchram()
363 BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name, btbcm_setup_patchram()
367 btbcm_check_bdaddr(hdev); btbcm_setup_patchram()
369 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); btbcm_setup_patchram()
375 int btbcm_setup_apple(struct hci_dev *hdev) btbcm_setup_apple() argument
380 skb = btbcm_read_verbose_config(hdev); btbcm_setup_apple()
382 BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name, skb->data[1], btbcm_setup_apple()
387 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); btbcm_setup_apple()
H A Dbtwilink.c45 * @hdev: hci device pointer which binds to bt driver
53 struct hci_dev *hdev; member in struct:ti_st
62 struct hci_dev *hdev = hst->hdev; ti_st_tx_complete() local
67 hdev->stat.cmd_tx++; ti_st_tx_complete()
71 hdev->stat.acl_tx++; ti_st_tx_complete()
75 hdev->stat.sco_tx++; ti_st_tx_complete()
112 err = hci_recv_frame(lhst->hdev, skb); st_receive()
118 lhst->hdev->stat.byte_rx += skb->len; st_receive()
150 static int ti_st_open(struct hci_dev *hdev) ti_st_open() argument
156 BT_DBG("%s %p", hdev->name, hdev); ti_st_open()
158 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) ti_st_open()
162 hst = hci_get_drvdata(hdev); ti_st_open()
184 clear_bit(HCI_RUNNING, &hdev->flags); ti_st_open()
198 clear_bit(HCI_RUNNING, &hdev->flags); ti_st_open()
208 clear_bit(HCI_RUNNING, &hdev->flags); ti_st_open()
218 clear_bit(HCI_RUNNING, &hdev->flags); ti_st_open()
234 static int ti_st_close(struct hci_dev *hdev) ti_st_close() argument
237 struct ti_st *hst = hci_get_drvdata(hdev); ti_st_close()
239 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) ti_st_close()
254 static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ti_st_send_frame() argument
259 if (!test_bit(HCI_RUNNING, &hdev->flags)) ti_st_send_frame()
262 hst = hci_get_drvdata(hdev); ti_st_send_frame()
267 BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, ti_st_send_frame()
283 hdev->stat.byte_tx += len; ti_st_send_frame()
292 struct hci_dev *hdev; bt_ti_probe() local
300 hdev = hci_alloc_dev(); bt_ti_probe()
301 if (!hdev) bt_ti_probe()
304 BT_DBG("hdev %p", hdev); bt_ti_probe()
306 hst->hdev = hdev; bt_ti_probe()
307 hdev->bus = HCI_UART; bt_ti_probe()
308 hci_set_drvdata(hdev, hst); bt_ti_probe()
309 hdev->open = ti_st_open; bt_ti_probe()
310 hdev->close = ti_st_close; bt_ti_probe()
311 hdev->flush = NULL; bt_ti_probe()
312 hdev->send = ti_st_send_frame; bt_ti_probe()
314 err = hci_register_dev(hdev); bt_ti_probe()
317 hci_free_dev(hdev); bt_ti_probe()
321 BT_DBG("HCI device registered (hdev %p)", hdev); bt_ti_probe()
329 struct hci_dev *hdev; bt_ti_remove() local
335 BT_DBG("%s", hst->hdev->name); bt_ti_remove()
337 hdev = hst->hdev; bt_ti_remove()
338 ti_st_close(hdev); bt_ti_remove()
339 hci_unregister_dev(hdev); bt_ti_remove()
341 hci_free_dev(hdev); bt_ti_remove()
H A Dhci_vhci.c48 struct hci_dev *hdev; member in struct:vhci_data
57 static int vhci_open_dev(struct hci_dev *hdev) vhci_open_dev() argument
59 set_bit(HCI_RUNNING, &hdev->flags); vhci_open_dev()
64 static int vhci_close_dev(struct hci_dev *hdev) vhci_close_dev() argument
66 struct vhci_data *data = hci_get_drvdata(hdev); vhci_close_dev()
68 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) vhci_close_dev()
76 static int vhci_flush(struct hci_dev *hdev) vhci_flush() argument
78 struct vhci_data *data = hci_get_drvdata(hdev); vhci_flush()
85 static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) vhci_send_frame() argument
87 struct vhci_data *data = hci_get_drvdata(hdev); vhci_send_frame()
89 if (!test_bit(HCI_RUNNING, &hdev->flags)) vhci_send_frame()
101 struct hci_dev *hdev; __vhci_create_device() local
105 if (data->hdev) __vhci_create_device()
122 hdev = hci_alloc_dev(); __vhci_create_device()
123 if (!hdev) { __vhci_create_device()
128 data->hdev = hdev; __vhci_create_device()
130 hdev->bus = HCI_VIRTUAL; __vhci_create_device()
131 hdev->dev_type = dev_type; __vhci_create_device()
132 hci_set_drvdata(hdev, data); __vhci_create_device()
134 hdev->open = vhci_open_dev; __vhci_create_device()
135 hdev->close = vhci_close_dev; __vhci_create_device()
136 hdev->flush = vhci_flush; __vhci_create_device()
137 hdev->send = vhci_send_frame; __vhci_create_device()
141 set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks); __vhci_create_device()
145 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); __vhci_create_device()
147 if (hci_register_dev(hdev) < 0) { __vhci_create_device()
149 hci_free_dev(hdev); __vhci_create_device()
150 data->hdev = NULL; __vhci_create_device()
159 put_unaligned_le16(hdev->id, skb_put(skb, 2)); __vhci_create_device()
204 if (!data->hdev) { vhci_get_user()
211 ret = hci_recv_frame(data->hdev, skb); vhci_get_user()
250 if (!data->hdev) vhci_put_user()
253 data->hdev->stat.byte_tx += len; vhci_put_user()
257 data->hdev->stat.cmd_tx++; vhci_put_user()
260 data->hdev->stat.acl_tx++; vhci_put_user()
263 data->hdev->stat.sco_tx++; vhci_put_user()
355 struct hci_dev *hdev; vhci_release() local
359 hdev = data->hdev; vhci_release()
361 if (hdev) { vhci_release()
362 hci_unregister_dev(hdev); vhci_release()
363 hci_free_dev(hdev); vhci_release()
H A Dbtbcm.h26 int btbcm_check_bdaddr(struct hci_dev *hdev);
27 int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
28 int btbcm_patchram(struct hci_dev *hdev, const char *firmware);
30 int btbcm_setup_patchram(struct hci_dev *hdev);
31 int btbcm_setup_apple(struct hci_dev *hdev);
35 static inline int btbcm_check_bdaddr(struct hci_dev *hdev) btbcm_check_bdaddr() argument
40 static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) btbcm_set_bdaddr() argument
45 static inline int btbcm_patchram(struct hci_dev *hdev, const char *firmware) btbcm_patchram() argument
50 static inline int btbcm_setup_patchram(struct hci_dev *hdev) btbcm_setup_patchram() argument
55 static inline int btbcm_setup_apple(struct hci_dev *hdev) btbcm_setup_apple() argument
H A Dhci_ldisc.c93 struct hci_dev *hdev = hu->hdev; hci_uart_tx_complete() local
98 hdev->stat.cmd_tx++; hci_uart_tx_complete()
102 hdev->stat.acl_tx++; hci_uart_tx_complete()
106 hdev->stat.sco_tx++; hci_uart_tx_complete()
141 struct hci_dev *hdev = hu->hdev; hci_uart_write_work() local
156 hdev->stat.byte_tx += len; hci_uart_write_work()
182 err = hci_register_dev(hu->hdev); hci_uart_init_work()
185 hci_free_dev(hu->hdev); hci_uart_init_work()
186 hu->hdev = NULL; hci_uart_init_work()
205 static int hci_uart_open(struct hci_dev *hdev) hci_uart_open() argument
207 BT_DBG("%s %p", hdev->name, hdev); hci_uart_open()
211 set_bit(HCI_RUNNING, &hdev->flags); hci_uart_open()
217 static int hci_uart_flush(struct hci_dev *hdev) hci_uart_flush() argument
219 struct hci_uart *hu = hci_get_drvdata(hdev); hci_uart_flush()
222 BT_DBG("hdev %p tty %p", hdev, tty); hci_uart_flush()
239 static int hci_uart_close(struct hci_dev *hdev) hci_uart_close() argument
241 BT_DBG("hdev %p", hdev); hci_uart_close()
243 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) hci_uart_close()
246 hci_uart_flush(hdev); hci_uart_close()
247 hdev->flush = NULL; hci_uart_close()
252 static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) hci_uart_send_frame() argument
254 struct hci_uart *hu = hci_get_drvdata(hdev); hci_uart_send_frame()
256 if (!test_bit(HCI_RUNNING, &hdev->flags)) hci_uart_send_frame()
259 BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); hci_uart_send_frame()
268 static int hci_uart_setup(struct hci_dev *hdev) hci_uart_setup() argument
270 struct hci_uart *hu = hci_get_drvdata(hdev); hci_uart_setup()
280 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, hci_uart_setup()
284 hdev->name, PTR_ERR(skb)); hci_uart_setup()
290 hdev->name); hci_uart_setup()
299 hdev->set_bdaddr = btintel_set_bdaddr; hci_uart_setup()
300 btintel_check_bdaddr(hdev); hci_uart_setup()
305 hdev->set_bdaddr = btbcm_set_bdaddr; hci_uart_setup()
306 btbcm_check_bdaddr(hdev); hci_uart_setup()
372 struct hci_dev *hdev; hci_uart_tty_close() local
382 hdev = hu->hdev; hci_uart_tty_close()
383 if (hdev) hci_uart_tty_close()
384 hci_uart_close(hdev); hci_uart_tty_close()
389 if (hdev) { hci_uart_tty_close()
391 hci_unregister_dev(hdev); hci_uart_tty_close()
392 hci_free_dev(hdev); hci_uart_tty_close()
452 if (hu->hdev) hci_uart_tty_receive()
453 hu->hdev->stat.byte_rx += count; hci_uart_tty_receive()
462 struct hci_dev *hdev; hci_uart_register_dev() local
467 hdev = hci_alloc_dev(); hci_uart_register_dev()
468 if (!hdev) { hci_uart_register_dev()
473 hu->hdev = hdev; hci_uart_register_dev()
475 hdev->bus = HCI_UART; hci_uart_register_dev()
476 hci_set_drvdata(hdev, hu); hci_uart_register_dev()
478 hdev->open = hci_uart_open; hci_uart_register_dev()
479 hdev->close = hci_uart_close; hci_uart_register_dev()
480 hdev->flush = hci_uart_flush; hci_uart_register_dev()
481 hdev->send = hci_uart_send_frame; hci_uart_register_dev()
482 hdev->setup = hci_uart_setup; hci_uart_register_dev()
483 SET_HCIDEV_DEV(hdev, hu->tty->dev); hci_uart_register_dev()
486 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); hci_uart_register_dev()
489 set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks); hci_uart_register_dev()
492 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); hci_uart_register_dev()
495 hdev->dev_type = HCI_AMP; hci_uart_register_dev()
497 hdev->dev_type = HCI_BREDR; hci_uart_register_dev()
502 if (hci_register_dev(hdev) < 0) { hci_uart_register_dev()
504 hci_free_dev(hdev); hci_uart_register_dev()
598 return hu->hdev->id; hci_uart_tty_ioctl()
H A Dbtusb.c348 struct hci_dev *hdev; member in struct:btusb_data
385 int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
388 int (*setup_on_usb)(struct hci_dev *hdev);
453 data->recv_event(data->hdev, skb); btusb_recv_intr()
510 hci_recv_frame(data->hdev, skb); btusb_recv_bulk()
565 hci_recv_frame(data->hdev, skb); btusb_recv_isoc()
578 struct hci_dev *hdev = urb->context; btusb_intr_complete() local
579 struct btusb_data *data = hci_get_drvdata(hdev); btusb_intr_complete()
582 BT_DBG("%s urb %p status %d count %d", hdev->name, urb, urb->status, btusb_intr_complete()
585 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_intr_complete()
589 hdev->stat.byte_rx += urb->actual_length; btusb_intr_complete()
593 BT_ERR("%s corrupted event packet", hdev->name); btusb_intr_complete()
594 hdev->stat.err_rx++; btusb_intr_complete()
613 hdev->name, urb, -err); btusb_intr_complete()
618 static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) btusb_submit_intr_urb() argument
620 struct btusb_data *data = hci_get_drvdata(hdev); btusb_submit_intr_urb()
626 BT_DBG("%s", hdev->name); btusb_submit_intr_urb()
646 btusb_intr_complete, hdev, data->intr_ep->bInterval); btusb_submit_intr_urb()
656 hdev->name, urb, -err); btusb_submit_intr_urb()
667 struct hci_dev *hdev = urb->context; btusb_bulk_complete() local
668 struct btusb_data *data = hci_get_drvdata(hdev); btusb_bulk_complete()
671 BT_DBG("%s urb %p status %d count %d", hdev->name, urb, urb->status, btusb_bulk_complete()
674 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_bulk_complete()
678 hdev->stat.byte_rx += urb->actual_length; btusb_bulk_complete()
682 BT_ERR("%s corrupted ACL packet", hdev->name); btusb_bulk_complete()
683 hdev->stat.err_rx++; btusb_bulk_complete()
702 hdev->name, urb, -err); btusb_bulk_complete()
707 static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) btusb_submit_bulk_urb() argument
709 struct btusb_data *data = hci_get_drvdata(hdev); btusb_submit_bulk_urb()
715 BT_DBG("%s", hdev->name); btusb_submit_bulk_urb()
733 btusb_bulk_complete, hdev); btusb_submit_bulk_urb()
744 hdev->name, urb, -err); btusb_submit_bulk_urb()
755 struct hci_dev *hdev = urb->context; btusb_isoc_complete() local
756 struct btusb_data *data = hci_get_drvdata(hdev); btusb_isoc_complete()
759 BT_DBG("%s urb %p status %d count %d", hdev->name, urb, urb->status, btusb_isoc_complete()
762 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_isoc_complete()
773 hdev->stat.byte_rx += length; btusb_isoc_complete()
777 BT_ERR("%s corrupted SCO packet", hdev->name); btusb_isoc_complete()
778 hdev->stat.err_rx++; btusb_isoc_complete()
797 hdev->name, urb, -err); btusb_isoc_complete()
823 static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) btusb_submit_isoc_urb() argument
825 struct btusb_data *data = hci_get_drvdata(hdev); btusb_submit_isoc_urb()
831 BT_DBG("%s", hdev->name); btusb_submit_isoc_urb()
852 hdev, data->isoc_rx_ep->bInterval); btusb_submit_isoc_urb()
865 hdev->name, urb, -err); btusb_submit_isoc_urb()
877 struct hci_dev *hdev = (struct hci_dev *)skb->dev; btusb_tx_complete() local
878 struct btusb_data *data = hci_get_drvdata(hdev); btusb_tx_complete()
880 BT_DBG("%s urb %p status %d count %d", hdev->name, urb, urb->status, btusb_tx_complete()
883 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_tx_complete()
887 hdev->stat.byte_tx += urb->transfer_buffer_length; btusb_tx_complete()
889 hdev->stat.err_tx++; btusb_tx_complete()
904 struct hci_dev *hdev = (struct hci_dev *)skb->dev; btusb_isoc_tx_complete() local
906 BT_DBG("%s urb %p status %d count %d", hdev->name, urb, urb->status, btusb_isoc_tx_complete()
909 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_isoc_tx_complete()
913 hdev->stat.byte_tx += urb->transfer_buffer_length; btusb_isoc_tx_complete()
915 hdev->stat.err_tx++; btusb_isoc_tx_complete()
923 static int btusb_open(struct hci_dev *hdev) btusb_open() argument
925 struct btusb_data *data = hci_get_drvdata(hdev); btusb_open()
928 BT_DBG("%s", hdev->name); btusb_open()
934 err = data->setup_on_usb(hdev); btusb_open()
945 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) btusb_open()
951 err = btusb_submit_intr_urb(hdev, GFP_KERNEL); btusb_open()
955 err = btusb_submit_bulk_urb(hdev, GFP_KERNEL); btusb_open()
962 btusb_submit_bulk_urb(hdev, GFP_KERNEL); btusb_open()
970 clear_bit(HCI_RUNNING, &hdev->flags); btusb_open()
982 static int btusb_close(struct hci_dev *hdev) btusb_close() argument
984 struct btusb_data *data = hci_get_drvdata(hdev); btusb_close()
987 BT_DBG("%s", hdev->name); btusb_close()
989 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) btusb_close()
1014 static int btusb_flush(struct hci_dev *hdev) btusb_flush() argument
1016 struct btusb_data *data = hci_get_drvdata(hdev); btusb_flush()
1018 BT_DBG("%s", hdev->name); btusb_flush()
1026 static struct urb *alloc_ctrl_urb(struct hci_dev *hdev, struct sk_buff *skb) alloc_ctrl_urb() argument
1028 struct btusb_data *data = hci_get_drvdata(hdev); alloc_ctrl_urb()
1054 skb->dev = (void *)hdev; alloc_ctrl_urb()
1059 static struct urb *alloc_bulk_urb(struct hci_dev *hdev, struct sk_buff *skb) alloc_bulk_urb() argument
1061 struct btusb_data *data = hci_get_drvdata(hdev); alloc_bulk_urb()
1077 skb->dev = (void *)hdev; alloc_bulk_urb()
1082 static struct urb *alloc_isoc_urb(struct hci_dev *hdev, struct sk_buff *skb) alloc_isoc_urb() argument
1084 struct btusb_data *data = hci_get_drvdata(hdev); alloc_isoc_urb()
1106 skb->dev = (void *)hdev; alloc_isoc_urb()
1111 static int submit_tx_urb(struct hci_dev *hdev, struct urb *urb) submit_tx_urb() argument
1113 struct btusb_data *data = hci_get_drvdata(hdev); submit_tx_urb()
1122 hdev->name, urb, -err); submit_tx_urb()
1133 static int submit_or_queue_tx_urb(struct hci_dev *hdev, struct urb *urb) submit_or_queue_tx_urb() argument
1135 struct btusb_data *data = hci_get_drvdata(hdev); submit_or_queue_tx_urb()
1146 return submit_tx_urb(hdev, urb); submit_or_queue_tx_urb()
1155 static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) btusb_send_frame() argument
1159 BT_DBG("%s", hdev->name); btusb_send_frame()
1161 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_send_frame()
1166 urb = alloc_ctrl_urb(hdev, skb); btusb_send_frame()
1170 hdev->stat.cmd_tx++; btusb_send_frame()
1171 return submit_or_queue_tx_urb(hdev, urb); btusb_send_frame()
1174 urb = alloc_bulk_urb(hdev, skb); btusb_send_frame()
1178 hdev->stat.acl_tx++; btusb_send_frame()
1179 return submit_or_queue_tx_urb(hdev, urb); btusb_send_frame()
1182 if (hci_conn_num(hdev, SCO_LINK) < 1) btusb_send_frame()
1185 urb = alloc_isoc_urb(hdev, skb); btusb_send_frame()
1189 hdev->stat.sco_tx++; btusb_send_frame()
1190 return submit_tx_urb(hdev, urb); btusb_send_frame()
1196 static void btusb_notify(struct hci_dev *hdev, unsigned int evt) btusb_notify() argument
1198 struct btusb_data *data = hci_get_drvdata(hdev); btusb_notify()
1200 BT_DBG("%s evt %d", hdev->name, evt); btusb_notify()
1202 if (hci_conn_num(hdev, SCO_LINK) != data->sco_num) { btusb_notify()
1203 data->sco_num = hci_conn_num(hdev, SCO_LINK); btusb_notify()
1208 static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) __set_isoc_interface() argument
1210 struct btusb_data *data = hci_get_drvdata(hdev); __set_isoc_interface()
1220 BT_ERR("%s setting interface failed (%d)", hdev->name, -err); __set_isoc_interface()
1244 BT_ERR("%s invalid SCO descriptors", hdev->name); __set_isoc_interface()
1254 struct hci_dev *hdev = data->hdev; btusb_work() local
1270 if (hdev->voice_setting & 0x0020) { btusb_work()
1282 if (__set_isoc_interface(hdev, new_alts) < 0) btusb_work()
1287 if (btusb_submit_isoc_urb(hdev, GFP_KERNEL) < 0) btusb_work()
1290 btusb_submit_isoc_urb(hdev, GFP_KERNEL); btusb_work()
1296 __set_isoc_interface(hdev, 0); btusb_work()
1314 static struct sk_buff *btusb_read_local_version(struct hci_dev *hdev) btusb_read_local_version() argument
1318 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, btusb_read_local_version()
1322 hdev->name, PTR_ERR(skb)); btusb_read_local_version()
1328 hdev->name); btusb_read_local_version()
1336 static int btusb_setup_bcm92035(struct hci_dev *hdev) btusb_setup_bcm92035() argument
1341 BT_DBG("%s", hdev->name); btusb_setup_bcm92035()
1343 skb = __hci_cmd_sync(hdev, 0xfc3b, 1, &val, HCI_INIT_TIMEOUT); btusb_setup_bcm92035()
1352 static int btusb_setup_csr(struct hci_dev *hdev) btusb_setup_csr() argument
1358 BT_DBG("%s", hdev->name); btusb_setup_csr()
1360 skb = btusb_read_local_version(hdev); btusb_setup_csr()
1371 clear_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); btusb_setup_csr()
1377 &hdev->quirks); btusb_setup_csr()
1418 static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version) rtl_read_rom_version() argument
1425 skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT); rtl_read_rom_version()
1428 hdev->name, PTR_ERR(skb)); rtl_read_rom_version()
1433 BT_ERR("%s: RTL version event length mismatch", hdev->name); rtl_read_rom_version()
1440 hdev->name, rom_version->status, rom_version->version); rtl_read_rom_version()
1450 static int rtl8723b_parse_firmware(struct hci_dev *hdev, u16 lmp_subver, rtl8723b_parse_firmware() argument
1472 ret = rtl_read_rom_version(hdev, &rom_version); rtl8723b_parse_firmware()
1482 BT_ERR("%s: extension section signature mismatch", hdev->name); rtl8723b_parse_firmware()
1504 hdev->name); rtl8723b_parse_firmware()
1517 BT_ERR("%s: failed to find version instruction", hdev->name); rtl8723b_parse_firmware()
1522 BT_ERR("%s: unknown project id %d", hdev->name, project_id); rtl8723b_parse_firmware()
1527 BT_ERR("%s: firmware is for %x but this is a %x", hdev->name, rtl8723b_parse_firmware()
1534 BT_ERR("%s: bad EPATCH signature", hdev->name); rtl8723b_parse_firmware()
1569 hdev->name, rom_version); rtl8723b_parse_firmware()
1592 static int rtl_download_firmware(struct hci_dev *hdev, rtl_download_firmware() argument
1619 skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd, rtl_download_firmware()
1623 hdev->name, PTR_ERR(skb)); rtl_download_firmware()
1630 hdev->name); rtl_download_firmware()
1652 static int btusb_setup_rtl8723a(struct hci_dev *hdev) btusb_setup_rtl8723a() argument
1654 struct btusb_data *data = dev_get_drvdata(&hdev->dev); btusb_setup_rtl8723a()
1659 BT_INFO("%s: rtl: loading rtl_bt/rtl8723a_fw.bin", hdev->name); btusb_setup_rtl8723a()
1662 BT_ERR("%s: Failed to load rtl_bt/rtl8723a_fw.bin", hdev->name); btusb_setup_rtl8723a()
1675 BT_ERR("%s: unexpected EPATCH signature!", hdev->name); btusb_setup_rtl8723a()
1680 ret = rtl_download_firmware(hdev, fw->data, fw->size); btusb_setup_rtl8723a()
1687 static int btusb_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver, btusb_setup_rtl8723b() argument
1690 struct btusb_data *data = dev_get_drvdata(&hdev->dev); btusb_setup_rtl8723b()
1696 BT_INFO("%s: rtl: loading %s", hdev->name, fw_name); btusb_setup_rtl8723b()
1699 BT_ERR("%s: Failed to load %s", hdev->name, fw_name); btusb_setup_rtl8723b()
1703 ret = rtl8723b_parse_firmware(hdev, lmp_subver, fw, &fw_data); btusb_setup_rtl8723b()
1707 ret = rtl_download_firmware(hdev, fw_data, ret); btusb_setup_rtl8723b()
1717 static int btusb_setup_realtek(struct hci_dev *hdev) btusb_setup_realtek() argument
1723 skb = btusb_read_local_version(hdev); btusb_setup_realtek()
1729 "lmp_subver=%04x", hdev->name, resp->hci_ver, resp->hci_rev, btusb_setup_realtek()
1744 return btusb_setup_rtl8723a(hdev); btusb_setup_realtek()
1746 return btusb_setup_rtl8723b(hdev, lmp_subver, btusb_setup_realtek()
1749 return btusb_setup_rtl8723b(hdev, lmp_subver, btusb_setup_realtek()
1752 return btusb_setup_rtl8723b(hdev, lmp_subver, btusb_setup_realtek()
1760 static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, btusb_setup_intel_get_fw() argument
1773 ret = request_firmware(&fw, fwname, &hdev->dev); btusb_setup_intel_get_fw()
1777 hdev->name, ret); btusb_setup_intel_get_fw()
1782 hdev->name, fwname, ret); btusb_setup_intel_get_fw()
1789 if (request_firmware(&fw, fwname, &hdev->dev) < 0) { btusb_setup_intel_get_fw()
1791 hdev->name, fwname); btusb_setup_intel_get_fw()
1796 BT_INFO("%s: Intel Bluetooth firmware file: %s", hdev->name, fwname); btusb_setup_intel_get_fw()
1801 static int btusb_setup_intel_patching(struct hci_dev *hdev, btusb_setup_intel_patching() argument
1820 BT_ERR("%s Intel fw corrupted: invalid cmd read", hdev->name); btusb_setup_intel_patching()
1834 BT_ERR("%s Intel fw corrupted: invalid cmd len", hdev->name); btusb_setup_intel_patching()
1868 hdev->name); btusb_setup_intel_patching()
1882 BT_ERR("%s Intel fw corrupted: invalid evt read", hdev->name); btusb_setup_intel_patching()
1886 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, btusb_setup_intel_patching()
1890 hdev->name, cmd->opcode, PTR_ERR(skb)); btusb_setup_intel_patching()
1899 BT_ERR("%s mismatch event length (opcode 0x%4.4x)", hdev->name, btusb_setup_intel_patching()
1907 hdev->name, le16_to_cpu(cmd->opcode)); btusb_setup_intel_patching()
1916 static int btusb_setup_intel(struct hci_dev *hdev) btusb_setup_intel() argument
1929 BT_DBG("%s", hdev->name); btusb_setup_intel()
1939 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); btusb_setup_intel()
1942 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
1953 skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT); btusb_setup_intel()
1956 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
1961 BT_ERR("%s Intel version event length mismatch", hdev->name); btusb_setup_intel()
1968 BT_ERR("%s Intel fw version event failed (%02x)", hdev->name, btusb_setup_intel()
1975 hdev->name, ver->hw_platform, ver->hw_variant, btusb_setup_intel()
1986 hdev->name, ver->fw_patch_num); btusb_setup_intel()
1988 btintel_check_bdaddr(hdev); btusb_setup_intel()
1998 fw = btusb_setup_intel_get_fw(hdev, ver); btusb_setup_intel()
2001 btintel_check_bdaddr(hdev); btusb_setup_intel()
2014 skb = __hci_cmd_sync(hdev, 0xfc11, 2, mfg_enable, HCI_INIT_TIMEOUT); btusb_setup_intel()
2017 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
2026 hdev->name, evt_status); btusb_setup_intel()
2058 ret = btusb_setup_intel_patching(hdev, fw, &fw_ptr, btusb_setup_intel()
2072 skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_reset_activate), btusb_setup_intel()
2076 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
2082 hdev->name); btusb_setup_intel()
2084 btintel_check_bdaddr(hdev); btusb_setup_intel()
2089 skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_disable), mfg_disable, btusb_setup_intel()
2093 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
2098 BT_INFO("%s: Intel Bluetooth firmware patch completed", hdev->name); btusb_setup_intel()
2100 btintel_check_bdaddr(hdev); btusb_setup_intel()
2109 skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_reset_deactivate), btusb_setup_intel()
2113 hdev->name, PTR_ERR(skb)); btusb_setup_intel()
2119 hdev->name); btusb_setup_intel()
2121 btintel_check_bdaddr(hdev); btusb_setup_intel()
2125 static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) inject_cmd_complete() argument
2147 return hci_recv_frame(hdev, skb); inject_cmd_complete()
2195 static int btusb_recv_event_intel(struct hci_dev *hdev, struct sk_buff *skb) btusb_recv_event_intel() argument
2197 struct btusb_data *data = hci_get_drvdata(hdev); btusb_recv_event_intel()
2227 return hci_recv_frame(hdev, skb); btusb_recv_event_intel()
2230 static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb) btusb_send_frame_intel() argument
2232 struct btusb_data *data = hci_get_drvdata(hdev); btusb_send_frame_intel()
2235 BT_DBG("%s", hdev->name); btusb_send_frame_intel()
2237 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_send_frame_intel()
2251 urb = alloc_bulk_urb(hdev, skb); btusb_send_frame_intel()
2253 urb = alloc_ctrl_urb(hdev, skb); btusb_send_frame_intel()
2261 inject_cmd_complete(hdev, opcode); btusb_send_frame_intel()
2263 urb = alloc_ctrl_urb(hdev, skb); btusb_send_frame_intel()
2268 hdev->stat.cmd_tx++; btusb_send_frame_intel()
2269 return submit_or_queue_tx_urb(hdev, urb); btusb_send_frame_intel()
2272 urb = alloc_bulk_urb(hdev, skb); btusb_send_frame_intel()
2276 hdev->stat.acl_tx++; btusb_send_frame_intel()
2277 return submit_or_queue_tx_urb(hdev, urb); btusb_send_frame_intel()
2280 if (hci_conn_num(hdev, SCO_LINK) < 1) btusb_send_frame_intel()
2283 urb = alloc_isoc_urb(hdev, skb); btusb_send_frame_intel()
2287 hdev->stat.sco_tx++; btusb_send_frame_intel()
2288 return submit_tx_urb(hdev, urb); btusb_send_frame_intel()
2294 static int btusb_intel_secure_send(struct hci_dev *hdev, u8 fragment_type, btusb_intel_secure_send() argument
2304 skb = __hci_cmd_sync(hdev, 0xfc09, fragment_len + 1, btusb_intel_secure_send()
2318 static void btusb_intel_version_info(struct hci_dev *hdev, btusb_intel_version_info() argument
2334 BT_INFO("%s: %s revision %u.%u build %u week %u %u", hdev->name, btusb_intel_version_info()
2339 static int btusb_setup_intel_new(struct hci_dev *hdev) btusb_setup_intel_new() argument
2343 struct btusb_data *data = hci_get_drvdata(hdev); btusb_setup_intel_new()
2355 BT_DBG("%s", hdev->name); btusb_setup_intel_new()
2363 skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT); btusb_setup_intel_new()
2366 hdev->name, PTR_ERR(skb)); btusb_setup_intel_new()
2371 BT_ERR("%s: Intel version event size mismatch", hdev->name); btusb_setup_intel_new()
2379 hdev->name, ver->status); btusb_setup_intel_new()
2390 hdev->name, ver->hw_platform); btusb_setup_intel_new()
2402 hdev->name, ver->hw_variant); btusb_setup_intel_new()
2407 btusb_intel_version_info(hdev, ver); btusb_setup_intel_new()
2425 btintel_check_bdaddr(hdev); btusb_setup_intel_new()
2434 hdev->name, ver->fw_variant); btusb_setup_intel_new()
2444 skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_INIT_TIMEOUT); btusb_setup_intel_new()
2447 hdev->name, PTR_ERR(skb)); btusb_setup_intel_new()
2452 BT_ERR("%s: Intel boot parameters size mismatch", hdev->name); btusb_setup_intel_new()
2460 hdev->name, params->status); btusb_setup_intel_new()
2466 BT_INFO("%s: Device revision is %u", hdev->name, btusb_setup_intel_new()
2469 BT_INFO("%s: Secure boot is %s", hdev->name, btusb_setup_intel_new()
2472 BT_INFO("%s: Minimum firmware build %u week %u %u", hdev->name, btusb_setup_intel_new()
2482 hdev->name, params->limited_cce); btusb_setup_intel_new()
2491 BT_INFO("%s: No device address configured", hdev->name); btusb_setup_intel_new()
2492 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); btusb_setup_intel_new()
2504 err = request_firmware(&fw, fwname, &hdev->dev); btusb_setup_intel_new()
2507 hdev->name, err); btusb_setup_intel_new()
2512 BT_INFO("%s: Found device firmware: %s", hdev->name, fwname); btusb_setup_intel_new()
2518 hdev->name, fw->size); btusb_setup_intel_new()
2528 err = btusb_intel_secure_send(hdev, 0x00, 128, fw->data); btusb_setup_intel_new()
2531 hdev->name, err); btusb_setup_intel_new()
2538 err = btusb_intel_secure_send(hdev, 0x03, 256, fw->data + 128); btusb_setup_intel_new()
2541 hdev->name, err); btusb_setup_intel_new()
2548 err = btusb_intel_secure_send(hdev, 0x02, 256, fw->data + 388); btusb_setup_intel_new()
2551 hdev->name, err); btusb_setup_intel_new()
2572 err = btusb_intel_secure_send(hdev, 0x01, frag_len, btusb_setup_intel_new()
2576 hdev->name, err); btusb_setup_intel_new()
2587 BT_INFO("%s: Waiting for firmware download to complete", hdev->name); btusb_setup_intel_new()
2604 BT_ERR("%s: Firmware loading interrupted", hdev->name); btusb_setup_intel_new()
2610 BT_ERR("%s: Firmware loading timeout", hdev->name); btusb_setup_intel_new()
2616 BT_ERR("%s: Firmware loading failed", hdev->name); btusb_setup_intel_new()
2625 BT_INFO("%s: Firmware loaded in %llu usecs", hdev->name, duration); btusb_setup_intel_new()
2637 skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param, btusb_setup_intel_new()
2651 BT_INFO("%s: Waiting for device to boot", hdev->name); btusb_setup_intel_new()
2658 BT_ERR("%s: Device boot interrupted", hdev->name); btusb_setup_intel_new()
2663 BT_ERR("%s: Device boot timeout", hdev->name); btusb_setup_intel_new()
2671 BT_INFO("%s: Device booted in %llu usecs", hdev->name, duration); btusb_setup_intel_new()
2678 static void btusb_hw_error_intel(struct hci_dev *hdev, u8 code) btusb_hw_error_intel() argument
2683 BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code); btusb_hw_error_intel()
2685 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); btusb_hw_error_intel()
2688 hdev->name, PTR_ERR(skb)); btusb_hw_error_intel()
2693 skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT); btusb_hw_error_intel()
2696 hdev->name, PTR_ERR(skb)); btusb_hw_error_intel()
2701 BT_ERR("%s: Exception info size mismatch", hdev->name); btusb_hw_error_intel()
2708 hdev->name, skb->data[0]); btusb_hw_error_intel()
2713 BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1)); btusb_hw_error_intel()
2718 static int btusb_shutdown_intel(struct hci_dev *hdev) btusb_shutdown_intel() argument
2727 skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT); btusb_shutdown_intel()
2731 hdev->name, ret); btusb_shutdown_intel()
2739 static int btusb_set_bdaddr_marvell(struct hci_dev *hdev, btusb_set_bdaddr_marvell() argument
2750 skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(buf), buf, HCI_INIT_TIMEOUT); btusb_set_bdaddr_marvell()
2754 hdev->name, ret); btusb_set_bdaddr_marvell()
2762 static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev, btusb_set_bdaddr_ath3012() argument
2775 skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT); btusb_set_bdaddr_ath3012()
2779 hdev->name, ret); btusb_set_bdaddr_ath3012()
2825 static int btusb_qca_send_vendor_req(struct hci_dev *hdev, u8 request, btusb_qca_send_vendor_req() argument
2828 struct btusb_data *btdata = hci_get_drvdata(hdev); btusb_qca_send_vendor_req()
2844 BT_ERR("%s: Failed to access otp area (%d)", hdev->name, err); btusb_qca_send_vendor_req()
2856 static int btusb_setup_qca_download_fw(struct hci_dev *hdev, btusb_setup_qca_download_fw() argument
2860 struct btusb_data *btdata = hci_get_drvdata(hdev); btusb_setup_qca_download_fw()
2884 BT_ERR("%s: Failed to send headers (%d)", hdev->name, err); btusb_setup_qca_download_fw()
2901 hdev->name, sent, firmware->size, err); btusb_setup_qca_download_fw()
2906 BT_ERR("%s: Failed to get bulk buffer", hdev->name); btusb_setup_qca_download_fw()
2920 static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, btusb_setup_qca_load_rampatch() argument
2936 err = request_firmware(&fw, fwname, &hdev->dev); btusb_setup_qca_load_rampatch()
2939 hdev->name, fwname, err); btusb_setup_qca_load_rampatch()
2943 BT_INFO("%s: using rampatch file: %s", hdev->name, fwname); btusb_setup_qca_load_rampatch()
2950 "build 0x%x", hdev->name, rver_rom, rver_patch, ver_rom, btusb_setup_qca_load_rampatch()
2955 hdev->name); btusb_setup_qca_load_rampatch()
2960 err = btusb_setup_qca_download_fw(hdev, fw, info->rampatch_hdr); btusb_setup_qca_load_rampatch()
2968 static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, btusb_setup_qca_load_nvm() argument
2979 err = request_firmware(&fw, fwname, &hdev->dev); btusb_setup_qca_load_nvm()
2982 hdev->name, fwname, err); btusb_setup_qca_load_nvm()
2986 BT_INFO("%s: using NVM file: %s", hdev->name, fwname); btusb_setup_qca_load_nvm()
2988 err = btusb_setup_qca_download_fw(hdev, fw, info->nvm_hdr); btusb_setup_qca_load_nvm()
2995 static int btusb_setup_qca(struct hci_dev *hdev) btusb_setup_qca() argument
3003 err = btusb_qca_send_vendor_req(hdev, QCA_GET_TARGET_VERSION, &ver, btusb_setup_qca()
3014 BT_ERR("%s: don't support firmware rome 0x%x", hdev->name, btusb_setup_qca()
3019 err = btusb_qca_send_vendor_req(hdev, QCA_CHECK_STATUS, &status, btusb_setup_qca()
3025 err = btusb_setup_qca_load_rampatch(hdev, &ver, info); btusb_setup_qca()
3031 err = btusb_setup_qca_load_nvm(hdev, &ver, info); btusb_setup_qca()
3044 struct hci_dev *hdev; btusb_probe() local
3130 hdev = hci_alloc_dev(); btusb_probe()
3131 if (!hdev) btusb_probe()
3134 hdev->bus = HCI_USB; btusb_probe()
3135 hci_set_drvdata(hdev, data); btusb_probe()
3138 hdev->dev_type = HCI_AMP; btusb_probe()
3140 hdev->dev_type = HCI_BREDR; btusb_probe()
3142 data->hdev = hdev; btusb_probe()
3144 SET_HCIDEV_DEV(hdev, &intf->dev); btusb_probe()
3146 hdev->open = btusb_open; btusb_probe()
3147 hdev->close = btusb_close; btusb_probe()
3148 hdev->flush = btusb_flush; btusb_probe()
3149 hdev->send = btusb_send_frame; btusb_probe()
3150 hdev->notify = btusb_notify; btusb_probe()
3153 hdev->setup = btusb_setup_bcm92035; btusb_probe()
3157 hdev->setup = btbcm_setup_patchram; btusb_probe()
3158 hdev->set_bdaddr = btbcm_set_bdaddr; btusb_probe()
3162 hdev->setup = btbcm_setup_apple; btusb_probe()
3166 hdev->setup = btusb_setup_intel; btusb_probe()
3167 hdev->shutdown = btusb_shutdown_intel; btusb_probe()
3168 hdev->set_bdaddr = btintel_set_bdaddr; btusb_probe()
3169 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); btusb_probe()
3170 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); btusb_probe()
3174 hdev->send = btusb_send_frame_intel; btusb_probe()
3175 hdev->setup = btusb_setup_intel_new; btusb_probe()
3176 hdev->hw_error = btusb_hw_error_intel; btusb_probe()
3177 hdev->set_bdaddr = btintel_set_bdaddr; btusb_probe()
3178 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); btusb_probe()
3182 hdev->set_bdaddr = btusb_set_bdaddr_marvell; btusb_probe()
3185 set_bit(HCI_QUIRK_FIXUP_INQUIRY_MODE, &hdev->quirks); btusb_probe()
3186 set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks); btusb_probe()
3190 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); btusb_probe()
3193 hdev->set_bdaddr = btusb_set_bdaddr_ath3012; btusb_probe()
3194 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); btusb_probe()
3195 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); btusb_probe()
3200 hdev->set_bdaddr = btusb_set_bdaddr_ath3012; btusb_probe()
3204 hdev->setup = btusb_setup_realtek; btusb_probe()
3215 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); btusb_probe()
3219 set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks); btusb_probe()
3227 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); btusb_probe()
3236 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); btusb_probe()
3240 hdev->setup = btusb_setup_csr; btusb_probe()
3242 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); btusb_probe()
3250 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); btusb_probe()
3260 hci_free_dev(hdev); btusb_probe()
3269 hci_free_dev(hdev); btusb_probe()
3274 err = hci_register_dev(hdev); btusb_probe()
3276 hci_free_dev(hdev); btusb_probe()
3288 struct hci_dev *hdev; btusb_disconnect() local
3295 hdev = data->hdev; btusb_disconnect()
3301 hci_unregister_dev(hdev); btusb_disconnect()
3308 hci_free_dev(hdev); btusb_disconnect()
3357 struct hci_dev *hdev = data->hdev; btusb_resume() local
3365 if (!test_bit(HCI_RUNNING, &hdev->flags)) btusb_resume()
3369 err = btusb_submit_intr_urb(hdev, GFP_NOIO); btusb_resume()
3377 err = btusb_submit_bulk_urb(hdev, GFP_NOIO); btusb_resume()
3383 btusb_submit_bulk_urb(hdev, GFP_NOIO); btusb_resume()
3387 if (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0) btusb_resume()
3390 btusb_submit_isoc_urb(hdev, GFP_NOIO); btusb_resume()
H A Dbfusb.c65 struct hci_dev *hdev; member in struct:bfusb_data
152 data->hdev->name, urb, err); bfusb_send_bulk()
197 if (!test_bit(HCI_RUNNING, &data->hdev->flags)) bfusb_tx_complete()
201 data->hdev->stat.byte_tx += skb->len; bfusb_tx_complete()
203 data->hdev->stat.err_tx++; bfusb_tx_complete()
251 data->hdev->name, urb, err); bfusb_rx_submit()
265 BT_ERR("%s error in block", data->hdev->name); bfusb_recv_block()
277 BT_ERR("%s unexpected start block", data->hdev->name); bfusb_recv_block()
283 BT_ERR("%s no packet type found", data->hdev->name); bfusb_recv_block()
295 BT_ERR("%s event block is too short", data->hdev->name); bfusb_recv_block()
305 BT_ERR("%s data block is too short", data->hdev->name); bfusb_recv_block()
315 BT_ERR("%s audio block is too short", data->hdev->name); bfusb_recv_block()
323 BT_ERR("%s no memory for the packet", data->hdev->name); bfusb_recv_block()
332 BT_ERR("%s unexpected continuation block", data->hdev->name); bfusb_recv_block()
341 hci_recv_frame(data->hdev, data->reassembly); bfusb_recv_block()
360 if (!test_bit(HCI_RUNNING, &data->hdev->flags)) bfusb_rx_complete()
366 data->hdev->stat.byte_rx += count; bfusb_rx_complete()
385 data->hdev->name); bfusb_rx_complete()
410 data->hdev->name, urb, err); bfusb_rx_complete()
417 static int bfusb_open(struct hci_dev *hdev) bfusb_open() argument
419 struct bfusb_data *data = hci_get_drvdata(hdev); bfusb_open()
423 BT_DBG("hdev %p bfusb %p", hdev, data); bfusb_open()
425 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) bfusb_open()
435 clear_bit(HCI_RUNNING, &hdev->flags); bfusb_open()
443 static int bfusb_flush(struct hci_dev *hdev) bfusb_flush() argument
445 struct bfusb_data *data = hci_get_drvdata(hdev); bfusb_flush()
447 BT_DBG("hdev %p bfusb %p", hdev, data); bfusb_flush()
454 static int bfusb_close(struct hci_dev *hdev) bfusb_close() argument
456 struct bfusb_data *data = hci_get_drvdata(hdev); bfusb_close()
459 BT_DBG("hdev %p bfusb %p", hdev, data); bfusb_close()
461 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) bfusb_close()
468 bfusb_flush(hdev); bfusb_close()
473 static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) bfusb_send_frame() argument
475 struct bfusb_data *data = hci_get_drvdata(hdev); bfusb_send_frame()
480 BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len); bfusb_send_frame()
482 if (!test_bit(HCI_RUNNING, &hdev->flags)) bfusb_send_frame()
487 hdev->stat.cmd_tx++; bfusb_send_frame()
490 hdev->stat.acl_tx++; bfusb_send_frame()
493 hdev->stat.sco_tx++; bfusb_send_frame()
630 struct hci_dev *hdev; bfusb_probe() local
682 hdev = hci_alloc_dev(); bfusb_probe()
683 if (!hdev) { bfusb_probe()
688 data->hdev = hdev; bfusb_probe()
690 hdev->bus = HCI_USB; bfusb_probe()
691 hci_set_drvdata(hdev, data); bfusb_probe()
692 SET_HCIDEV_DEV(hdev, &intf->dev); bfusb_probe()
694 hdev->open = bfusb_open; bfusb_probe()
695 hdev->close = bfusb_close; bfusb_probe()
696 hdev->flush = bfusb_flush; bfusb_probe()
697 hdev->send = bfusb_send_frame; bfusb_probe()
699 set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks); bfusb_probe()
701 if (hci_register_dev(hdev) < 0) { bfusb_probe()
703 hci_free_dev(hdev); bfusb_probe()
721 struct hci_dev *hdev = data->hdev; bfusb_disconnect() local
725 if (!hdev) bfusb_disconnect()
730 bfusb_close(hdev); bfusb_disconnect()
732 hci_unregister_dev(hdev); bfusb_disconnect()
733 hci_free_dev(hdev); bfusb_disconnect()
H A Dbt3c_cs.c73 struct hci_dev *hdev; member in struct:bt3c_info
211 info->hdev->stat.byte_tx += len; bt3c_write_wakeup()
234 info->hdev->stat.byte_rx++; bt3c_receive()
273 info->hdev->stat.err_rx++; bt3c_receive()
274 clear_bit(HCI_RUNNING, &(info->hdev->flags)); bt3c_receive()
319 hci_recv_frame(info->hdev, info->rx_skb); bt3c_receive()
342 if (!info || !info->hdev) bt3c_interrupt()
359 BT_INFO("%s: Antenna %s", info->hdev->name, bt3c_interrupt()
386 static int bt3c_hci_flush(struct hci_dev *hdev) bt3c_hci_flush() argument
388 struct bt3c_info *info = hci_get_drvdata(hdev); bt3c_hci_flush()
397 static int bt3c_hci_open(struct hci_dev *hdev) bt3c_hci_open() argument
399 set_bit(HCI_RUNNING, &(hdev->flags)); bt3c_hci_open()
405 static int bt3c_hci_close(struct hci_dev *hdev) bt3c_hci_close() argument
407 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) bt3c_hci_close()
410 bt3c_hci_flush(hdev); bt3c_hci_close()
416 static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) bt3c_hci_send_frame() argument
418 struct bt3c_info *info = hci_get_drvdata(hdev); bt3c_hci_send_frame()
423 hdev->stat.cmd_tx++; bt3c_hci_send_frame()
426 hdev->stat.acl_tx++; bt3c_hci_send_frame()
429 hdev->stat.sco_tx++; bt3c_hci_send_frame()
540 struct hci_dev *hdev; bt3c_open() local
552 hdev = hci_alloc_dev(); bt3c_open()
553 if (!hdev) { bt3c_open()
558 info->hdev = hdev; bt3c_open()
560 hdev->bus = HCI_PCCARD; bt3c_open()
561 hci_set_drvdata(hdev, info); bt3c_open()
562 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); bt3c_open()
564 hdev->open = bt3c_hci_open; bt3c_open()
565 hdev->close = bt3c_hci_close; bt3c_open()
566 hdev->flush = bt3c_hci_flush; bt3c_open()
567 hdev->send = bt3c_hci_send_frame; bt3c_open()
589 err = hci_register_dev(hdev); bt3c_open()
598 info->hdev = NULL; bt3c_open()
599 hci_free_dev(hdev); bt3c_open()
606 struct hci_dev *hdev = info->hdev; bt3c_close() local
608 if (!hdev) bt3c_close()
611 bt3c_hci_close(hdev); bt3c_close()
613 hci_unregister_dev(hdev); bt3c_close()
614 hci_free_dev(hdev); bt3c_close()
H A Dbtintel.c35 int btintel_check_bdaddr(struct hci_dev *hdev) btintel_check_bdaddr() argument
40 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL, btintel_check_bdaddr()
45 hdev->name, err); btintel_check_bdaddr()
50 BT_ERR("%s: Intel device address length mismatch", hdev->name); btintel_check_bdaddr()
58 hdev->name, bda->status); btintel_check_bdaddr()
70 hdev->name, &bda->bdaddr); btintel_check_bdaddr()
71 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); btintel_check_bdaddr()
80 int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) btintel_set_bdaddr() argument
85 skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT); btintel_set_bdaddr()
89 hdev->name, err); btintel_set_bdaddr()
H A Dbtuart_cs.c68 struct hci_dev *hdev; member in struct:btuart_info
167 info->hdev->stat.byte_tx += len; btuart_write_wakeup()
188 info->hdev->stat.byte_rx++; btuart_receive()
225 info->hdev->stat.err_rx++; btuart_receive()
226 clear_bit(HCI_RUNNING, &(info->hdev->flags)); btuart_receive()
269 hci_recv_frame(info->hdev, info->rx_skb); btuart_receive()
295 if (!info || !info->hdev) btuart_interrupt()
399 static int btuart_hci_flush(struct hci_dev *hdev) btuart_hci_flush() argument
401 struct btuart_info *info = hci_get_drvdata(hdev); btuart_hci_flush()
410 static int btuart_hci_open(struct hci_dev *hdev) btuart_hci_open() argument
412 set_bit(HCI_RUNNING, &(hdev->flags)); btuart_hci_open()
418 static int btuart_hci_close(struct hci_dev *hdev) btuart_hci_close() argument
420 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) btuart_hci_close()
423 btuart_hci_flush(hdev); btuart_hci_close()
429 static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) btuart_hci_send_frame() argument
431 struct btuart_info *info = hci_get_drvdata(hdev); btuart_hci_send_frame()
435 hdev->stat.cmd_tx++; btuart_hci_send_frame()
438 hdev->stat.acl_tx++; btuart_hci_send_frame()
441 hdev->stat.sco_tx++; btuart_hci_send_frame()
463 struct hci_dev *hdev; btuart_open() local
474 hdev = hci_alloc_dev(); btuart_open()
475 if (!hdev) { btuart_open()
480 info->hdev = hdev; btuart_open()
482 hdev->bus = HCI_PCCARD; btuart_open()
483 hci_set_drvdata(hdev, info); btuart_open()
484 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); btuart_open()
486 hdev->open = btuart_hci_open; btuart_open()
487 hdev->close = btuart_hci_close; btuart_open()
488 hdev->flush = btuart_hci_flush; btuart_open()
489 hdev->send = btuart_hci_send_frame; btuart_open()
514 if (hci_register_dev(hdev) < 0) { btuart_open()
516 info->hdev = NULL; btuart_open()
517 hci_free_dev(hdev); btuart_open()
529 struct hci_dev *hdev = info->hdev; btuart_close() local
531 if (!hdev) btuart_close()
534 btuart_hci_close(hdev); btuart_close()
546 hci_unregister_dev(hdev); btuart_close()
547 hci_free_dev(hdev); btuart_close()
H A Ddtl1_cs.c68 struct hci_dev *hdev; member in struct:dtl1_info
171 info->hdev->stat.byte_tx += len; dtl1_write_wakeup()
216 info->hdev->stat.byte_rx++; dtl1_receive()
263 hci_recv_frame(info->hdev, info->rx_skb); dtl1_receive()
297 if (!info || !info->hdev) dtl1_interrupt()
358 static int dtl1_hci_open(struct hci_dev *hdev) dtl1_hci_open() argument
360 set_bit(HCI_RUNNING, &(hdev->flags)); dtl1_hci_open()
366 static int dtl1_hci_flush(struct hci_dev *hdev) dtl1_hci_flush() argument
368 struct dtl1_info *info = hci_get_drvdata(hdev); dtl1_hci_flush()
377 static int dtl1_hci_close(struct hci_dev *hdev) dtl1_hci_close() argument
379 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) dtl1_hci_close()
382 dtl1_hci_flush(hdev); dtl1_hci_close()
388 static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) dtl1_hci_send_frame() argument
390 struct dtl1_info *info = hci_get_drvdata(hdev); dtl1_hci_send_frame()
396 hdev->stat.cmd_tx++; dtl1_hci_send_frame()
400 hdev->stat.acl_tx++; dtl1_hci_send_frame()
404 hdev->stat.sco_tx++; dtl1_hci_send_frame()
443 struct hci_dev *hdev; dtl1_open() local
456 hdev = hci_alloc_dev(); dtl1_open()
457 if (!hdev) { dtl1_open()
462 info->hdev = hdev; dtl1_open()
464 hdev->bus = HCI_PCCARD; dtl1_open()
465 hci_set_drvdata(hdev, info); dtl1_open()
466 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); dtl1_open()
468 hdev->open = dtl1_hci_open; dtl1_open()
469 hdev->close = dtl1_hci_close; dtl1_open()
470 hdev->flush = dtl1_hci_flush; dtl1_open()
471 hdev->send = dtl1_hci_send_frame; dtl1_open()
497 if (hci_register_dev(hdev) < 0) { dtl1_open()
499 info->hdev = NULL; dtl1_open()
500 hci_free_dev(hdev); dtl1_open()
512 struct hci_dev *hdev = info->hdev; dtl1_close() local
514 if (!hdev) dtl1_close()
517 dtl1_hci_close(hdev); dtl1_close()
529 hci_unregister_dev(hdev); dtl1_close()
530 hci_free_dev(hdev); dtl1_close()
H A Dbluecard_cs.c67 struct hci_dev *hdev; member in struct:bluecard_info
332 info->hdev->stat.byte_tx += len; bluecard_write_wakeup()
440 info->hdev->stat.err_rx++; bluecard_receive()
482 hci_recv_frame(info->hdev, info->rx_skb); bluecard_receive()
495 info->hdev->stat.byte_rx += len; bluecard_receive()
505 if (!info || !info->hdev) bluecard_interrupt()
564 static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) bluecard_hci_set_baud_rate() argument
566 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_set_baud_rate()
613 static int bluecard_hci_flush(struct hci_dev *hdev) bluecard_hci_flush() argument
615 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_flush()
624 static int bluecard_hci_open(struct hci_dev *hdev) bluecard_hci_open() argument
626 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_open()
629 bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE); bluecard_hci_open()
631 if (test_and_set_bit(HCI_RUNNING, &(hdev->flags))) bluecard_hci_open()
645 static int bluecard_hci_close(struct hci_dev *hdev) bluecard_hci_close() argument
647 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_close()
649 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) bluecard_hci_close()
652 bluecard_hci_flush(hdev); bluecard_hci_close()
665 static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) bluecard_hci_send_frame() argument
667 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_send_frame()
671 hdev->stat.cmd_tx++; bluecard_hci_send_frame()
674 hdev->stat.acl_tx++; bluecard_hci_send_frame()
677 hdev->stat.sco_tx++; bluecard_hci_send_frame()
698 struct hci_dev *hdev; bluecard_open() local
714 hdev = hci_alloc_dev(); bluecard_open()
715 if (!hdev) { bluecard_open()
720 info->hdev = hdev; bluecard_open()
722 hdev->bus = HCI_PCCARD; bluecard_open()
723 hci_set_drvdata(hdev, info); bluecard_open()
724 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); bluecard_open()
726 hdev->open = bluecard_hci_open; bluecard_open()
727 hdev->close = bluecard_hci_close; bluecard_open()
728 hdev->flush = bluecard_hci_flush; bluecard_open()
729 hdev->send = bluecard_hci_send_frame; bluecard_open()
799 if (hci_register_dev(hdev) < 0) { bluecard_open()
801 info->hdev = NULL; bluecard_open()
802 hci_free_dev(hdev); bluecard_open()
813 struct hci_dev *hdev = info->hdev; bluecard_close() local
815 if (!hdev) bluecard_close()
818 bluecard_hci_close(hdev); bluecard_close()
829 hci_unregister_dev(hdev); bluecard_close()
830 hci_free_dev(hdev); bluecard_close()
H A Dbtintel.h74 int btintel_check_bdaddr(struct hci_dev *hdev);
75 int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
79 static inline int btintel_check_bdaddr(struct hci_dev *hdev) btintel_check_bdaddr() argument
84 static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) btintel_set_bdaddr() argument
H A Dbtmrvl_main.c447 static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb) btmrvl_send_frame() argument
449 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_send_frame()
453 if (!test_bit(HCI_RUNNING, &hdev->flags)) { btmrvl_send_frame()
454 BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); btmrvl_send_frame()
462 hdev->stat.cmd_tx++; btmrvl_send_frame()
466 hdev->stat.acl_tx++; btmrvl_send_frame()
470 hdev->stat.sco_tx++; btmrvl_send_frame()
481 static int btmrvl_flush(struct hci_dev *hdev) btmrvl_flush() argument
483 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_flush()
490 static int btmrvl_close(struct hci_dev *hdev) btmrvl_close() argument
492 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_close()
494 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) btmrvl_close()
502 static int btmrvl_open(struct hci_dev *hdev) btmrvl_open() argument
504 set_bit(HCI_RUNNING, &hdev->flags); btmrvl_open()
560 static int btmrvl_setup(struct hci_dev *hdev) btmrvl_setup() argument
562 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_setup()
585 static int btmrvl_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) btmrvl_set_bdaddr() argument
595 skb = __hci_cmd_sync(hdev, BT_CMD_SET_BDADDR, sizeof(buf), buf, btmrvl_set_bdaddr()
600 hdev->name, ret); btmrvl_set_bdaddr()
688 struct hci_dev *hdev = NULL; btmrvl_register_hdev() local
691 hdev = hci_alloc_dev(); btmrvl_register_hdev()
692 if (!hdev) { btmrvl_register_hdev()
697 priv->btmrvl_dev.hcidev = hdev; btmrvl_register_hdev()
698 hci_set_drvdata(hdev, priv); btmrvl_register_hdev()
700 hdev->bus = HCI_SDIO; btmrvl_register_hdev()
701 hdev->open = btmrvl_open; btmrvl_register_hdev()
702 hdev->close = btmrvl_close; btmrvl_register_hdev()
703 hdev->flush = btmrvl_flush; btmrvl_register_hdev()
704 hdev->send = btmrvl_send_frame; btmrvl_register_hdev()
705 hdev->setup = btmrvl_setup; btmrvl_register_hdev()
706 hdev->set_bdaddr = btmrvl_set_bdaddr; btmrvl_register_hdev()
708 hdev->dev_type = priv->btmrvl_dev.dev_type; btmrvl_register_hdev()
710 ret = hci_register_dev(hdev); btmrvl_register_hdev()
717 btmrvl_debugfs_init(hdev); btmrvl_register_hdev()
723 hci_free_dev(hdev); btmrvl_register_hdev()
782 struct hci_dev *hdev; btmrvl_remove_card() local
784 hdev = priv->btmrvl_dev.hcidev; btmrvl_remove_card()
792 btmrvl_debugfs_remove(hdev); btmrvl_remove_card()
795 hci_unregister_dev(hdev); btmrvl_remove_card()
797 hci_free_dev(hdev); btmrvl_remove_card()
H A Dhci_bcm.c84 hu->hdev->set_bdaddr = btbcm_set_bdaddr; bcm_setup()
86 return btbcm_setup_patchram(hu->hdev); bcm_setup()
102 bcm->rx_skb = h4_recv_buf(hu->hdev, bcm->rx_skb, data, count, bcm_recv()
106 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err); bcm_recv()
H A Dhci_h4.c131 h4->rx_skb = h4_recv_buf(hu->hdev, h4->rx_skb, data, count, h4_recv()
135 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err); h4_recv()
169 struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, h4_recv_buf() argument
225 (&pkts[i])->recv(hdev, skb); h4_recv_buf()
256 (&pkts[i])->recv(hdev, skb); h4_recv_buf()
H A Dbtmrvl_debugfs.c199 void btmrvl_debugfs_init(struct hci_dev *hdev) btmrvl_debugfs_init() argument
201 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_debugfs_init()
204 if (!hdev->debugfs) btmrvl_debugfs_init()
215 dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); btmrvl_debugfs_init()
232 dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); btmrvl_debugfs_init()
243 void btmrvl_debugfs_remove(struct hci_dev *hdev) btmrvl_debugfs_remove() argument
245 struct btmrvl_private *priv = hci_get_drvdata(hdev); btmrvl_debugfs_remove()
H A Dhci_uart.h72 struct hci_dev *hdev; member in struct:hci_uart
110 int (*recv)(struct hci_dev *hdev, struct sk_buff *skb);
134 struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
H A Dhci_ath.c147 static int ath_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) ath_set_bdaddr() argument
159 skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT); ath_set_bdaddr()
163 hdev->name, err); ath_set_bdaddr()
175 hu->hdev->set_bdaddr = ath_set_bdaddr; ath_setup()
190 ath->rx_skb = h4_recv_buf(hu->hdev, ath->rx_skb, data, count, ath_recv()
194 BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err); ath_recv()
H A Dhci_ll.c348 static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll, int len) ll_check_data_len() argument
355 hci_recv_frame(hdev, ll->rx_skb); ll_check_data_len()
397 hci_recv_frame(hu->hdev, ll->rx_skb); ll_recv()
408 ll_check_data_len(hu->hdev, ll, eh->plen); ll_recv()
417 ll_check_data_len(hu->hdev, ll, dlen); ll_recv()
425 ll_check_data_len(hu->hdev, ll, sh->dlen); ll_recv()
480 hu->hdev->stat.err_rx++; ll_recv()
H A Dbtmrvl_drv.h178 void btmrvl_debugfs_init(struct hci_dev *hdev);
179 void btmrvl_debugfs_remove(struct hci_dev *hdev);
H A Dhci_h5.c136 BT_DBG("%s", hu->hdev->name); h5_timed_event()
189 hci_reset_dev(hu->hdev); h5_peer_reset()
296 BT_DBG("%s", hu->hdev->name); h5_handle_internal_rx()
368 hci_recv_frame(hu->hdev, h5->rx_skb); h5_complete_rx_pkt()
409 hu->hdev->name, H5_HDR_SEQ(hdr), H5_HDR_ACK(hdr), h5_rx_3wire_hdr()
456 h5->rx_skb->dev = (void *) hu->hdev; h5_rx_pkt_start()
519 BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending, h5_recv()
664 hu->hdev->name, H5_HDR_SEQ(hdr), H5_HDR_ACK(hdr), h5_prepare_pkt()
H A Dbtmrvl_sdio.c593 struct hci_dev *hdev = priv->btmrvl_dev.hcidev; btmrvl_sdio_card_to_host() local
672 hci_recv_frame(hdev, skb); btmrvl_sdio_card_to_host()
674 hci_recv_frame(hdev, skb); btmrvl_sdio_card_to_host()
677 hdev->stat.byte_rx += buf_len; btmrvl_sdio_card_to_host()
686 hci_recv_frame(hdev, skb); btmrvl_sdio_card_to_host()
688 hdev->stat.byte_rx += buf_len; btmrvl_sdio_card_to_host()
702 hdev->stat.err_rx++; btmrvl_sdio_card_to_host()
1442 BT_ERR("Register hdev failed!"); btmrvl_sdio_probe()
H A Dhci_bcsp.c528 hci_recv_frame(hu->hdev, bcsp->rx_skb); bcsp_complete_rx_pkt()
542 hci_recv_frame(hu->hdev, bcsp->rx_skb); bcsp_complete_rx_pkt()
/linux-4.1.27/include/net/bluetooth/
H A Dhci_core.h383 int (*open)(struct hci_dev *hdev);
384 int (*close)(struct hci_dev *hdev);
385 int (*flush)(struct hci_dev *hdev);
386 int (*setup)(struct hci_dev *hdev);
387 int (*shutdown)(struct hci_dev *hdev);
388 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
389 void (*notify)(struct hci_dev *hdev, unsigned int evt);
390 void (*hw_error)(struct hci_dev *hdev, u8 code);
391 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
466 struct hci_dev *hdev; member in struct:hci_conn
515 #define hci_dev_set_flag(hdev, nr) set_bit((nr), (hdev)->dev_flags)
516 #define hci_dev_clear_flag(hdev, nr) clear_bit((nr), (hdev)->dev_flags)
517 #define hci_dev_change_flag(hdev, nr) change_bit((nr), (hdev)->dev_flags)
518 #define hci_dev_test_flag(hdev, nr) test_bit((nr), (hdev)->dev_flags)
519 #define hci_dev_test_and_set_flag(hdev, nr) test_and_set_bit((nr), (hdev)->dev_flags)
520 #define hci_dev_test_and_clear_flag(hdev, nr) test_and_clear_bit((nr), (hdev)->dev_flags)
521 #define hci_dev_test_and_change_flag(hdev, nr) test_and_change_bit((nr), (hdev)->dev_flags)
523 #define hci_dev_clear_volatile_flags(hdev) \
525 hci_dev_clear_flag(hdev, HCI_LE_SCAN); \
526 hci_dev_clear_flag(hdev, HCI_LE_ADV); \
527 hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); \
531 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
535 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
542 static inline void discovery_init(struct hci_dev *hdev) discovery_init() argument
544 hdev->discovery.state = DISCOVERY_STOPPED; discovery_init()
545 INIT_LIST_HEAD(&hdev->discovery.all); discovery_init()
546 INIT_LIST_HEAD(&hdev->discovery.unknown); discovery_init()
547 INIT_LIST_HEAD(&hdev->discovery.resolve); discovery_init()
548 hdev->discovery.report_invalid_rssi = true; discovery_init()
549 hdev->discovery.rssi = HCI_RSSI_INVALID; discovery_init()
552 static inline void hci_discovery_filter_clear(struct hci_dev *hdev) hci_discovery_filter_clear() argument
554 hdev->discovery.result_filtering = false; hci_discovery_filter_clear()
555 hdev->discovery.report_invalid_rssi = true; hci_discovery_filter_clear()
556 hdev->discovery.rssi = HCI_RSSI_INVALID; hci_discovery_filter_clear()
557 hdev->discovery.uuid_count = 0; hci_discovery_filter_clear()
558 kfree(hdev->discovery.uuids); hci_discovery_filter_clear()
559 hdev->discovery.uuids = NULL; hci_discovery_filter_clear()
560 hdev->discovery.scan_start = 0; hci_discovery_filter_clear()
561 hdev->discovery.scan_duration = 0; hci_discovery_filter_clear()
564 static inline void adv_info_init(struct hci_dev *hdev) adv_info_init() argument
566 memset(&hdev->adv_instance, 0, sizeof(struct adv_info)); adv_info_init()
569 bool hci_discovery_active(struct hci_dev *hdev);
571 void hci_discovery_set_state(struct hci_dev *hdev, int state);
573 static inline int inquiry_cache_empty(struct hci_dev *hdev) inquiry_cache_empty() argument
575 return list_empty(&hdev->discovery.all); inquiry_cache_empty()
578 static inline long inquiry_cache_age(struct hci_dev *hdev) inquiry_cache_age() argument
580 struct discovery_state *c = &hdev->discovery; inquiry_cache_age()
589 struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
591 struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
593 struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
596 void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
598 u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
600 void hci_inquiry_cache_flush(struct hci_dev *hdev);
629 struct hci_dev *hdev = conn->hdev; hci_conn_ssp_enabled() local
630 return hci_dev_test_flag(hdev, HCI_SSP_ENABLED) && hci_conn_ssp_enabled()
636 struct hci_dev *hdev = conn->hdev; hci_conn_sc_enabled() local
637 return hci_dev_test_flag(hdev, HCI_SC_ENABLED) && hci_conn_sc_enabled()
641 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) hci_conn_hash_add() argument
643 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_add()
664 static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) hci_conn_hash_del() argument
666 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_del()
690 static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type) hci_conn_num() argument
692 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_num()
708 static inline unsigned int hci_conn_count(struct hci_dev *hdev) hci_conn_count() argument
710 struct hci_conn_hash *c = &hdev->conn_hash; hci_conn_count()
715 static inline __u8 hci_conn_lookup_type(struct hci_dev *hdev, __u16 handle) hci_conn_lookup_type() argument
717 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_lookup_type()
735 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, hci_conn_hash_lookup_handle() argument
738 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_lookup_handle()
754 static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, hci_conn_hash_lookup_ba() argument
757 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_lookup_ba()
774 static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, hci_conn_hash_lookup_state() argument
777 struct hci_conn_hash *h = &hdev->conn_hash; hci_conn_hash_lookup_state()
798 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
801 void hci_conn_hash_flush(struct hci_dev *hdev);
802 void hci_conn_check_pending(struct hci_dev *hdev);
807 struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
809 struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
812 struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
814 struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
896 queue_delayed_work(conn->hdev->workqueue, hci_conn_drop()
925 static inline void *hci_get_drvdata(struct hci_dev *hdev) hci_get_drvdata() argument
927 return dev_get_drvdata(&hdev->dev); hci_get_drvdata()
930 static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) hci_set_drvdata() argument
932 dev_set_drvdata(&hdev->dev, data); hci_set_drvdata()
939 void hci_free_dev(struct hci_dev *hdev);
940 int hci_register_dev(struct hci_dev *hdev);
941 void hci_unregister_dev(struct hci_dev *hdev);
942 int hci_suspend_dev(struct hci_dev *hdev);
943 int hci_resume_dev(struct hci_dev *hdev);
944 int hci_reset_dev(struct hci_dev *hdev);
953 int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
954 int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
963 struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
965 struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
967 void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
968 void hci_conn_params_clear_all(struct hci_dev *hdev);
969 void hci_conn_params_clear_disabled(struct hci_dev *hdev);
975 void hci_uuids_clear(struct hci_dev *hdev);
977 void hci_link_keys_clear(struct hci_dev *hdev);
978 struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
979 struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
982 struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
985 struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
987 int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
988 void hci_smp_ltks_clear(struct hci_dev *hdev);
989 int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
991 struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa);
992 struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
994 struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
996 void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
997 void hci_smp_irks_clear(struct hci_dev *hdev);
999 bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1001 void hci_remote_oob_data_clear(struct hci_dev *hdev);
1002 struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
1004 int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
1007 int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
1010 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
1012 int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
1014 void hci_init_sysfs(struct hci_dev *hdev);
1019 #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
1064 static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, hci_proto_connect_ind() argument
1069 return l2cap_connect_ind(hdev, bdaddr); hci_proto_connect_ind()
1073 return sco_connect_ind(hdev, bdaddr, flags); hci_proto_connect_ind()
1251 static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, hci_get_irk() argument
1257 return hci_find_irk_by_rpa(hdev, bdaddr); hci_get_irk()
1284 struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1286 struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
1289 int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
1294 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
1297 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
1300 void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
1302 void hci_sock_dev_event(struct hci_dev *hdev, int event);
1310 int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
1321 void (*hdev_init) (struct sock *sk, struct hci_dev *hdev);
1346 int mgmt_new_settings(struct hci_dev *hdev);
1347 void mgmt_index_added(struct hci_dev *hdev);
1348 void mgmt_index_removed(struct hci_dev *hdev);
1349 void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1350 int mgmt_powered(struct hci_dev *hdev, u8 powered);
1351 int mgmt_update_adv_data(struct hci_dev *hdev);
1352 void mgmt_discoverable_timeout(struct hci_dev *hdev);
1353 void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1355 void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
1357 void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1360 void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1362 void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1364 void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
1365 void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1367 void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1369 int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1372 int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1374 int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1376 int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1378 int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1380 int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1382 int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1386 void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1387 void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1388 void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1390 void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1391 void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1394 void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1396 void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1397 bool mgmt_powering_down(struct hci_dev *hdev);
1398 void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1399 void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1400 void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1402 void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
1405 void mgmt_reenable_advertising(struct hci_dev *hdev);
1413 void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
H A Dbluetooth.h279 typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode);
280 typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
H A Dhci.h141 * during the hdev->setup vendor callback.
151 * during the hdev->setup vendor callback.
160 * during the hdev->setup vendor callback.
168 * during the hdev->setup vendor callback.
/linux-4.1.27/drivers/nfc/st21nfca/
H A Dst21nfca.c117 static int st21nfca_hci_load_session(struct nfc_hci_dev *hdev) st21nfca_hci_load_session() argument
147 r = nfc_hci_connect_gate(hdev, NFC_HCI_HOST_CONTROLLER_ID, st21nfca_hci_load_session()
154 r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_load_session()
163 r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_load_session()
197 hdev->gate2pipe[st21nfca_gates[j].gate] = st21nfca_hci_load_session()
199 hdev->pipes[st21nfca_gates[j].pipe].gate = st21nfca_hci_load_session()
201 hdev->pipes[st21nfca_gates[j].pipe].dest_host = st21nfca_hci_load_session()
214 r = nfc_hci_connect_gate(hdev, st21nfca_hci_load_session()
223 memcpy(hdev->init_data.gates, st21nfca_gates, sizeof(st21nfca_gates)); st21nfca_hci_load_session()
229 static int st21nfca_hci_open(struct nfc_hci_dev *hdev) st21nfca_hci_open() argument
231 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_open()
251 static void st21nfca_hci_close(struct nfc_hci_dev *hdev) st21nfca_hci_close() argument
253 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_close()
267 static int st21nfca_hci_ready(struct nfc_hci_dev *hdev) st21nfca_hci_ready() argument
269 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_ready()
290 r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, st21nfca_hci_ready()
298 r = nfc_hci_get_param(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_ready()
308 r = nfc_hci_set_param(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_ready()
314 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, st21nfca_hci_ready()
319 r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE, st21nfca_hci_ready()
338 static int st21nfca_hci_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb) st21nfca_hci_xmit() argument
340 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_xmit()
345 static int st21nfca_hci_start_poll(struct nfc_hci_dev *hdev, st21nfca_hci_start_poll() argument
356 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, st21nfca_hci_start_poll()
366 r = nfc_hci_disconnect_gate(hdev, st21nfca_hci_start_poll()
373 r = nfc_hci_disconnect_gate(hdev, st21nfca_hci_start_poll()
380 r = nfc_hci_disconnect_gate(hdev, st21nfca_hci_start_poll()
385 hdev->gb = nfc_get_local_general_bytes(hdev->ndev, st21nfca_hci_start_poll()
386 &hdev->gb_len); st21nfca_hci_start_poll()
388 if (hdev->gb == NULL || hdev->gb_len == 0) { st21nfca_hci_start_poll()
396 r = nfc_hci_set_param(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_hci_start_poll()
404 r = nfc_hci_set_param(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_hci_start_poll()
412 r = nfc_hci_disconnect_gate(hdev, st21nfca_hci_start_poll()
419 r = nfc_hci_disconnect_gate(hdev, st21nfca_hci_start_poll()
425 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, st21nfca_hci_start_poll()
428 nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, st21nfca_hci_start_poll()
433 r = nfc_hci_get_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
444 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
462 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
475 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
481 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
512 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
519 r = nfc_hci_set_param(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_hci_start_poll()
526 static void st21nfca_hci_stop_poll(struct nfc_hci_dev *hdev) st21nfca_hci_stop_poll() argument
528 nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_stop_poll()
532 static int st21nfca_get_iso14443_3_atqa(struct nfc_hci_dev *hdev, u16 *atqa) st21nfca_get_iso14443_3_atqa() argument
537 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, st21nfca_get_iso14443_3_atqa()
554 static int st21nfca_get_iso14443_3_sak(struct nfc_hci_dev *hdev, u8 *sak) st21nfca_get_iso14443_3_sak() argument
559 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, st21nfca_get_iso14443_3_sak()
576 static int st21nfca_get_iso14443_3_uid(struct nfc_hci_dev *hdev, u8 *uid, st21nfca_get_iso14443_3_uid() argument
582 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_14443_3_A_GATE, st21nfca_get_iso14443_3_uid()
599 static int st21nfca_get_iso15693_inventory(struct nfc_hci_dev *hdev, st21nfca_get_iso15693_inventory() argument
605 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_ISO15693_GATE, st21nfca_get_iso15693_inventory()
627 static int st21nfca_hci_dep_link_up(struct nfc_hci_dev *hdev, st21nfca_hci_dep_link_up() argument
631 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_dep_link_up()
634 return st21nfca_im_send_atr_req(hdev, gb, gb_len); st21nfca_hci_dep_link_up()
637 static int st21nfca_hci_dep_link_down(struct nfc_hci_dev *hdev) st21nfca_hci_dep_link_down() argument
639 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_dep_link_down()
643 return nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_hci_dep_link_down()
647 static int st21nfca_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, st21nfca_hci_target_from_gate() argument
661 r = st21nfca_get_iso14443_3_atqa(hdev, &atqa); st21nfca_hci_target_from_gate()
668 r = st21nfca_get_iso14443_3_sak(hdev, &sak); st21nfca_hci_target_from_gate()
672 r = st21nfca_get_iso14443_3_uid(hdev, uid, &len); st21nfca_hci_target_from_gate()
690 r = st21nfca_get_iso15693_inventory(hdev, target); st21nfca_hci_target_from_gate()
701 static int st21nfca_hci_complete_target_discovered(struct nfc_hci_dev *hdev, st21nfca_hci_complete_target_discovered() argument
709 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_hci_complete_target_discovered()
742 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_hci_complete_target_discovered()
789 static int st21nfca_hci_im_transceive(struct nfc_hci_dev *hdev, st21nfca_hci_im_transceive() argument
794 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_im_transceive()
802 return st21nfca_im_send_dep_req(hdev, skb); st21nfca_hci_im_transceive()
805 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, st21nfca_hci_im_transceive()
811 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, st21nfca_hci_im_transceive()
821 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, st21nfca_hci_im_transceive()
832 static int st21nfca_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) st21nfca_hci_tm_send() argument
834 return st21nfca_tm_send_dep_res(hdev, skb); st21nfca_hci_tm_send()
837 static int st21nfca_hci_check_presence(struct nfc_hci_dev *hdev, st21nfca_hci_check_presence() argument
852 return nfc_hci_send_cmd(hdev, target->hci_reader_gate, st21nfca_hci_check_presence()
855 return nfc_hci_send_cmd(hdev, target->hci_reader_gate, st21nfca_hci_check_presence()
863 static void st21nfca_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, st21nfca_hci_cmd_received() argument
866 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_cmd_received()
867 u8 gate = hdev->pipes[pipe].gate; st21nfca_hci_cmd_received()
874 hdev->pipes[pipe].dest_host != NFC_HCI_UICC_HOST_ID) st21nfca_hci_cmd_received()
887 static int st21nfca_admin_event_received(struct nfc_hci_dev *hdev, u8 event, st21nfca_admin_event_received() argument
890 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_admin_event_received()
918 static int st21nfca_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, st21nfca_hci_event_received() argument
921 u8 gate = hdev->pipes[pipe].gate; st21nfca_hci_event_received()
922 u8 host = hdev->pipes[pipe].dest_host; st21nfca_hci_event_received()
928 return st21nfca_admin_event_received(hdev, event, skb); st21nfca_hci_event_received()
930 return st21nfca_dep_event_received(hdev, event, skb); st21nfca_hci_event_received()
932 return st21nfca_connectivity_event_received(hdev, host, st21nfca_hci_event_received()
935 return st21nfca_apdu_reader_event_received(hdev, event, skb); st21nfca_hci_event_received()
966 int phy_payload, struct nfc_hci_dev **hdev, st21nfca_hci_probe()
1015 info->hdev = st21nfca_hci_probe()
1021 if (!info->hdev) { st21nfca_hci_probe()
1022 pr_err("Cannot allocate nfc hdev.\n"); st21nfca_hci_probe()
1029 nfc_hci_set_clientdata(info->hdev, info); st21nfca_hci_probe()
1031 r = nfc_hci_register_device(info->hdev); st21nfca_hci_probe()
1035 *hdev = info->hdev; st21nfca_hci_probe()
1036 st21nfca_dep_init(info->hdev); st21nfca_hci_probe()
1037 st21nfca_se_init(info->hdev); st21nfca_hci_probe()
1042 nfc_hci_free_device(info->hdev); st21nfca_hci_probe()
1051 void st21nfca_hci_remove(struct nfc_hci_dev *hdev) st21nfca_hci_remove() argument
1053 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_remove()
1055 st21nfca_dep_deinit(hdev); st21nfca_hci_remove()
1056 st21nfca_se_deinit(hdev); st21nfca_hci_remove()
1057 nfc_hci_unregister_device(hdev); st21nfca_hci_remove()
1058 nfc_hci_free_device(hdev); st21nfca_hci_remove()
964 st21nfca_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, int phy_headroom, int phy_tailroom, int phy_payload, struct nfc_hci_dev **hdev, struct st21nfca_se_status *se_status) st21nfca_hci_probe() argument
H A Dst21nfca_se.h49 int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host,
51 int st21nfca_apdu_reader_event_received(struct nfc_hci_dev *hdev,
54 int st21nfca_hci_discover_se(struct nfc_hci_dev *hdev);
55 int st21nfca_hci_enable_se(struct nfc_hci_dev *hdev, u32 se_idx);
56 int st21nfca_hci_disable_se(struct nfc_hci_dev *hdev, u32 se_idx);
57 int st21nfca_hci_se_io(struct nfc_hci_dev *hdev, u32 se_idx,
61 void st21nfca_se_init(struct nfc_hci_dev *hdev);
62 void st21nfca_se_deinit(struct nfc_hci_dev *hdev);
H A Dst21nfca_se.c62 static u8 st21nfca_se_get_bwi(struct nfc_hci_dev *hdev) st21nfca_se_get_bwi() argument
66 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_get_bwi()
81 static void st21nfca_se_get_atr(struct nfc_hci_dev *hdev) st21nfca_se_get_atr() argument
85 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_get_atr()
87 r = nfc_hci_get_param(hdev, ST21NFCA_APDU_READER_GATE, st21nfca_se_get_atr()
95 ST21NFCA_BWI_TO_TIMEOUT(st21nfca_se_get_bwi(hdev)); st21nfca_se_get_atr()
100 static int st21nfca_hci_control_se(struct nfc_hci_dev *hdev, u32 se_idx, st21nfca_hci_control_se() argument
103 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_control_se()
134 r = nfc_hci_send_event(hdev, ST21NFCA_DEVICE_MGNT_GATE, se_event, st21nfca_hci_control_se()
146 r = nfc_hci_get_param(hdev, NFC_HCI_ADMIN_GATE, st21nfca_hci_control_se()
163 int st21nfca_hci_discover_se(struct nfc_hci_dev *hdev) st21nfca_hci_discover_se() argument
165 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_discover_se()
169 nfc_add_se(hdev->ndev, NFC_HCI_UICC_HOST_ID, NFC_SE_UICC); st21nfca_hci_discover_se()
174 nfc_add_se(hdev->ndev, ST21NFCA_ESE_HOST_ID, NFC_SE_EMBEDDED); st21nfca_hci_discover_se()
182 int st21nfca_hci_enable_se(struct nfc_hci_dev *hdev, u32 se_idx) st21nfca_hci_enable_se() argument
191 r = st21nfca_hci_control_se(hdev, se_idx, ST21NFCA_SE_MODE_ON); st21nfca_hci_enable_se()
194 st21nfca_se_get_atr(hdev); st21nfca_hci_enable_se()
195 r = nfc_hci_send_event(hdev, ST21NFCA_APDU_READER_GATE, st21nfca_hci_enable_se()
204 nfc_remove_se(hdev->ndev, se_idx); st21nfca_hci_enable_se()
212 int st21nfca_hci_disable_se(struct nfc_hci_dev *hdev, u32 se_idx) st21nfca_hci_disable_se() argument
221 r = st21nfca_hci_control_se(hdev, se_idx, ST21NFCA_SE_MODE_OFF); st21nfca_hci_disable_se()
229 int st21nfca_hci_se_io(struct nfc_hci_dev *hdev, u32 se_idx, st21nfca_hci_se_io() argument
233 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_se_io()
244 return nfc_hci_send_event(hdev, ST21NFCA_APDU_READER_GATE, st21nfca_hci_se_io()
274 nfc_hci_send_event(info->hdev, ST21NFCA_APDU_READER_GATE, st21nfca_se_wt_timeout()
278 nfc_hci_send_event(info->hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_se_wt_timeout()
300 int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, st21nfca_connectivity_event_received() argument
304 struct device *dev = &hdev->ndev->dev; st21nfca_connectivity_event_received()
340 r = nfc_se_transaction(hdev->ndev, host, transaction); st21nfca_connectivity_event_received()
350 int st21nfca_apdu_reader_event_received(struct nfc_hci_dev *hdev, st21nfca_apdu_reader_event_received() argument
354 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_apdu_reader_event_received()
362 r = nfc_hci_send_event(hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_apdu_reader_event_received()
382 void st21nfca_se_init(struct nfc_hci_dev *hdev) st21nfca_se_init() argument
384 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_init()
408 void st21nfca_se_deinit(struct nfc_hci_dev *hdev) st21nfca_se_deinit() argument
410 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_deinit()
H A Dst21nfca_dep.c132 dev = info->hdev->ndev; st21nfca_tx_work()
137 nfc_hci_send_cmd_async(info->hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_tx_work()
152 static int st21nfca_tm_send_atr_res(struct nfc_hci_dev *hdev, st21nfca_tm_send_atr_res() argument
159 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_tm_send_atr_res()
186 r = nfc_set_remote_general_bytes(hdev->ndev, atr_res->gbi, st21nfca_tm_send_atr_res()
194 r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_tm_send_atr_res()
200 static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev, st21nfca_tm_recv_atr_req() argument
226 r = st21nfca_tm_send_atr_res(hdev, atr_req); st21nfca_tm_recv_atr_req()
232 r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK, st21nfca_tm_recv_atr_req()
243 static int st21nfca_tm_send_psl_res(struct nfc_hci_dev *hdev, st21nfca_tm_send_psl_res() argument
263 r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_tm_send_psl_res()
282 r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_tm_send_psl_res()
289 static int st21nfca_tm_recv_psl_req(struct nfc_hci_dev *hdev, st21nfca_tm_recv_psl_req() argument
309 r = st21nfca_tm_send_psl_res(hdev, psl_req); st21nfca_tm_recv_psl_req()
314 int st21nfca_tm_send_dep_res(struct nfc_hci_dev *hdev, struct sk_buff *skb) st21nfca_tm_send_dep_res() argument
317 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_tm_send_dep_res()
324 r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, st21nfca_tm_send_dep_res()
332 static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev, st21nfca_tm_recv_dep_req() argument
338 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_tm_recv_dep_req()
376 return nfc_tm_data_received(hdev->ndev, skb); st21nfca_tm_recv_dep_req()
381 static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev, st21nfca_tm_event_send_data() argument
393 r = st21nfca_tm_recv_atr_req(hdev, skb); st21nfca_tm_event_send_data()
396 r = st21nfca_tm_recv_psl_req(hdev, skb); st21nfca_tm_event_send_data()
399 r = st21nfca_tm_recv_dep_req(hdev, skb); st21nfca_tm_event_send_data()
415 int st21nfca_dep_event_received(struct nfc_hci_dev *hdev, st21nfca_dep_event_received() argument
419 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_dep_event_received()
434 r = st21nfca_tm_event_send_data(hdev, skb); st21nfca_dep_event_received()
446 static void st21nfca_im_send_psl_req(struct nfc_hci_dev *hdev, u8 did, u8 bsi, st21nfca_im_send_psl_req() argument
451 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_im_send_psl_req()
492 r = nfc_set_remote_general_bytes(info->hdev->ndev, st21nfca_im_recv_atr_res_cb()
505 r = nfc_dep_link_is_up(info->hdev->ndev, info->dep_info.idx, st21nfca_im_recv_atr_res_cb()
512 st21nfca_im_send_psl_req(info->hdev, atr_res->did, st21nfca_im_recv_atr_res_cb()
522 int st21nfca_im_send_atr_req(struct nfc_hci_dev *hdev, u8 *gb, size_t gb_len) st21nfca_im_send_atr_req() argument
525 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_im_send_atr_req()
552 target = hdev->ndev->targets; st21nfca_im_send_atr_req()
569 atr_req->length = sizeof(struct st21nfca_atr_req) + hdev->gb_len; st21nfca_im_send_atr_req()
580 return nfc_hci_send_cmd_async(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_im_send_atr_req()
627 nfc_tm_data_received(info->hdev->ndev, skb); st21nfca_im_recv_dep_res_cb()
650 int st21nfca_im_send_dep_req(struct nfc_hci_dev *hdev, struct sk_buff *skb) st21nfca_im_send_dep_req() argument
652 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_im_send_dep_req()
665 return nfc_hci_send_cmd_async(hdev, ST21NFCA_RF_READER_F_GATE, st21nfca_im_send_dep_req()
672 void st21nfca_dep_init(struct nfc_hci_dev *hdev) st21nfca_dep_init() argument
674 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_dep_init()
683 void st21nfca_dep_deinit(struct nfc_hci_dev *hdev) st21nfca_dep_deinit() argument
685 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_dep_deinit()
H A Dst21nfca_dep.h35 int st21nfca_dep_event_received(struct nfc_hci_dev *hdev,
37 int st21nfca_tm_send_dep_res(struct nfc_hci_dev *hdev, struct sk_buff *skb);
39 int st21nfca_im_send_atr_req(struct nfc_hci_dev *hdev, u8 *gb, size_t gb_len);
40 int st21nfca_im_send_dep_req(struct nfc_hci_dev *hdev, struct sk_buff *skb);
41 void st21nfca_dep_init(struct nfc_hci_dev *hdev);
42 void st21nfca_dep_deinit(struct nfc_hci_dev *hdev);
H A Dst21nfca.h62 int phy_payload, struct nfc_hci_dev **hdev,
64 void st21nfca_hci_remove(struct nfc_hci_dev *hdev);
75 struct nfc_hci_dev *hdev; member in struct:st21nfca_hci_info
H A Di2c.c72 struct nfc_hci_dev *hdev; member in struct:st21nfca_i2c_phy
465 nfc_hci_recv_frame(phy->hdev, NULL); st21nfca_hci_irq_thread_fn()
490 nfc_hci_recv_frame(phy->hdev, phy->pending_skb); st21nfca_hci_irq_thread_fn()
499 nfc_hci_recv_frame(phy->hdev, NULL); st21nfca_hci_irq_thread_fn()
654 &phy->hdev, st21nfca_hci_i2c_probe()
664 st21nfca_hci_remove(phy->hdev); st21nfca_hci_i2c_remove()
/linux-4.1.27/drivers/nfc/pn544/
H A Dpn544.c125 struct nfc_hci_dev *hdev; member in struct:pn544_hci_info
138 static int pn544_hci_open(struct nfc_hci_dev *hdev) pn544_hci_open() argument
140 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_open()
160 static void pn544_hci_close(struct nfc_hci_dev *hdev) pn544_hci_close() argument
162 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_close()
177 static int pn544_hci_ready(struct nfc_hci_dev *hdev) pn544_hci_ready() argument
263 r = nfc_hci_send_cmd(hdev, PN544_SYS_MGMT_GATE, PN544_WRITE, pn544_hci_ready()
284 r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE, pn544_hci_ready()
290 r = nfc_hci_set_param(hdev, PN544_SYS_MGMT_GATE, pn544_hci_ready()
296 r = nfc_hci_set_param(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_ready()
301 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_ready()
307 r = nfc_hci_set_param(hdev, PN544_POLLING_LOOP_MGMT_GATE, pn544_hci_ready()
313 r = nfc_hci_set_param(hdev, PN544_POLLING_LOOP_MGMT_GATE, pn544_hci_ready()
318 r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE, pn544_hci_ready()
337 static int pn544_hci_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb) pn544_hci_xmit() argument
339 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_xmit()
344 static int pn544_hci_start_poll(struct nfc_hci_dev *hdev, pn544_hci_start_poll() argument
358 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_start_poll()
365 r = nfc_hci_set_param(hdev, PN544_POLLING_LOOP_MGMT_GATE, pn544_hci_start_poll()
371 r = nfc_hci_set_param(hdev, PN544_POLLING_LOOP_MGMT_GATE, pn544_hci_start_poll()
386 r = nfc_hci_set_param(hdev, PN544_POLLING_LOOP_MGMT_GATE, pn544_hci_start_poll()
392 hdev->gb = nfc_get_local_general_bytes(hdev->ndev, pn544_hci_start_poll()
393 &hdev->gb_len); pn544_hci_start_poll()
394 pr_debug("generate local bytes %p\n", hdev->gb); pn544_hci_start_poll()
395 if (hdev->gb == NULL || hdev->gb_len == 0) { pn544_hci_start_poll()
402 r = nfc_hci_send_event(hdev, pn544_hci_start_poll()
408 r = nfc_hci_set_param(hdev, pn544_hci_start_poll()
414 r = nfc_hci_set_param(hdev, pn544_hci_start_poll()
416 PN544_DEP_ATR_REQ, hdev->gb, hdev->gb_len); pn544_hci_start_poll()
420 r = nfc_hci_send_event(hdev, pn544_hci_start_poll()
424 nfc_hci_send_event(hdev, pn544_hci_start_poll()
430 r = nfc_hci_set_param(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE, pn544_hci_start_poll()
435 r = nfc_hci_set_param(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE, pn544_hci_start_poll()
436 PN544_DEP_ATR_RES, hdev->gb, hdev->gb_len); pn544_hci_start_poll()
440 r = nfc_hci_set_param(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE, pn544_hci_start_poll()
446 r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_start_poll()
449 nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_start_poll()
455 static int pn544_hci_dep_link_up(struct nfc_hci_dev *hdev, pn544_hci_dep_link_up() argument
462 r = nfc_hci_get_param(hdev, target->hci_reader_gate, pn544_hci_dep_link_up()
474 r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data, pn544_hci_dep_link_up()
478 r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode, pn544_hci_dep_link_up()
485 static int pn544_hci_dep_link_down(struct nfc_hci_dev *hdev) pn544_hci_dep_link_down() argument
488 return nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_INITIATOR_GATE, pn544_hci_dep_link_down()
492 static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, pn544_hci_target_from_gate() argument
513 static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev, pn544_hci_complete_target_discovered() argument
524 r = nfc_hci_send_cmd(hdev, pn544_hci_complete_target_discovered()
536 r = nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_complete_target_discovered()
540 r = nfc_hci_get_param(hdev, PN544_RF_READER_F_GATE, pn544_hci_complete_target_discovered()
553 r = nfc_hci_send_cmd(hdev, pn544_hci_complete_target_discovered()
564 r = nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE, pn544_hci_complete_target_discovered()
575 r = nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_complete_target_discovered()
614 static int pn544_hci_im_transceive(struct nfc_hci_dev *hdev, pn544_hci_im_transceive() argument
619 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_im_transceive()
644 return nfc_hci_send_cmd_async(hdev, pn544_hci_im_transceive()
659 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, pn544_hci_im_transceive()
664 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, pn544_hci_im_transceive()
670 return nfc_hci_send_event(hdev, target->hci_reader_gate, pn544_hci_im_transceive()
678 static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) pn544_hci_tm_send() argument
685 r = nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE, pn544_hci_tm_send()
693 static int pn544_hci_check_presence(struct nfc_hci_dev *hdev, pn544_hci_check_presence() argument
699 return nfc_hci_send_cmd(hdev, target->hci_reader_gate, pn544_hci_check_presence()
707 return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE, pn544_hci_check_presence()
714 return nfc_hci_send_cmd(hdev, target->hci_reader_gate, pn544_hci_check_presence()
727 static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, pn544_hci_event_received() argument
731 u8 gate = hdev->pipes[pipe].gate; pn544_hci_event_received()
738 r = nfc_hci_target_discovered(hdev, gate); pn544_hci_event_received()
740 r = nfc_hci_get_param(hdev, gate, PN544_DEP_ATR_REQ, pn544_hci_event_received()
745 r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK, pn544_hci_event_received()
755 r = nfc_hci_send_event(hdev, gate, NFC_HCI_EVT_END_OPERATION, pn544_hci_event_received()
771 return nfc_tm_data_received(hdev->ndev, skb); pn544_hci_event_received()
782 static int pn544_hci_fw_download(struct nfc_hci_dev *hdev, pn544_hci_fw_download() argument
785 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_fw_download()
790 return info->fw_download(info->phy_id, firmware_name, hdev->sw_romlib); pn544_hci_fw_download()
793 static int pn544_hci_discover_se(struct nfc_hci_dev *hdev) pn544_hci_discover_se() argument
800 r = nfc_hci_send_cmd(hdev, PN544_SYS_MGMT_GATE, PN544_TEST_SWP, pn544_hci_discover_se()
805 nfc_add_se(hdev->ndev, se_idx++, NFC_SE_UICC); pn544_hci_discover_se()
810 r = nfc_hci_send_event(hdev, PN544_NFC_WI_MGMT_GATE, pn544_hci_discover_se()
814 nfc_add_se(hdev->ndev, se_idx++, NFC_SE_EMBEDDED); pn544_hci_discover_se()
821 static int pn544_hci_enable_se(struct nfc_hci_dev *hdev, u32 se_idx) pn544_hci_enable_se() argument
840 se = nfc_find_se(hdev->ndev, se_idx); pn544_hci_enable_se()
845 r = nfc_hci_send_cmd(hdev, PN544_SYS_MGMT_GATE, pn544_hci_enable_se()
865 return nfc_hci_set_param(hdev, PN544_SWP_MGMT_GATE, pn544_hci_enable_se()
868 return nfc_hci_set_param(hdev, PN544_NFC_WI_MGMT_GATE, pn544_hci_enable_se()
876 static int pn544_hci_disable_se(struct nfc_hci_dev *hdev, u32 se_idx) pn544_hci_disable_se() argument
881 se = nfc_find_se(hdev->ndev, se_idx); pn544_hci_disable_se()
885 return nfc_hci_set_param(hdev, PN544_SWP_MGMT_GATE, pn544_hci_disable_se()
888 return nfc_hci_set_param(hdev, PN544_NFC_WI_MGMT_GATE, pn544_hci_disable_se()
917 fw_download_t fw_download, struct nfc_hci_dev **hdev) pn544_hci_probe()
953 info->hdev = nfc_hci_allocate_device(&pn544_hci_ops, &init_data, 0, pn544_hci_probe()
957 if (!info->hdev) { pn544_hci_probe()
958 pr_err("Cannot allocate nfc hdev\n"); pn544_hci_probe()
963 nfc_hci_set_clientdata(info->hdev, info); pn544_hci_probe()
965 r = nfc_hci_register_device(info->hdev); pn544_hci_probe()
969 *hdev = info->hdev; pn544_hci_probe()
974 nfc_hci_free_device(info->hdev); pn544_hci_probe()
984 void pn544_hci_remove(struct nfc_hci_dev *hdev) pn544_hci_remove() argument
986 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev); pn544_hci_remove()
988 nfc_hci_unregister_device(hdev); pn544_hci_remove()
989 nfc_hci_free_device(hdev); pn544_hci_remove()
915 pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, int phy_headroom, int phy_tailroom, int phy_payload, fw_download_t fw_download, struct nfc_hci_dev **hdev) pn544_hci_probe() argument
H A Dpn544.h33 fw_download_t fw_download, struct nfc_hci_dev **hdev);
34 void pn544_hci_remove(struct nfc_hci_dev *hdev);
H A Dmei.c46 NULL, &phy->hdev); pn544_mei_probe()
62 pn544_hci_remove(phy->hdev); pn544_mei_remove()
H A Di2c.c166 struct nfc_hci_dev *hdev; member in struct:pn544_i2c_phy
524 nfc_hci_recv_frame(phy->hdev, NULL); pn544_hci_i2c_irq_thread_fn()
531 nfc_hci_recv_frame(phy->hdev, skb); pn544_hci_i2c_irq_thread_fn()
573 nfc_fw_download_done(phy->hdev->ndev, phy->firmware_name, (u32) -result); pn544_hci_i2c_fw_work_complete()
1127 pn544_hci_i2c_fw_download, &phy->hdev); pn544_hci_i2c_probe()
1158 pn544_hci_remove(phy->hdev); pn544_hci_i2c_remove()
/linux-4.1.27/drivers/nfc/microread/
H A Dmicroread.c169 struct nfc_hci_dev *hdev; member in struct:microread_info
176 static int microread_open(struct nfc_hci_dev *hdev) microread_open() argument
178 struct microread_info *info = nfc_hci_get_clientdata(hdev); microread_open()
183 static void microread_close(struct nfc_hci_dev *hdev) microread_close() argument
185 struct microread_info *info = nfc_hci_get_clientdata(hdev); microread_close()
190 static int microread_hci_ready(struct nfc_hci_dev *hdev) microread_hci_ready() argument
196 r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_A, microread_hci_ready()
201 r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_A_3, microread_hci_ready()
209 r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_B, microread_hci_ready()
214 r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_NFC_T1, microread_hci_ready()
223 r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_NFC_T3, microread_hci_ready()
229 static int microread_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb) microread_xmit() argument
231 struct microread_info *info = nfc_hci_get_clientdata(hdev); microread_xmit()
236 static int microread_start_poll(struct nfc_hci_dev *hdev, microread_start_poll() argument
266 hdev->gb = nfc_get_local_general_bytes(hdev->ndev, microread_start_poll()
267 &hdev->gb_len); microread_start_poll()
268 if (hdev->gb == NULL || hdev->gb_len == 0) { microread_start_poll()
274 r = nfc_hci_send_event(hdev, MICROREAD_GATE_ID_MREAD_ISO_A, microread_start_poll()
280 r = nfc_hci_set_param(hdev, MICROREAD_GATE_ID_P2P_TARGET, microread_start_poll()
286 r = nfc_hci_set_param(hdev, MICROREAD_GATE_ID_P2P_INITIATOR, microread_start_poll()
288 hdev->gb, hdev->gb_len); microread_start_poll()
294 r = nfc_hci_set_param(hdev, MICROREAD_GATE_ID_P2P_TARGET, microread_start_poll()
296 hdev->gb, hdev->gb_len); microread_start_poll()
301 r = nfc_hci_set_param(hdev, MICROREAD_GATE_ID_P2P_TARGET, microread_start_poll()
307 return nfc_hci_send_event(hdev, MICROREAD_GATE_ID_MREAD_ISO_A, microread_start_poll()
312 static int microread_dep_link_up(struct nfc_hci_dev *hdev, microread_dep_link_up() argument
319 r = nfc_hci_get_param(hdev, target->hci_reader_gate, microread_dep_link_up()
329 r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data, microread_dep_link_up()
332 r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode, microread_dep_link_up()
340 static int microread_dep_link_down(struct nfc_hci_dev *hdev) microread_dep_link_down() argument
342 return nfc_hci_send_event(hdev, MICROREAD_GATE_ID_P2P_INITIATOR, microread_dep_link_down()
346 static int microread_target_from_gate(struct nfc_hci_dev *hdev, u8 gate, microread_target_from_gate() argument
360 static int microread_complete_target_discovered(struct nfc_hci_dev *hdev, microread_complete_target_discovered() argument
410 static int microread_im_transceive(struct nfc_hci_dev *hdev, microread_im_transceive() argument
415 struct microread_info *info = nfc_hci_get_clientdata(hdev); microread_im_transceive()
424 return nfc_hci_send_event(hdev, target->hci_reader_gate, microread_im_transceive()
462 return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate, microread_im_transceive()
468 static int microread_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) microread_tm_send() argument
472 r = nfc_hci_send_event(hdev, MICROREAD_GATE_ID_P2P_TARGET, microread_tm_send()
481 static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, microread_target_discovered() argument
548 r = nfc_targets_found(hdev->ndev, targets, 1); microread_target_discovered()
560 static int microread_event_received(struct nfc_hci_dev *hdev, u8 pipe, microread_event_received() argument
564 u8 gate = hdev->pipes[pipe].gate; microread_event_received()
571 microread_target_discovered(hdev, gate, skb); microread_event_received()
587 r = nfc_tm_data_received(hdev->ndev, skb); microread_event_received()
596 r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK, microread_event_received()
616 r = nfc_tm_data_received(hdev->ndev, skb); microread_event_received()
623 r = nfc_hci_set_param(hdev, MICROREAD_GATE_ID_P2P_TARGET, microread_event_received()
628 r = nfc_hci_send_event(hdev, gate, microread_event_received()
658 struct nfc_hci_dev **hdev) microread_probe()
689 info->hdev = nfc_hci_allocate_device(&microread_hci_ops, &init_data, microread_probe()
696 if (!info->hdev) { microread_probe()
697 pr_err("Cannot allocate nfc hdev\n"); microread_probe()
702 nfc_hci_set_clientdata(info->hdev, info); microread_probe()
704 r = nfc_hci_register_device(info->hdev); microread_probe()
708 *hdev = info->hdev; microread_probe()
713 nfc_hci_free_device(info->hdev); microread_probe()
723 void microread_remove(struct nfc_hci_dev *hdev) microread_remove() argument
725 struct microread_info *info = nfc_hci_get_clientdata(hdev); microread_remove()
727 nfc_hci_unregister_device(hdev); microread_remove()
728 nfc_hci_free_device(hdev); microread_remove()
656 microread_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, int phy_headroom, int phy_tailroom, int phy_payload, struct nfc_hci_dev **hdev) microread_probe() argument
H A Dmicroread.h27 struct nfc_hci_dev **hdev);
29 void microread_remove(struct nfc_hci_dev *hdev);
H A Dmei.c48 &phy->hdev); microread_mei_probe()
62 microread_remove(phy->hdev); microread_mei_remove()
H A Di2c.c51 struct nfc_hci_dev *hdev; member in struct:microread_i2c_phy
232 nfc_hci_recv_frame(phy->hdev, NULL); microread_i2c_irq_thread_fn()
239 nfc_hci_recv_frame(phy->hdev, skb); microread_i2c_irq_thread_fn()
285 MICROREAD_I2C_LLC_MAX_PAYLOAD, &phy->hdev); microread_i2c_probe()
303 microread_remove(phy->hdev); microread_i2c_remove()
/linux-4.1.27/include/net/nfc/
H A Dhci.h28 int (*open) (struct nfc_hci_dev *hdev);
29 void (*close) (struct nfc_hci_dev *hdev);
30 int (*load_session) (struct nfc_hci_dev *hdev);
31 int (*hci_ready) (struct nfc_hci_dev *hdev);
37 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
38 int (*start_poll) (struct nfc_hci_dev *hdev,
40 void (*stop_poll) (struct nfc_hci_dev *hdev);
41 int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target,
43 int (*dep_link_down)(struct nfc_hci_dev *hdev);
44 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
46 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
48 int (*im_transceive) (struct nfc_hci_dev *hdev,
51 int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
52 int (*check_presence)(struct nfc_hci_dev *hdev,
54 int (*event_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
56 void (*cmd_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
58 int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name);
174 void nfc_hci_free_device(struct nfc_hci_dev *hdev);
176 int nfc_hci_register_device(struct nfc_hci_dev *hdev);
177 void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
179 void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
180 void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
182 void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
186 void nfc_hci_reset_pipes_per_host(struct nfc_hci_dev *hdev, u8 host);
253 void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result,
255 void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
257 void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
259 void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb);
262 int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate,
264 int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate);
265 int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev);
266 int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
268 int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
270 int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
272 int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
275 int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
277 int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate);
H A Dllc.h28 typedef void (*rcv_to_hci_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
29 typedef int (*xmit_to_drv_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
30 typedef void (*llc_failure_t) (struct nfc_hci_dev *hdev, int err);
34 struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev,
/linux-4.1.27/drivers/usb/misc/
H A Dlvstest.c47 struct usb_device *udev, *hdev; create_lvs_device() local
56 hdev = interface_to_usbdev(intf); create_lvs_device()
57 hcd = bus_to_hcd(hdev->bus); create_lvs_device()
59 udev = usb_alloc_dev(hdev, hdev->bus, lvs->portnum); create_lvs_device()
81 struct usb_device *hdev = udev->parent; destroy_lvs_device() local
82 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); destroy_lvs_device()
90 static int lvs_rh_clear_port_feature(struct usb_device *hdev, lvs_rh_clear_port_feature() argument
93 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), lvs_rh_clear_port_feature()
98 static int lvs_rh_set_port_feature(struct usb_device *hdev, lvs_rh_set_port_feature() argument
101 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), lvs_rh_set_port_feature()
110 struct usb_device *hdev = interface_to_usbdev(intf); u3_entry_store() local
121 ret = lvs_rh_set_port_feature(hdev, lvs->portnum, u3_entry_store()
139 struct usb_device *hdev = interface_to_usbdev(intf); u3_exit_store() local
150 ret = lvs_rh_clear_port_feature(hdev, lvs->portnum, u3_exit_store()
168 struct usb_device *hdev = interface_to_usbdev(intf); hot_reset_store() local
172 ret = lvs_rh_set_port_feature(hdev, lvs->portnum, hot_reset_store()
187 struct usb_device *hdev = interface_to_usbdev(intf); u2_timeout_store() local
201 ret = lvs_rh_set_port_feature(hdev, lvs->portnum | (val << 8), u2_timeout_store()
216 struct usb_device *hdev = interface_to_usbdev(intf); u1_timeout_store() local
230 ret = lvs_rh_set_port_feature(hdev, lvs->portnum | (val << 8), u1_timeout_store()
299 struct usb_device *hdev = interface_to_usbdev(intf); lvs_rh_work() local
300 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); lvs_rh_work()
308 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), lvs_rh_work()
317 lvs_rh_clear_port_feature(hdev, i, lvs_rh_work()
320 lvs_rh_clear_port_feature(hdev, i, lvs_rh_work()
323 lvs_rh_clear_port_feature(hdev, i, lvs_rh_work()
326 lvs_rh_clear_port_feature(hdev, i, lvs_rh_work()
329 lvs_rh_clear_port_feature(hdev, i, lvs_rh_work()
364 struct usb_device *hdev; lvs_rh_probe() local
371 hdev = interface_to_usbdev(intf); lvs_rh_probe()
376 if (hdev->descriptor.bDeviceProtocol != USB_HUB_PR_SS || hdev->parent) { lvs_rh_probe()
389 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), lvs_rh_probe()
394 dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret); lvs_rh_probe()
420 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress); lvs_rh_probe()
421 maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe)); lvs_rh_probe()
422 usb_fill_int_urb(lvs->urb, hdev, pipe, &lvs->buffer[0], maxp, lvs_rh_probe()
/linux-4.1.27/drivers/media/platform/s5p-tv/
H A Dhdmi_drv.c117 void hdmi_write(struct hdmi_device *hdev, u32 reg_id, u32 value) hdmi_write() argument
119 writel(value, hdev->regs + reg_id); hdmi_write()
123 void hdmi_write_mask(struct hdmi_device *hdev, u32 reg_id, u32 value, u32 mask) hdmi_write_mask() argument
125 u32 old = readl(hdev->regs + reg_id); hdmi_write_mask()
127 writel(value, hdev->regs + reg_id); hdmi_write_mask()
131 void hdmi_writeb(struct hdmi_device *hdev, u32 reg_id, u8 value) hdmi_writeb() argument
133 writeb(value, hdev->regs + reg_id); hdmi_writeb()
137 void hdmi_writebn(struct hdmi_device *hdev, u32 reg_id, int n, u32 value) hdmi_writebn() argument
141 writeb(value >> 24, hdev->regs + reg_id + 12); hdmi_writebn()
143 writeb(value >> 16, hdev->regs + reg_id + 8); hdmi_writebn()
145 writeb(value >> 8, hdev->regs + reg_id + 4); hdmi_writebn()
147 writeb(value >> 0, hdev->regs + reg_id + 0); hdmi_writebn()
151 static inline u32 hdmi_read(struct hdmi_device *hdev, u32 reg_id) hdmi_read() argument
153 return readl(hdev->regs + reg_id); hdmi_read()
158 struct hdmi_device *hdev = dev_data; hdmi_irq_handler() local
162 intc_flag = hdmi_read(hdev, HDMI_INTC_FLAG); hdmi_irq_handler()
166 hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, hdmi_irq_handler()
171 hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, hdmi_irq_handler()
178 static void hdmi_reg_init(struct hdmi_device *hdev) hdmi_reg_init() argument
181 hdmi_write_mask(hdev, HDMI_INTC_CON, ~0, HDMI_INTC_EN_GLOBAL | hdmi_reg_init()
184 hdmi_write_mask(hdev, HDMI_MODE_SEL, hdmi_reg_init()
186 hdmi_write_mask(hdev, HDMI_CON_2, ~0, hdmi_reg_init()
189 hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); hdmi_reg_init()
191 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_0, 0x12); hdmi_reg_init()
192 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_1, 0x34); hdmi_reg_init()
193 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_2, 0x56); hdmi_reg_init()
196 static void hdmi_timing_apply(struct hdmi_device *hdev, hdmi_timing_apply() argument
200 hdmi_writebn(hdev, HDMI_H_BLANK_0, 2, t->hact.beg); hdmi_timing_apply()
201 hdmi_writebn(hdev, HDMI_H_SYNC_GEN_0, 3, hdmi_timing_apply()
203 hdmi_writeb(hdev, HDMI_VSYNC_POL, t->vsyn_pol); hdmi_timing_apply()
204 hdmi_writebn(hdev, HDMI_V_BLANK_0, 3, hdmi_timing_apply()
206 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_1_0, 3, hdmi_timing_apply()
211 hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 1); hdmi_timing_apply()
212 hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, hdmi_timing_apply()
214 hdmi_writebn(hdev, HDMI_V_BLANK_F_0, 3, hdmi_timing_apply()
216 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_2_0, 3, hdmi_timing_apply()
218 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_3_0, 3, hdmi_timing_apply()
221 hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 0); hdmi_timing_apply()
222 hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, hdmi_timing_apply()
227 hdmi_writebn(hdev, HDMI_TG_H_FSZ_L, 2, t->hact.end); hdmi_timing_apply()
228 hdmi_writebn(hdev, HDMI_TG_HACT_ST_L, 2, t->hact.beg); hdmi_timing_apply()
229 hdmi_writebn(hdev, HDMI_TG_HACT_SZ_L, 2, t->hact.end - t->hact.beg); hdmi_timing_apply()
230 hdmi_writebn(hdev, HDMI_TG_VSYNC_L, 2, t->vsyn[0].beg); hdmi_timing_apply()
231 hdmi_writebn(hdev, HDMI_TG_VACT_ST_L, 2, t->vact[0].beg); hdmi_timing_apply()
232 hdmi_writebn(hdev, HDMI_TG_VACT_SZ_L, 2, hdmi_timing_apply()
234 hdmi_writebn(hdev, HDMI_TG_VSYNC_TOP_HDMI_L, 2, t->vsyn[0].beg); hdmi_timing_apply()
235 hdmi_writebn(hdev, HDMI_TG_FIELD_TOP_HDMI_L, 2, t->vsyn[0].beg); hdmi_timing_apply()
237 hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_FIELD_EN); hdmi_timing_apply()
238 hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[1].end); hdmi_timing_apply()
239 hdmi_writebn(hdev, HDMI_TG_VSYNC2_L, 2, t->vsyn[1].beg); hdmi_timing_apply()
240 hdmi_writebn(hdev, HDMI_TG_FIELD_CHG_L, 2, t->vact[0].end); hdmi_timing_apply()
241 hdmi_writebn(hdev, HDMI_TG_VACT_ST2_L, 2, t->vact[1].beg); hdmi_timing_apply()
242 hdmi_writebn(hdev, HDMI_TG_VSYNC_BOT_HDMI_L, 2, t->vsyn[1].beg); hdmi_timing_apply()
243 hdmi_writebn(hdev, HDMI_TG_FIELD_BOT_HDMI_L, 2, t->vsyn[1].beg); hdmi_timing_apply()
245 hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_FIELD_EN); hdmi_timing_apply()
246 hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[0].end); hdmi_timing_apply()
292 static void hdmi_dumpregs(struct hdmi_device *hdev, char *prefix) hdmi_dumpregs() argument
295 dev_dbg(hdev->dev, "%s:" #reg_id " = %08x\n", prefix, \ hdmi_dumpregs()
296 readl(hdev->regs + reg_id)) hdmi_dumpregs()
298 dev_dbg(hdev->dev, "%s: ---- CONTROL REGISTERS ----\n", prefix); hdmi_dumpregs()
307 dev_dbg(hdev->dev, "%s: ---- CORE REGISTERS ----\n", prefix); hdmi_dumpregs()
320 dev_dbg(hdev->dev, "%s: ---- CORE SYNC REGISTERS ----\n", prefix); hdmi_dumpregs()
347 dev_dbg(hdev->dev, "%s: ---- TG REGISTERS ----\n", prefix); hdmi_dumpregs()
496 static int hdmi_streamon(struct hdmi_device *hdev) hdmi_streamon() argument
498 struct device *dev = hdev->dev; hdmi_streamon()
499 struct hdmi_resources *res = &hdev->res; hdmi_streamon()
504 ret = hdmi_conf_apply(hdev); hdmi_streamon()
508 ret = v4l2_subdev_call(hdev->phy_sd, video, s_stream, 1); hdmi_streamon()
514 u32 val = hdmi_read(hdev, HDMI_PHY_STATUS); hdmi_streamon()
522 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); hdmi_streamon()
523 hdmi_dumpregs(hdev, "hdmiphy - s_stream"); hdmi_streamon()
528 ret = v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 1); hdmi_streamon()
529 if (hdev->mhl_sd && ret) { hdmi_streamon()
530 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); hdmi_streamon()
531 hdmi_dumpregs(hdev, "mhl - s_stream"); hdmi_streamon()
541 hdmi_write_mask(hdev, HDMI_CON_0, ~0, HDMI_EN); hdmi_streamon()
542 hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_EN); hdmi_streamon()
543 hdmi_dumpregs(hdev, "streamon"); hdmi_streamon()
547 static int hdmi_streamoff(struct hdmi_device *hdev) hdmi_streamoff() argument
549 struct device *dev = hdev->dev; hdmi_streamoff()
550 struct hdmi_resources *res = &hdev->res; hdmi_streamoff()
554 hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_EN); hdmi_streamoff()
555 hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_EN); hdmi_streamoff()
562 v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 0); hdmi_streamoff()
563 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); hdmi_streamoff()
565 hdmi_dumpregs(hdev, "streamoff"); hdmi_streamoff()
571 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_s_stream() local
572 struct device *dev = hdev->dev; hdmi_s_stream()
576 return hdmi_streamon(hdev); hdmi_s_stream()
577 return hdmi_streamoff(hdev); hdmi_s_stream()
610 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_s_power() local
614 ret = pm_runtime_get_sync(hdev->dev); hdmi_s_power()
616 ret = pm_runtime_put_sync(hdev->dev); hdmi_s_power()
624 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_s_dv_timings() local
625 struct device *dev = hdev->dev; hdmi_s_dv_timings()
636 hdev->cur_conf = hdmi_timings[i].hdmi_timings; hdmi_s_dv_timings()
637 hdev->cur_conf_dirty = 1; hdmi_s_dv_timings()
638 hdev->cur_timings = *timings; hdmi_s_dv_timings()
640 hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS; hdmi_s_dv_timings()
654 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_g_mbus_fmt() local
655 const struct hdmi_timings *t = hdev->cur_conf; hdmi_g_mbus_fmt()
657 dev_dbg(hdev->dev, "%s\n", __func__); hdmi_g_mbus_fmt()
658 if (!hdev->cur_conf) hdmi_g_mbus_fmt()
690 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_dv_timings_cap() local
696 v4l2_subdev_call(hdev->phy_sd, pad, dv_timings_cap, cap); hdmi_dv_timings_cap()
732 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_runtime_suspend() local
735 v4l2_subdev_call(hdev->mhl_sd, core, s_power, 0); hdmi_runtime_suspend()
736 hdmi_resource_poweroff(&hdev->res); hdmi_runtime_suspend()
738 hdev->cur_conf_dirty = 1; hdmi_runtime_suspend()
745 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); hdmi_runtime_resume() local
750 ret = hdmi_resource_poweron(&hdev->res); hdmi_runtime_resume()
755 ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1); hdmi_runtime_resume()
756 if (hdev->mhl_sd && ret) hdmi_runtime_resume()
764 hdmi_resource_poweroff(&hdev->res); hdmi_runtime_resume()
784 static void hdmi_resources_cleanup(struct hdmi_device *hdev) hdmi_resources_cleanup() argument
786 struct hdmi_resources *res = &hdev->res; hdmi_resources_cleanup()
788 dev_dbg(hdev->dev, "HDMI resource cleanup\n"); hdmi_resources_cleanup()
808 static int hdmi_resources_init(struct hdmi_device *hdev) hdmi_resources_init() argument
810 struct device *dev = hdev->dev; hdmi_resources_init()
811 struct hdmi_resources *res = &hdev->res; hdmi_resources_init()
872 hdmi_resources_cleanup(hdev); hdmi_resources_init()
/linux-4.1.27/sound/hda/
H A Dhda_bus_type.c15 struct hdac_device *hdev = dev_to_hdac_dev(dev); hda_bus_match() local
18 if (hdev->type != hdrv->type) hda_bus_match()
21 return hdrv->match(hdev, hdrv); hda_bus_match()
/linux-4.1.27/include/linux/
H A Dhid.h566 static inline void *hid_get_drvdata(struct hid_device *hdev) hid_get_drvdata() argument
568 return dev_get_drvdata(&hdev->dev); hid_get_drvdata()
571 static inline void hid_set_drvdata(struct hid_device *hdev, void *data) hid_set_drvdata() argument
573 dev_set_drvdata(&hdev->dev, data); hid_set_drvdata()
685 int (*raw_event)(struct hid_device *hdev, struct hid_report *report,
688 int (*event)(struct hid_device *hdev, struct hid_field *field,
690 void (*report)(struct hid_device *hdev, struct hid_report *report);
692 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
695 int (*input_mapping)(struct hid_device *hdev,
698 int (*input_mapped)(struct hid_device *hdev,
701 void (*input_configured)(struct hid_device *hdev,
703 void (*feature_mapping)(struct hid_device *hdev,
707 int (*suspend)(struct hid_device *hdev, pm_message_t message);
708 int (*resume)(struct hid_device *hdev);
709 int (*reset_resume)(struct hid_device *hdev);
730 int (*start)(struct hid_device *hdev);
731 void (*stop)(struct hid_device *hdev);
733 int (*open)(struct hid_device *hdev);
734 void (*close)(struct hid_device *hdev);
736 int (*power)(struct hid_device *hdev, int level);
738 int (*parse)(struct hid_device *hdev);
740 void (*request)(struct hid_device *hdev,
743 int (*wait)(struct hid_device *hdev);
745 int (*raw_request) (struct hid_device *hdev, unsigned char reportnum,
749 int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
751 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
815 const struct hid_device_id *hid_match_id(struct hid_device *hdev,
913 * @hdev: hid device
919 static inline int __must_check hid_parse(struct hid_device *hdev) hid_parse() argument
921 return hid_open_report(hdev); hid_parse()
927 * @hdev: hid device
934 static inline int __must_check hid_hw_start(struct hid_device *hdev, hid_hw_start() argument
937 int ret = hdev->ll_driver->start(hdev); hid_hw_start()
940 ret = hid_connect(hdev, connect_mask); hid_hw_start()
942 hdev->ll_driver->stop(hdev); hid_hw_start()
949 * @hdev: hid device
954 static inline void hid_hw_stop(struct hid_device *hdev) hid_hw_stop() argument
956 hid_disconnect(hdev); hid_hw_stop()
957 hdev->ll_driver->stop(hdev); hid_hw_stop()
963 * @hdev: hid device
969 static inline int __must_check hid_hw_open(struct hid_device *hdev) hid_hw_open() argument
971 return hdev->ll_driver->open(hdev); hid_hw_open()
977 * @hdev: hid device
983 static inline void hid_hw_close(struct hid_device *hdev) hid_hw_close() argument
985 hdev->ll_driver->close(hdev); hid_hw_close()
991 * @hdev: hid device
998 static inline int hid_hw_power(struct hid_device *hdev, int level) hid_hw_power() argument
1000 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; hid_hw_power()
1007 * @hdev: hid device
1011 static inline void hid_hw_request(struct hid_device *hdev, hid_hw_request() argument
1014 if (hdev->ll_driver->request) hid_hw_request()
1015 return hdev->ll_driver->request(hdev, report, reqtype); hid_hw_request()
1017 __hid_request(hdev, report, reqtype); hid_hw_request()
1023 * @hdev: hid device
1034 static inline int hid_hw_raw_request(struct hid_device *hdev, hid_hw_raw_request() argument
1041 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len, hid_hw_raw_request()
1048 * @hdev: hid device
1054 static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, hid_hw_output_report() argument
1060 if (hdev->ll_driver->output_report) hid_hw_output_report()
1061 return hdev->ll_driver->output_report(hdev, buf, len); hid_hw_output_report()
1069 * @hdev: hid device
1074 static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle, hid_hw_idle() argument
1077 if (hdev->ll_driver->idle) hid_hw_idle()
1078 return hdev->ll_driver->idle(hdev, report, idle, reqtype); hid_hw_idle()
1086 * @hdev: hid device
1088 static inline void hid_hw_wait(struct hid_device *hdev) hid_hw_wait() argument
1090 if (hdev->ll_driver->wait) hid_hw_wait()
1091 hdev->ll_driver->wait(hdev); hid_hw_wait()
H A Dhid-debug.h46 struct hid_device *hdev; member in struct:hid_debug_list
H A Dhid-sensor-hub.h71 * @hdev: Stores the hid instance.
81 struct hid_device *hdev; member in struct:hid_sensor_hub_device
H A Dusb.h622 extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
627 * @hdev: USB device belonging to the usb hub
631 #define usb_hub_for_each_child(hdev, port1, child) \
632 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
633 port1 <= hdev->maxchild; \
634 child = usb_hub_find_child(hdev, ++port1)) \
649 extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
651 extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index);
653 static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index, usb_acpi_set_power_state() argument
655 static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index) usb_acpi_power_manageable() argument
781 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
783 int usb_hub_release_port(struct usb_device *hdev, unsigned port1,
/linux-4.1.27/drivers/video/fbdev/
H A Dhyperv_fb.c240 static inline int synthvid_send(struct hv_device *hdev, synthvid_send() argument
249 ret = vmbus_sendpacket(hdev->channel, msg, synthvid_send()
262 static int synthvid_send_situ(struct hv_device *hdev) synthvid_send_situ() argument
264 struct fb_info *info = hv_get_drvdata(hdev); synthvid_send_situ()
284 synthvid_send(hdev, &msg); synthvid_send_situ()
290 static int synthvid_send_ptr(struct hv_device *hdev) synthvid_send_ptr() argument
302 synthvid_send(hdev, &msg); synthvid_send_ptr()
318 synthvid_send(hdev, &msg); synthvid_send_ptr()
326 struct hv_device *hdev = device_to_hv_device(info->device); synthvid_update() local
341 synthvid_send(hdev, &msg); synthvid_update()
352 static void synthvid_recv_sub(struct hv_device *hdev) synthvid_recv_sub() argument
354 struct fb_info *info = hv_get_drvdata(hdev); synthvid_recv_sub()
375 synthvid_send_ptr(hdev); synthvid_recv_sub()
376 synthvid_send_situ(hdev); synthvid_recv_sub()
388 struct hv_device *hdev = ctx; synthvid_receive() local
389 struct fb_info *info = hv_get_drvdata(hdev); synthvid_receive()
403 ret = vmbus_recvpacket(hdev->channel, recv_buf, synthvid_receive()
408 synthvid_recv_sub(hdev); synthvid_receive()
413 static int synthvid_negotiate_ver(struct hv_device *hdev, u32 ver) synthvid_negotiate_ver() argument
415 struct fb_info *info = hv_get_drvdata(hdev); synthvid_negotiate_ver()
426 synthvid_send(hdev, msg); synthvid_negotiate_ver()
446 static int synthvid_connect_vsp(struct hv_device *hdev) synthvid_connect_vsp() argument
448 struct fb_info *info = hv_get_drvdata(hdev); synthvid_connect_vsp()
452 ret = vmbus_open(hdev->channel, RING_BUFSIZE, RING_BUFSIZE, synthvid_connect_vsp()
453 NULL, 0, synthvid_receive, hdev); synthvid_connect_vsp()
462 ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN7); synthvid_connect_vsp()
464 ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN8); synthvid_connect_vsp()
476 screen_fb_size = hdev->channel->offermsg.offer. synthvid_connect_vsp()
482 vmbus_close(hdev->channel); synthvid_connect_vsp()
487 static int synthvid_send_config(struct hv_device *hdev) synthvid_send_config() argument
489 struct fb_info *info = hv_get_drvdata(hdev); synthvid_send_config()
502 synthvid_send(hdev, msg); synthvid_send_config()
517 synthvid_send_ptr(hdev); synthvid_send_config()
518 synthvid_send_situ(hdev); synthvid_send_config()
573 struct hv_device *hdev = device_to_hv_device(info->device); hvfb_set_par() local
575 return synthvid_send_situ(hdev); hvfb_set_par()
770 static int hvfb_probe(struct hv_device *hdev, hvfb_probe() argument
777 info = framebuffer_alloc(sizeof(struct hvfb_par), &hdev->device); hvfb_probe()
790 hv_set_drvdata(hdev, info); hvfb_probe()
791 ret = synthvid_connect_vsp(hdev); hvfb_probe()
842 ret = synthvid_send_config(hdev); hvfb_probe()
864 vmbus_close(hdev->channel); hvfb_probe()
867 hv_set_drvdata(hdev, NULL); hvfb_probe()
873 static int hvfb_remove(struct hv_device *hdev) hvfb_remove() argument
875 struct fb_info *info = hv_get_drvdata(hdev); hvfb_remove()
887 vmbus_close(hdev->channel); hvfb_remove()
888 hv_set_drvdata(hdev, NULL); hvfb_remove()
/linux-4.1.27/arch/x86/kernel/
H A Dhpet.c359 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); hpet_set_mode() local
360 hpet_setup_msi_irq(hdev->irq); hpet_set_mode()
361 disable_irq(hdev->irq); hpet_set_mode()
362 irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); hpet_set_mode()
363 enable_irq(hdev->irq); hpet_set_mode()
429 struct hpet_dev *hdev = data->handler_data; hpet_msi_unmask() local
433 cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); hpet_msi_unmask()
435 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); hpet_msi_unmask()
440 struct hpet_dev *hdev = data->handler_data; hpet_msi_mask() local
444 cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); hpet_msi_mask()
446 hpet_writel(cfg, HPET_Tn_CFG(hdev->num)); hpet_msi_mask()
449 void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg) hpet_msi_write() argument
451 hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num)); hpet_msi_write()
452 hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4); hpet_msi_write()
455 void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg) hpet_msi_read() argument
457 msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num)); hpet_msi_read()
458 msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4); hpet_msi_read()
465 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); hpet_msi_set_mode() local
466 hpet_set_mode(mode, evt, hdev->num); hpet_msi_set_mode()
472 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); hpet_msi_next_event() local
473 return hpet_next_event(delta, evt, hdev->num); hpet_msi_next_event()
535 static void init_one_hpet_msi_clockevent(struct hpet_dev *hdev, int cpu) init_one_hpet_msi_clockevent() argument
537 struct clock_event_device *evt = &hdev->evt; init_one_hpet_msi_clockevent()
540 if (!(hdev->flags & HPET_DEV_VALID)) init_one_hpet_msi_clockevent()
543 if (hpet_setup_msi_irq(hdev->irq)) init_one_hpet_msi_clockevent()
546 hdev->cpu = cpu; init_one_hpet_msi_clockevent()
547 per_cpu(cpu_hpet_dev, cpu) = hdev; init_one_hpet_msi_clockevent()
548 evt->name = hdev->name; init_one_hpet_msi_clockevent()
549 hpet_setup_irq(hdev); init_one_hpet_msi_clockevent()
550 evt->irq = hdev->irq; init_one_hpet_msi_clockevent()
554 if (hdev->flags & HPET_DEV_PERI_CAP) init_one_hpet_msi_clockevent()
559 evt->cpumask = cpumask_of(hdev->cpu); init_one_hpet_msi_clockevent()
597 struct hpet_dev *hdev = &hpet_devs[num_timers_used]; hpet_msi_capability_lookup() local
604 hdev->flags = 0; hpet_msi_capability_lookup()
606 hdev->flags |= HPET_DEV_PERI_CAP; hpet_msi_capability_lookup()
607 hdev->num = i; hpet_msi_capability_lookup()
609 sprintf(hdev->name, "hpet%d", i); hpet_msi_capability_lookup()
610 if (hpet_assign_irq(hdev)) hpet_msi_capability_lookup()
613 hdev->flags |= HPET_DEV_FSB_CAP; hpet_msi_capability_lookup()
614 hdev->flags |= HPET_DEV_VALID; hpet_msi_capability_lookup()
633 struct hpet_dev *hdev = &hpet_devs[i]; hpet_reserve_msi_timers() local
635 if (!(hdev->flags & HPET_DEV_VALID)) hpet_reserve_msi_timers()
638 hd->hd_irq[hdev->num] = hdev->irq; hpet_reserve_msi_timers()
639 hpet_reserve_timer(hd, hdev->num); hpet_reserve_msi_timers()
652 struct hpet_dev *hdev = &hpet_devs[i]; hpet_get_unused_timer() local
654 if (!(hdev->flags & HPET_DEV_VALID)) hpet_get_unused_timer()
657 (unsigned long *)&hdev->flags)) hpet_get_unused_timer()
659 return hdev; hpet_get_unused_timer()
671 struct hpet_dev *hdev; hpet_work() local
677 hdev = hpet_get_unused_timer(); hpet_work()
678 if (hdev) hpet_work()
679 init_one_hpet_msi_clockevent(hdev, cpu); hpet_work()
689 struct hpet_dev *hdev = per_cpu(cpu_hpet_dev, cpu); hpet_cpuhp_notify() local
701 if (hdev) { hpet_cpuhp_notify()
702 free_irq(hdev->irq, hdev); hpet_cpuhp_notify()
703 hdev->flags &= ~HPET_DEV_USED; hpet_cpuhp_notify()
/linux-4.1.27/drivers/nfc/
H A Dmei_phy.h12 struct nfc_hci_dev *hdev; member in struct:nfc_mei_phy
H A Dmei_phy.c139 nfc_hci_recv_frame(phy->hdev, skb); nfc_mei_event_cb()
/linux-4.1.27/drivers/usb/core/
H A Dhub.c107 if (hub_is_superspeed(hub->hdev)) portspeed()
117 /* Note that hdev or one of its children must be locked! */ usb_hub_to_struct_hub()
118 struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) usb_hub_to_struct_hub() argument
120 if (!hdev || !hdev->actconfig || !hdev->maxchild) usb_hub_to_struct_hub()
122 return usb_get_intfdata(hdev->actconfig->interface[0]); usb_hub_to_struct_hub()
360 static int get_hub_descriptor(struct usb_device *hdev, void *data) get_hub_descriptor() argument
365 if (hub_is_superspeed(hdev)) { get_hub_descriptor()
374 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), get_hub_descriptor()
387 static int clear_hub_feature(struct usb_device *hdev, int feature) clear_hub_feature() argument
389 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), clear_hub_feature()
396 int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature) usb_clear_port_feature() argument
398 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), usb_clear_port_feature()
406 static int set_port_feature(struct usb_device *hdev, int port1, int feature) set_port_feature() argument
408 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), set_port_feature()
438 status = set_port_feature(hub->hdev, (selector << 8) | port1, set_port_led()
450 struct usb_device *hdev = hub->hdev; led_work() local
455 if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing) led_work()
458 for (i = 0; i < hdev->maxchild; i++) { led_work()
507 cursor %= hdev->maxchild; led_work()
524 static int get_hub_status(struct usb_device *hdev, get_hub_status() argument
531 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), get_hub_status()
541 static int get_port_status(struct usb_device *hdev, int port1, get_port_status() argument
548 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), get_port_status()
561 ret = get_port_status(hub->hdev, port1, &hub->status->port); hub_port_status()
605 void usb_kick_hub_wq(struct usb_device *hdev) usb_kick_hub_wq() argument
607 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_kick_hub_wq()
621 void usb_wakeup_notification(struct usb_device *hdev, usb_wakeup_notification() argument
626 if (!hdev) usb_wakeup_notification()
629 hub = usb_hub_to_struct_hub(hdev); usb_wakeup_notification()
685 hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) hub_clear_tt_buffer() argument
690 int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), hub_clear_tt_buffer()
696 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), hub_clear_tt_buffer()
717 struct usb_device *hdev = hub->hdev; hub_tt_work() local
727 status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt); hub_tt_work()
729 dev_err (&hdev->dev, hub_tt_work()
746 * @hdev: USB device belonging to the usb hub
756 int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, usb_hub_set_port_power() argument
762 ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); usb_hub_set_port_power()
764 ret = usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER); usb_hub_set_port_power()
846 for (port1 = 1; port1 <= hub->hdev->maxchild; port1++) hub_power_on()
848 set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER); hub_power_on()
850 usb_clear_port_feature(hub->hdev, port1, hub_power_on()
862 ret = get_hub_status(hub->hdev, &hub->status->hub); hub_hub_status()
879 return set_port_feature(hub->hdev, hub_set_port_link_state()
900 if (!hub_is_superspeed(hub->hdev)) hub_usb3_port_disable()
949 struct usb_device *hdev = hub->hdev; hub_port_disable() local
955 if (hub_is_superspeed(hub->hdev)) hub_port_disable()
958 ret = usb_clear_port_feature(hdev, port1, hub_port_disable()
1028 struct usb_device *hdev = hub->hdev; hub_activate() local
1063 if (hdev->parent && hub_is_superspeed(hdev)) { hub_activate()
1064 ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), hub_activate()
1066 hdev->level - 1, 0, NULL, 0, hub_activate()
1103 hcd = bus_to_hcd(hdev->bus); hub_activate()
1105 ret = hcd->driver->update_hub_device(hcd, hdev, hub_activate()
1127 for (port1 = 1; port1 <= hdev->maxchild; ++port1) { hub_activate()
1156 if (!hub_is_superspeed(hdev)) hub_activate()
1157 usb_clear_port_feature(hdev, port1, hub_activate()
1164 usb_clear_port_feature(hub->hdev, port1, hub_activate()
1169 usb_clear_port_feature(hub->hdev, port1, hub_activate()
1174 usb_clear_port_feature(hub->hdev, port1, hub_activate()
1178 hub_is_superspeed(hub->hdev)) { hub_activate()
1180 usb_clear_port_feature(hub->hdev, port1, hub_activate()
1210 if (portchange || (hub_is_superspeed(hub->hdev) && hub_activate()
1298 struct usb_device *hdev = hub->hdev; hub_quiesce() local
1308 for (i = 0; i < hdev->maxchild; ++i) { hub_quiesce()
1326 for (i = 0; i < hub->hdev->maxchild; ++i) hub_pm_barrier_for_all_ports()
1356 struct usb_device *hdev = hub->hdev; hub_configure() local
1390 ret = get_hub_descriptor(hdev, hub->descriptor); hub_configure()
1415 if (hub_is_superspeed(hdev)) { hub_configure()
1425 !(hub_is_superspeed(hdev))) { hub_configure()
1467 switch (hdev->descriptor.bDeviceProtocol) { hub_configure()
1472 hub->tt.hub = hdev; hub_configure()
1475 ret = usb_set_interface(hdev, 0, 1); hub_configure()
1482 hub->tt.hub = hdev; hub_configure()
1489 hdev->descriptor.bDeviceProtocol); hub_configure()
1496 if (hdev->descriptor.bDeviceProtocol != 0) { hub_configure()
1535 ret = usb_get_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus); hub_configure()
1540 hcd = bus_to_hcd(hdev->bus); hub_configure()
1541 if (hdev == hdev->bus->root_hub) { hub_configure()
1543 hdev->bus_mA = hcd->power_budget; hub_configure()
1545 hdev->bus_mA = full_load * maxchild; hub_configure()
1546 if (hdev->bus_mA >= full_load) hub_configure()
1549 hub->mA_per_port = hdev->bus_mA; hub_configure()
1553 int remaining = hdev->bus_mA - hub_configure()
1582 if (hdev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_SELFPOWER) hub_configure()
1597 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress); hub_configure()
1598 maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe)); hub_configure()
1609 usb_fill_int_urb(hub->urb, hdev, pipe, *hub->buffer, maxp, hub_irq, hub_configure()
1625 hdev->maxchild = i; hub_configure()
1626 for (i = 0; i < hdev->maxchild; i++) { hub_configure()
1640 ret = hcd->driver->update_hub_device(hcd, hdev, hub_configure()
1648 usb_hub_adjust_deviceremovable(hdev, hub->descriptor); hub_configure()
1664 usb_put_dev(hub->hdev); hub_release()
1674 struct usb_device *hdev = interface_to_usbdev(intf); hub_disconnect() local
1691 port1 = hdev->maxchild; hub_disconnect()
1692 hdev->maxchild = 0; hub_disconnect()
1701 if (hub->hdev->speed == USB_SPEED_HIGH) hub_disconnect()
1718 struct usb_device *hdev; hub_probe() local
1722 hdev = interface_to_usbdev(intf); hub_probe()
1761 if (hdev->dev.power.autosuspend_delay >= 0) hub_probe()
1762 pm_runtime_set_autosuspend_delay(&hdev->dev, 0); hub_probe()
1770 if (hdev->parent) { /* normal device */ hub_probe()
1771 usb_enable_autosuspend(hdev); hub_probe()
1773 const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver; hub_probe()
1776 usb_enable_autosuspend(hdev); hub_probe()
1779 if (hdev->level == MAX_TOPO_LEVEL) { hub_probe()
1786 if (hdev->parent) { hub_probe()
1822 hub->hdev = hdev; hub_probe()
1827 usb_get_dev(hdev); hub_probe()
1833 if (hdev->speed == USB_SPEED_HIGH) hub_probe()
1849 struct usb_device *hdev = interface_to_usbdev (intf); hub_ioctl() local
1850 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); hub_ioctl()
1859 if (hdev->devnum <= 0) hub_ioctl()
1862 info->nports = hdev->maxchild; hub_ioctl()
1885 static int find_port_owner(struct usb_device *hdev, unsigned port1, find_port_owner() argument
1888 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); find_port_owner()
1890 if (hdev->state == USB_STATE_NOTATTACHED) find_port_owner()
1892 if (port1 == 0 || port1 > hdev->maxchild) find_port_owner()
1902 /* In the following three functions, the caller must hold hdev's lock */ usb_hub_claim_port()
1903 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, usb_hub_claim_port() argument
1909 rc = find_port_owner(hdev, port1, &powner); usb_hub_claim_port()
1919 int usb_hub_release_port(struct usb_device *hdev, unsigned port1, usb_hub_release_port() argument
1925 rc = find_port_owner(hdev, port1, &powner); usb_hub_release_port()
1935 void usb_hub_release_all_ports(struct usb_device *hdev, struct usb_dev_state *owner) usb_hub_release_all_ports() argument
1937 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_hub_release_all_ports()
1940 for (n = 0; n < hdev->maxchild; n++) { usb_hub_release_all_ports()
2362 struct usb_device *hdev = udev->parent; set_usb_port_removable() local
2368 if (!hdev) set_usb_port_removable()
2378 if (hub_is_superspeed(hdev)) { set_usb_port_removable()
2605 if (hub->hdev->parent != NULL) /* not a root hub? */ hub_is_wusb()
2607 hcd = container_of(hub->hdev->bus, struct usb_hcd, self); hub_is_wusb()
2647 if (!hub_is_superspeed(hub->hdev)) hub_port_warm_reset_required()
2703 if (!hub_is_superspeed(hub->hdev) && hub_port_wait_reset()
2715 else if (hub_is_superspeed(hub->hdev)) hub_port_wait_reset()
2734 if (!hub_is_superspeed(hub->hdev)) { hub_port_reset()
2758 status = set_port_feature(hub->hdev, port1, (warm ? hub_port_reset()
2778 usb_clear_port_feature(hub->hdev, port1, hub_port_reset()
2781 if (!hub_is_superspeed(hub->hdev)) hub_port_reset()
2784 usb_clear_port_feature(hub->hdev, port1, hub_port_reset()
2786 usb_clear_port_feature(hub->hdev, port1, hub_port_reset()
2788 usb_clear_port_feature(hub->hdev, port1, hub_port_reset()
2843 if (!hub_is_superspeed(hub->hdev)) hub_port_reset()
2854 if (hub_is_superspeed(hub->hdev)) { port_is_power_on()
2886 if (hub_is_superspeed(hub->hdev)) { port_is_suspended()
2946 usb_clear_port_feature(hub->hdev, port1, check_port_resume_type()
2949 usb_clear_port_feature(hub->hdev, port1, check_port_resume_type()
3152 if (hub_is_superspeed(hub->hdev)) usb_port_suspend()
3167 status = set_port_feature(hub->hdev, port1, usb_port_suspend()
3209 usb_mark_last_busy(hub->hdev); usb_port_suspend()
3405 if (hub_is_superspeed(hub->hdev)) usb_port_resume()
3408 status = usb_clear_port_feature(hub->hdev, usb_port_resume()
3431 if (hub_is_superspeed(hub->hdev)) { usb_port_resume()
3433 usb_clear_port_feature(hub->hdev, port1, usb_port_resume()
3437 usb_clear_port_feature(hub->hdev, port1, usb_port_resume()
3442 if (udev->persist_enabled && hub_is_superspeed(hub->hdev)) usb_port_resume()
3491 struct usb_device *hdev; variable in typeref:struct:usb_device
3496 hdev = hub->hdev;
3498 if (!hub_is_superspeed(hdev)) {
3501 usb_clear_port_feature(hdev, port, USB_PORT_FEAT_C_SUSPEND);
3530 for (port1 = 1; port1 <= hub->hdev->maxchild; ++port1) { check_ports_changed()
3544 struct usb_device *hdev = hub->hdev; hub_suspend() local
3553 for (port1 = 1; port1 <= hdev->maxchild; port1++) { hub_suspend()
3568 if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { hub_suspend()
3573 pm_wakeup_event(&hdev->dev, 2000); hub_suspend()
3577 if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) { hub_suspend()
3579 for (port1 = 1; port1 <= hdev->maxchild; port1++) { hub_suspend()
3580 status = set_port_feature(hdev, hub_suspend()
4125 usb_clear_port_feature(hub->hdev, port1, hub_port_debounce()
4238 struct usb_device *hdev = hub->hdev; hub_port_init() local
4239 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); hub_port_init()
4249 if (!hdev->parent) { hub_port_init()
4251 if (port1 == hdev->bus->otg_port) hub_port_init()
4252 hdev->bus->b_hnp_enable = 0; hub_port_init()
4316 if (hdev->tt) { hub_port_init()
4317 udev->tt = hdev->tt; hub_port_init()
4318 udev->ttport = hdev->ttport; hub_port_init()
4320 && hdev->speed == USB_SPEED_HIGH) { hub_port_init()
4577 struct usb_device *hdev = hub->hdev; hub_power_remaining() local
4584 remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent; hub_power_remaining()
4585 for (port1 = 1; port1 <= hdev->maxchild; ++port1) { hub_power_remaining()
4604 else if (port1 != udev->bus->otg_port || hdev->parent) hub_power_remaining()
4626 struct usb_device *hdev = hub->hdev; hub_port_connect() local
4627 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); hub_port_connect()
4634 if (hcd->usb_phy && !hdev->parent) hub_port_connect()
4674 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); hub_port_connect()
4680 if (hub_is_superspeed(hub->hdev)) hub_port_connect()
4691 udev = usb_alloc_dev(hdev, hdev->bus, port1); hub_port_connect()
4700 udev->level = hdev->level + 1; hub_port_connect()
4704 if (hub_is_superspeed(hub->hdev)) hub_port_connect()
4765 * no one will look at it until hdev is unlocked. hub_port_connect()
4776 if (hdev->state == USB_STATE_NOTATTACHED) hub_port_connect()
4793 if (hcd->usb_phy && !hdev->parent) hub_port_connect()
4818 if (hub->hdev->parent || hub_port_connect()
4828 if (hcd->driver->relinquish_port && !hub->hdev->parent) hub_port_connect()
4859 if (hub->hdev->bus->is_b_host)
4900 struct usb_device *hdev = hub->hdev; variable in typeref:struct:usb_device
4911 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
4919 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE);
4937 usb_clear_port_feature(hdev, port1,
4948 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_RESET);
4951 && hub_is_superspeed(hdev)) {
4953 usb_clear_port_feature(hdev, port1,
4958 usb_clear_port_feature(hdev, port1,
4963 usb_clear_port_feature(hdev, port1,
5001 struct usb_device *hdev; hub_event() local
5010 hdev = hub->hdev; hub_event()
5015 hdev->state, hdev->maxchild, hub_event()
5022 usb_lock_device(hdev); hub_event()
5027 if (hdev->state == USB_STATE_NOTATTACHED) { hub_event()
5047 ret = usb_reset_device(hdev); hub_event()
5058 for (i = 1; i <= hdev->maxchild; i++) { hub_event()
5090 clear_hub_feature(hdev, C_HUB_LOCAL_POWER); hub_event()
5102 clear_hub_feature(hdev, C_HUB_OVER_CURRENT); hub_event()
5115 usb_unlock_device(hdev); hub_event()
5608 * @hdev: USB device belonging to the usb hub
5618 struct usb_device *usb_hub_find_child(struct usb_device *hdev, usb_hub_find_child() argument
5621 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_hub_find_child()
5623 if (port1 < 1 || port1 > hdev->maxchild) usb_hub_find_child()
5629 void usb_hub_adjust_deviceremovable(struct usb_device *hdev, usb_hub_adjust_deviceremovable() argument
5632 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_hub_adjust_deviceremovable()
5639 if (!hub_is_superspeed(hdev)) { usb_hub_adjust_deviceremovable()
5640 for (i = 1; i <= hdev->maxchild; i++) { usb_hub_adjust_deviceremovable()
5656 for (i = 1; i <= hdev->maxchild; i++) { usb_hub_adjust_deviceremovable()
5677 * @hdev: USB device belonging to the usb hub
5683 acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, usb_get_hub_port_acpi_handle() argument
5686 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_get_hub_port_acpi_handle()
H A Dport.c79 struct usb_device *hdev = to_usb_device(dev->parent->parent); usb_port_runtime_resume() local
81 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_port_runtime_resume()
102 retval = usb_hub_set_port_power(hdev, hub, port1, true); usb_port_runtime_resume()
116 if (hub_is_superspeed(hdev)) usb_port_runtime_resume()
135 struct usb_device *hdev = to_usb_device(dev->parent->parent); usb_port_runtime_suspend() local
137 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_port_runtime_suspend()
155 retval = usb_hub_set_port_power(hdev, hub, port1, false); usb_port_runtime_suspend()
156 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); usb_port_runtime_suspend()
158 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); usb_port_runtime_suspend()
321 struct usb_device *hdev = to_usb_device(port_dev->dev.parent->parent); match_location() local
326 hcd = bus_to_hcd(hdev->bus); match_location()
351 struct usb_device *hdev = hub->hdev; find_and_link_peer() local
365 } else if (!hdev->parent) { find_and_link_peer()
366 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); find_and_link_peer()
375 struct usb_device *parent = hdev->parent; find_and_link_peer()
381 upstream = parent_hub->ports[hdev->portnum - 1]; find_and_link_peer()
423 if (hub_is_superspeed(hub->hdev)) usb_hub_create_port_device()
425 dev_set_name(&port_dev->dev, "%s-port%d", dev_name(&hub->hdev->dev), usb_hub_create_port_device()
447 * and the hub has been fully registered (hdev->maxchild set). usb_hub_create_port_device()
H A Dhub.h29 struct usb_device *hdev; member in struct:usb_hub
116 extern int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub,
118 extern struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev);
121 extern int usb_clear_port_feature(struct usb_device *hdev,
134 static inline int hub_is_superspeed(struct usb_device *hdev) hub_is_superspeed() argument
136 return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS; hub_is_superspeed()
H A Dusb-acpi.c25 * @hdev: USB device belonging to the usb hub
30 bool usb_acpi_power_manageable(struct usb_device *hdev, int index) usb_acpi_power_manageable() argument
35 port_handle = usb_get_hub_port_acpi_handle(hdev, usb_acpi_power_manageable()
47 * @hdev: USB device belonging to the usb hub
56 int usb_acpi_set_power_state(struct usb_device *hdev, int index, bool enable) usb_acpi_set_power_state() argument
58 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); usb_acpi_set_power_state()
69 port_handle = (acpi_handle) usb_get_hub_port_acpi_handle(hdev, port1); usb_acpi_set_power_state()
H A Dusb.h60 extern void usb_hub_release_all_ports(struct usb_device *hdev,
176 extern void usb_hub_adjust_deviceremovable(struct usb_device *hdev,
182 extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
/linux-4.1.27/drivers/staging/lustre/lnet/klnds/o2iblnd/
H A Do2iblnd.c1195 kib_hca_dev_t *hdev = tpo->tpo_hdev; kiblnd_unmap_tx_pool() local
1201 if (hdev == NULL) kiblnd_unmap_tx_pool()
1206 kiblnd_dma_unmap_single(hdev->ibh_ibdev, kiblnd_unmap_tx_pool()
1212 kiblnd_hdev_decref(hdev); kiblnd_unmap_tx_pool()
1218 kib_hca_dev_t *hdev; kiblnd_current_hdev() local
1234 hdev = dev->ibd_hdev; kiblnd_current_hdev()
1238 return hdev; kiblnd_current_hdev()
1292 struct ib_mr *kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) kiblnd_find_dma_mr() argument
1296 LASSERT(hdev->ibh_mrs[0] != NULL); kiblnd_find_dma_mr()
1298 if (hdev->ibh_nmrs == 1) kiblnd_find_dma_mr()
1299 return hdev->ibh_mrs[0]; kiblnd_find_dma_mr()
1301 index = addr >> hdev->ibh_mr_shift; kiblnd_find_dma_mr()
1303 if (index < hdev->ibh_nmrs && kiblnd_find_dma_mr()
1304 index == ((addr + size - 1) >> hdev->ibh_mr_shift)) kiblnd_find_dma_mr()
1305 return hdev->ibh_mrs[index]; kiblnd_find_dma_mr()
1310 struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) kiblnd_find_rd_dma_mr() argument
1316 LASSERT(hdev->ibh_mrs[0] != NULL); kiblnd_find_rd_dma_mr()
1322 if (hdev->ibh_nmrs == 1) kiblnd_find_rd_dma_mr()
1323 return hdev->ibh_mrs[0]; kiblnd_find_rd_dma_mr()
1327 mr = kiblnd_find_dma_mr(hdev, kiblnd_find_rd_dma_mr()
1801 int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, kiblnd_pmr_pool_map() argument
1816 if (pmr->pmr_pool->ppo_hdev != hdev) { kiblnd_pmr_pool_map()
1826 pmr->pmr_mr = ib_reg_phys_mr(hdev->ibh_pd, kiblnd_pmr_pool_map()
2241 static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev) kiblnd_hdev_get_attr() argument
2248 hdev->ibh_page_shift = PAGE_SHIFT; kiblnd_hdev_get_attr()
2249 hdev->ibh_page_size = 1 << PAGE_SHIFT; kiblnd_hdev_get_attr()
2250 hdev->ibh_page_mask = ~((__u64)hdev->ibh_page_size - 1); kiblnd_hdev_get_attr()
2258 rc = ib_query_device(hdev->ibh_ibdev, attr); kiblnd_hdev_get_attr()
2260 hdev->ibh_mr_size = attr->max_mr_size; kiblnd_hdev_get_attr()
2269 if (hdev->ibh_mr_size == ~0ULL) { kiblnd_hdev_get_attr()
2270 hdev->ibh_mr_shift = 64; kiblnd_hdev_get_attr()
2274 for (hdev->ibh_mr_shift = 0; kiblnd_hdev_get_attr()
2275 hdev->ibh_mr_shift < 64; hdev->ibh_mr_shift++) { kiblnd_hdev_get_attr()
2276 if (hdev->ibh_mr_size == (1ULL << hdev->ibh_mr_shift) || kiblnd_hdev_get_attr()
2277 hdev->ibh_mr_size == (1ULL << hdev->ibh_mr_shift) - 1) kiblnd_hdev_get_attr()
2281 CERROR("Invalid mr size: %#llx\n", hdev->ibh_mr_size); kiblnd_hdev_get_attr()
2285 static void kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev) kiblnd_hdev_cleanup_mrs() argument
2289 if (hdev->ibh_nmrs == 0 || hdev->ibh_mrs == NULL) kiblnd_hdev_cleanup_mrs()
2292 for (i = 0; i < hdev->ibh_nmrs; i++) { kiblnd_hdev_cleanup_mrs()
2293 if (hdev->ibh_mrs[i] == NULL) kiblnd_hdev_cleanup_mrs()
2296 ib_dereg_mr(hdev->ibh_mrs[i]); kiblnd_hdev_cleanup_mrs()
2299 LIBCFS_FREE(hdev->ibh_mrs, sizeof(*hdev->ibh_mrs) * hdev->ibh_nmrs); kiblnd_hdev_cleanup_mrs()
2300 hdev->ibh_mrs = NULL; kiblnd_hdev_cleanup_mrs()
2301 hdev->ibh_nmrs = 0; kiblnd_hdev_cleanup_mrs()
2304 void kiblnd_hdev_destroy(kib_hca_dev_t *hdev) kiblnd_hdev_destroy() argument
2306 kiblnd_hdev_cleanup_mrs(hdev); kiblnd_hdev_destroy()
2308 if (hdev->ibh_pd != NULL) kiblnd_hdev_destroy()
2309 ib_dealloc_pd(hdev->ibh_pd); kiblnd_hdev_destroy()
2311 if (hdev->ibh_cmid != NULL) kiblnd_hdev_destroy()
2312 rdma_destroy_id(hdev->ibh_cmid); kiblnd_hdev_destroy()
2314 LIBCFS_FREE(hdev, sizeof(*hdev)); kiblnd_hdev_destroy()
2317 static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) kiblnd_hdev_setup_mrs() argument
2327 rc = kiblnd_hdev_get_attr(hdev); kiblnd_hdev_setup_mrs()
2331 if (hdev->ibh_mr_shift == 64) { kiblnd_hdev_setup_mrs()
2332 LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs)); kiblnd_hdev_setup_mrs()
2333 if (hdev->ibh_mrs == NULL) { kiblnd_hdev_setup_mrs()
2338 hdev->ibh_mrs[0] = NULL; kiblnd_hdev_setup_mrs()
2339 hdev->ibh_nmrs = 1; kiblnd_hdev_setup_mrs()
2341 mr = ib_get_dma_mr(hdev->ibh_pd, acflags); kiblnd_hdev_setup_mrs()
2344 kiblnd_hdev_cleanup_mrs(hdev); kiblnd_hdev_setup_mrs()
2348 hdev->ibh_mrs[0] = mr; kiblnd_hdev_setup_mrs()
2353 mr_size = 1ULL << hdev->ibh_mr_shift; kiblnd_hdev_setup_mrs()
2356 hdev->ibh_nmrs = (int)((mm_size + mr_size - 1) >> hdev->ibh_mr_shift); kiblnd_hdev_setup_mrs()
2358 if (hdev->ibh_mr_shift < 32 || hdev->ibh_nmrs > 1024) { kiblnd_hdev_setup_mrs()
2366 LIBCFS_ALLOC(hdev->ibh_mrs, sizeof(*hdev->ibh_mrs) * hdev->ibh_nmrs); kiblnd_hdev_setup_mrs()
2367 if (hdev->ibh_mrs == NULL) { kiblnd_hdev_setup_mrs()
2372 for (i = 0; i < hdev->ibh_nmrs; i++) { kiblnd_hdev_setup_mrs()
2376 ipb.size = hdev->ibh_mr_size; kiblnd_hdev_setup_mrs()
2380 mr = ib_reg_phys_mr(hdev->ibh_pd, &ipb, 1, acflags, &iova); kiblnd_hdev_setup_mrs()
2384 kiblnd_hdev_cleanup_mrs(hdev); kiblnd_hdev_setup_mrs()
2390 hdev->ibh_mrs[i] = mr; kiblnd_hdev_setup_mrs()
2394 if (hdev->ibh_mr_size != ~0ULL || hdev->ibh_nmrs != 1) kiblnd_hdev_setup_mrs()
2396 hdev->ibh_mr_size, hdev->ibh_nmrs); kiblnd_hdev_setup_mrs()
2468 kib_hca_dev_t *hdev = NULL; kiblnd_dev_failover() local
2525 LIBCFS_ALLOC(hdev, sizeof(*hdev)); kiblnd_dev_failover()
2526 if (hdev == NULL) { kiblnd_dev_failover()
2533 atomic_set(&hdev->ibh_ref, 1); kiblnd_dev_failover()
2534 hdev->ibh_dev = dev; kiblnd_dev_failover()
2535 hdev->ibh_cmid = cmid; kiblnd_dev_failover()
2536 hdev->ibh_ibdev = cmid->device; kiblnd_dev_failover()
2545 hdev->ibh_pd = pd; kiblnd_dev_failover()
2553 rc = kiblnd_hdev_setup_mrs(hdev); kiblnd_dev_failover()
2562 dev->ibd_hdev = hdev; /* take over the refcount */ kiblnd_dev_failover()
2563 hdev = old; kiblnd_dev_failover()
2589 if (hdev != NULL)
2590 kiblnd_hdev_decref(hdev);
H A Do2iblnd.h628 extern void kiblnd_hdev_destroy(kib_hca_dev_t *hdev);
631 kiblnd_hdev_addref_locked(kib_hca_dev_t *hdev) kiblnd_hdev_addref_locked() argument
633 LASSERT (atomic_read(&hdev->ibh_ref) > 0); kiblnd_hdev_addref_locked()
634 atomic_inc(&hdev->ibh_ref); kiblnd_hdev_addref_locked()
638 kiblnd_hdev_decref(kib_hca_dev_t *hdev) kiblnd_hdev_decref() argument
640 LASSERT (atomic_read(&hdev->ibh_ref) > 0); kiblnd_hdev_decref()
641 if (atomic_dec_and_test(&hdev->ibh_ref)) kiblnd_hdev_decref()
642 kiblnd_hdev_destroy(hdev); kiblnd_hdev_decref()
948 struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev,
950 struct ib_mr *kiblnd_find_dma_mr(kib_hca_dev_t *hdev,
964 int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,
H A Do2iblnd_cb.c553 kib_hca_dev_t *hdev; kiblnd_fmr_map_tx() local
565 hdev = tx->tx_pool->tpo_hdev; kiblnd_fmr_map_tx()
569 size += hdev->ibh_page_size) { kiblnd_fmr_map_tx()
571 hdev->ibh_page_mask) + size; kiblnd_fmr_map_tx()
588 rd->rd_frags[0].rf_addr &= ~hdev->ibh_page_mask; kiblnd_fmr_map_tx()
598 kib_hca_dev_t *hdev; kiblnd_pmr_map_tx() local
607 hdev = tx->tx_pool->tpo_hdev; kiblnd_pmr_map_tx()
609 iova = rd->rd_frags[0].rf_addr & ~hdev->ibh_page_mask; kiblnd_pmr_map_tx()
614 rc = kiblnd_pmr_pool_map(pps, hdev, rd, &iova, &tx->tx_u.pmr); kiblnd_pmr_map_tx()
658 kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev; kiblnd_map_tx() local
670 kiblnd_dma_map_sg(hdev->ibh_ibdev, kiblnd_map_tx()
675 hdev->ibh_ibdev, &tx->tx_frags[i]); kiblnd_map_tx()
677 hdev->ibh_ibdev, &tx->tx_frags[i]); kiblnd_map_tx()
682 mr = kiblnd_find_rd_dma_mr(hdev, rd); kiblnd_map_tx()
1054 kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev; kiblnd_init_tx_msg() local
1066 mr = kiblnd_find_dma_mr(hdev, tx->tx_msgaddr, nob); kiblnd_init_tx_msg()
/linux-4.1.27/net/nfc/nci/
H A Dhci.c119 static void nci_hci_reset_pipes(struct nci_hci_dev *hdev) nci_hci_reset_pipes() argument
124 hdev->pipes[i].gate = NCI_HCI_INVALID_GATE; nci_hci_reset_pipes()
125 hdev->pipes[i].host = NCI_HCI_INVALID_HOST; nci_hci_reset_pipes()
127 memset(hdev->gate2pipe, NCI_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe)); nci_hci_reset_pipes()
398 struct nci_hci_dev *hdev = nci_hci_msg_rx_work() local
404 while ((skb = skb_dequeue(&hdev->msg_rx_queue)) != NULL) { nci_hci_msg_rx_work()
412 nci_hci_hcp_message_rx(hdev->ndev, pipe, nci_hci_msg_rx_work()
720 struct nci_hci_dev *hdev; nci_hci_allocate() local
722 hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); nci_hci_allocate()
723 if (!hdev) nci_hci_allocate()
726 skb_queue_head_init(&hdev->rx_hcp_frags); nci_hci_allocate()
727 INIT_WORK(&hdev->msg_rx_work, nci_hci_msg_rx_work); nci_hci_allocate()
728 skb_queue_head_init(&hdev->msg_rx_queue); nci_hci_allocate()
729 hdev->ndev = ndev; nci_hci_allocate()
731 return hdev; nci_hci_allocate()
/linux-4.1.27/drivers/isdn/hardware/eicon/
H A Ddiva_dma.h42 void diva_init_dma_map(void *hdev,
45 void diva_free_dma_map(void *hdev,
H A Dos_bri.c81 void *hdev; diva_bri_init_card() local
97 a->resources.pci.hdev); diva_bri_init_card()
107 a->resources.pci.hdev); diva_bri_init_card()
119 hdev = a->resources.pci.hdev; diva_bri_init_card()
124 PCIread(Bus, Slot, 0x18, &bar2, sizeof(bar2), hdev); diva_bri_init_card()
125 PCIread(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev); diva_bri_init_card()
129 PCIwrite(Bus, Slot, 0x04, &cmd, sizeof(cmd), hdev); diva_bri_init_card()
130 PCIwrite(Bus, Slot, 0x18, &bar2_length, sizeof(bar2_length), hdev); diva_bri_init_card()
131 PCIread(Bus, Slot, 0x18, &bar2_length, sizeof(bar2_length), hdev); diva_bri_init_card()
135 PCIwrite(Bus, Slot, 0x18, &bar2, sizeof(bar2), hdev); diva_bri_init_card()
136 PCIwrite(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev); diva_bri_init_card()
H A Dxdi_adapter.h12 void *hdev; member in struct:_divas_pci_card_resources
H A Dos_pri.c126 a->resources.pci.hdev); diva_pri_init_card()
137 a->resources.pci.hdev); diva_pri_init_card()
236 diva_init_dma_map(a->resources.pci.hdev, diva_pri_init_card()
317 diva_free_dma_map(a->resources.pci.hdev, diva_pri_cleanup_adapter()
805 void *hdev; pri_get_serial_number() local
817 hdev = a->resources.pci.hdev; pri_get_serial_number()
818 PCIread(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev); pri_get_serial_number()
819 PCIwrite(Bus, Slot, 0x04, &cmd, sizeof(cmd), hdev); pri_get_serial_number()
821 PCIwrite(Bus, Slot, 0x14, &addr4, sizeof(addr4), hdev); pri_get_serial_number()
822 PCIwrite(Bus, Slot, 0x20, &addr1, sizeof(addr1), hdev); pri_get_serial_number()
824 PCIwrite(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev); pri_get_serial_number()
H A Dos_4bri.c200 a->resources.pci.hdev); diva_4bri_init_card()
212 a->resources.pci.hdev); diva_4bri_init_card()
535 void *hdev; _4bri_get_serial_number() local
539 hdev = a->resources.pci.hdev; _4bri_get_serial_number()
545 hdev); _4bri_get_serial_number()
548 hdev); _4bri_get_serial_number()
556 PCIread(Bus, Slot, 0x50, &data[i], sizeof(data[i]), hdev); _4bri_get_serial_number()
H A Ddivasmain.c348 void diva_init_dma_map(void *hdev, diva_init_dma_map() argument
351 struct pci_dev *pdev = (struct pci_dev *) hdev; diva_init_dma_map()
353 diva_alloc_dma_map(hdev, nentries); diva_init_dma_map()
385 void diva_free_dma_map(void *hdev, struct _diva_dma_map_entry *pmap) diva_free_dma_map() argument
387 struct pci_dev *pdev = (struct pci_dev *) hdev; diva_free_dma_map()
H A Ddiva.c344 a->resources.pci.hdev = pci_dev_handle; divas_create_pci_card()
/linux-4.1.27/arch/x86/include/asm/
H A Dhpet.h80 extern void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg);
81 extern void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg);
/linux-4.1.27/drivers/net/hyperv/
H A Dnetvsc_drv.c218 struct hv_device *hdev = net_device_ctx->device_ctx; netvsc_select_queue() local
219 struct netvsc_device *nvsc_dev = hv_get_drvdata(hdev); netvsc_select_queue()
725 struct hv_device *hdev = ndevctx->device_ctx; netvsc_change_mtu() local
726 struct netvsc_device *nvdev = hv_get_drvdata(hdev); netvsc_change_mtu()
743 rndis_filter_device_remove(hdev); netvsc_change_mtu()
747 ndevctx->device_ctx = hdev; netvsc_change_mtu()
748 hv_set_drvdata(hdev, ndev); netvsc_change_mtu()
750 rndis_filter_device_add(hdev, &device_info); netvsc_change_mtu()
760 struct hv_device *hdev = ndevctx->device_ctx; netvsc_set_mac_addr() local
773 err = rndis_filter_set_device_mac(hdev, addr->sa_data); netvsc_set_mac_addr()
H A Drndis_filter.c552 int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac) rndis_filter_set_device_mac() argument
554 struct netvsc_device *nvdev = hv_get_drvdata(hdev); rndis_filter_set_device_mac()
630 rndis_filter_set_offload_params(struct hv_device *hdev, rndis_filter_set_offload_params() argument
633 struct netvsc_device *nvdev = hv_get_drvdata(hdev); rndis_filter_set_offload_params()
915 struct hv_device *hdev = nvdev->dev; rndis_filter_halt_device() local
934 spin_lock_irqsave(&hdev->channel->inbound_lock, flags); rndis_filter_halt_device()
936 spin_unlock_irqrestore(&hdev->channel->inbound_lock, flags); rndis_filter_halt_device()
/linux-4.1.27/drivers/rtc/
H A Drtc-hid-sensor-time.c288 hid_device_io_start(hsdev->hdev); hid_time_probe()
295 hid_device_io_stop(hsdev->hdev); hid_time_probe()
/linux-4.1.27/net/bluetooth/rfcomm/
H A Dtty.c178 struct hci_dev *hdev; rfcomm_reparent_device() local
181 hdev = hci_get_route(&dev->dst, &dev->src); rfcomm_reparent_device()
182 if (!hdev) rfcomm_reparent_device()
188 hci_dev_lock(hdev); rfcomm_reparent_device()
189 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); rfcomm_reparent_device()
197 hci_dev_unlock(hdev); rfcomm_reparent_device()
198 hci_dev_put(hdev); rfcomm_reparent_device()
/linux-4.1.27/drivers/iio/common/hid-sensors/
H A Dhid-sensor-attributes.c385 hid_dbg(hsdev->hdev, "common attributes: %x:%x, %x:%x, %x:%x %x:%x\n", hid_sensor_parse_common_attributes()
/linux-4.1.27/drivers/scsi/
H A Dhpsa.c530 struct hpsa_scsi_dev_t *hdev; raid_level_show() local
536 hdev = sdev->hostdata; raid_level_show()
537 if (!hdev) { raid_level_show()
543 if (!is_logical_dev_addr_mode(hdev->scsi3addr)) { raid_level_show()
549 rlevel = hdev->raid_level; raid_level_show()
562 struct hpsa_scsi_dev_t *hdev; lunid_show() local
569 hdev = sdev->hostdata; lunid_show()
570 if (!hdev) { lunid_show()
574 memcpy(lunid, hdev->scsi3addr, sizeof(lunid)); lunid_show()
586 struct hpsa_scsi_dev_t *hdev; unique_id_show() local
593 hdev = sdev->hostdata; unique_id_show()
594 if (!hdev) { unique_id_show()
598 memcpy(sn, hdev->device_id, sizeof(sn)); unique_id_show()
614 struct hpsa_scsi_dev_t *hdev; host_show_hp_ssd_smart_path_enabled() local
621 hdev = sdev->hostdata; host_show_hp_ssd_smart_path_enabled()
622 if (!hdev) { host_show_hp_ssd_smart_path_enabled()
626 offload_enabled = hdev->offload_enabled; host_show_hp_ssd_smart_path_enabled()

Completed in 6761 milliseconds

12