Lines Matching full:ndev

28 static void nci_core_reset_rsp_packet(struct nci_dev *ndev,  in nci_core_reset_rsp_packet()  argument
38 ndev->nci_ver = rsp->nci_ver; in nci_core_reset_rsp_packet()
43 nci_req_complete(ndev, rsp->status); in nci_core_reset_rsp_packet()
47 static u8 nci_core_init_rsp_packet_v1(struct nci_dev *ndev, in nci_core_init_rsp_packet_v1() argument
58 ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); in nci_core_init_rsp_packet_v1()
59 ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; in nci_core_init_rsp_packet_v1()
61 ndev->num_supported_rf_interfaces = in nci_core_init_rsp_packet_v1()
62 min((int)ndev->num_supported_rf_interfaces, in nci_core_init_rsp_packet_v1()
65 memcpy(ndev->supported_rf_interfaces, in nci_core_init_rsp_packet_v1()
67 ndev->num_supported_rf_interfaces); in nci_core_init_rsp_packet_v1()
71 ndev->max_logical_connections = rsp_2->max_logical_connections; in nci_core_init_rsp_packet_v1()
72 ndev->max_routing_table_size = in nci_core_init_rsp_packet_v1()
74 ndev->max_ctrl_pkt_payload_len = in nci_core_init_rsp_packet_v1()
76 ndev->max_size_for_large_params = in nci_core_init_rsp_packet_v1()
78 ndev->manufact_id = in nci_core_init_rsp_packet_v1()
80 ndev->manufact_specific_info = in nci_core_init_rsp_packet_v1()
86 static u8 nci_core_init_rsp_packet_v2(struct nci_dev *ndev, in nci_core_init_rsp_packet_v2() argument
99 ndev->nfcc_features = __le32_to_cpu(rsp->nfcc_features); in nci_core_init_rsp_packet_v2()
100 ndev->num_supported_rf_interfaces = rsp->num_supported_rf_interfaces; in nci_core_init_rsp_packet_v2()
102 ndev->num_supported_rf_interfaces = in nci_core_init_rsp_packet_v2()
103 min((int)ndev->num_supported_rf_interfaces, in nci_core_init_rsp_packet_v2()
106 while (rf_interface_idx < ndev->num_supported_rf_interfaces) { in nci_core_init_rsp_packet_v2()
107 ndev->supported_rf_interfaces[rf_interface_idx++] = *supported_rf_interface++; in nci_core_init_rsp_packet_v2()
114 ndev->max_logical_connections = rsp->max_logical_connections; in nci_core_init_rsp_packet_v2()
115 ndev->max_routing_table_size = in nci_core_init_rsp_packet_v2()
117 ndev->max_ctrl_pkt_payload_len = in nci_core_init_rsp_packet_v2()
119 ndev->max_size_for_large_params = NCI_MAX_LARGE_PARAMS_NCI_v2; in nci_core_init_rsp_packet_v2()
124 static void nci_core_init_rsp_packet(struct nci_dev *ndev, const struct sk_buff *skb) in nci_core_init_rsp_packet() argument
128 if (!(ndev->nci_ver & NCI_VER_2_MASK)) in nci_core_init_rsp_packet()
129 status = nci_core_init_rsp_packet_v1(ndev, skb); in nci_core_init_rsp_packet()
131 status = nci_core_init_rsp_packet_v2(ndev, skb); in nci_core_init_rsp_packet()
137 ndev->nfcc_features); in nci_core_init_rsp_packet()
139 ndev->num_supported_rf_interfaces); in nci_core_init_rsp_packet()
141 ndev->supported_rf_interfaces[0]); in nci_core_init_rsp_packet()
143 ndev->supported_rf_interfaces[1]); in nci_core_init_rsp_packet()
145 ndev->supported_rf_interfaces[2]); in nci_core_init_rsp_packet()
147 ndev->supported_rf_interfaces[3]); in nci_core_init_rsp_packet()
149 ndev->max_logical_connections); in nci_core_init_rsp_packet()
151 ndev->max_routing_table_size); in nci_core_init_rsp_packet()
153 ndev->max_ctrl_pkt_payload_len); in nci_core_init_rsp_packet()
155 ndev->max_size_for_large_params); in nci_core_init_rsp_packet()
157 ndev->manufact_id); in nci_core_init_rsp_packet()
159 ndev->manufact_specific_info); in nci_core_init_rsp_packet()
162 nci_req_complete(ndev, status); in nci_core_init_rsp_packet()
165 static void nci_core_set_config_rsp_packet(struct nci_dev *ndev, in nci_core_set_config_rsp_packet() argument
172 nci_req_complete(ndev, rsp->status); in nci_core_set_config_rsp_packet()
175 static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, in nci_rf_disc_map_rsp_packet() argument
182 nci_req_complete(ndev, status); in nci_rf_disc_map_rsp_packet()
185 static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, in nci_rf_disc_rsp_packet() argument
194 atomic_set(&ndev->state, NCI_DISCOVERY); in nci_rf_disc_rsp_packet()
196 conn_info = ndev->rf_conn_info; in nci_rf_disc_rsp_packet()
198 conn_info = devm_kzalloc(&ndev->nfc_dev->dev, in nci_rf_disc_rsp_packet()
207 list_add(&conn_info->list, &ndev->conn_info_list); in nci_rf_disc_rsp_packet()
208 ndev->rf_conn_info = conn_info; in nci_rf_disc_rsp_packet()
213 nci_req_complete(ndev, status); in nci_rf_disc_rsp_packet()
216 static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev, in nci_rf_disc_select_rsp_packet() argument
225 nci_req_complete(ndev, status); in nci_rf_disc_select_rsp_packet()
228 static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, in nci_rf_deactivate_rsp_packet() argument
237 (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { in nci_rf_deactivate_rsp_packet()
238 nci_clear_target_list(ndev); in nci_rf_deactivate_rsp_packet()
239 atomic_set(&ndev->state, NCI_IDLE); in nci_rf_deactivate_rsp_packet()
240 nci_req_complete(ndev, status); in nci_rf_deactivate_rsp_packet()
244 static void nci_nfcee_discover_rsp_packet(struct nci_dev *ndev, in nci_nfcee_discover_rsp_packet() argument
250 nci_req_complete(ndev, NCI_STATUS_NFCEE_PROTOCOL_ERROR); in nci_nfcee_discover_rsp_packet()
258 nci_req_complete(ndev, discover_rsp->status); in nci_nfcee_discover_rsp_packet()
261 static void nci_nfcee_mode_set_rsp_packet(struct nci_dev *ndev, in nci_nfcee_mode_set_rsp_packet() argument
267 nci_req_complete(ndev, status); in nci_nfcee_mode_set_rsp_packet()
270 static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev, in nci_core_conn_create_rsp_packet() argument
282 conn_info = devm_kzalloc(&ndev->nfc_dev->dev, in nci_core_conn_create_rsp_packet()
289 conn_info->dest_params = devm_kzalloc(&ndev->nfc_dev->dev, in nci_core_conn_create_rsp_packet()
297 conn_info->dest_type = ndev->cur_dest_type; in nci_core_conn_create_rsp_packet()
298 conn_info->dest_params->id = ndev->cur_params.id; in nci_core_conn_create_rsp_packet()
299 conn_info->dest_params->protocol = ndev->cur_params.protocol; in nci_core_conn_create_rsp_packet()
307 list_add(&conn_info->list, &ndev->conn_info_list); in nci_core_conn_create_rsp_packet()
309 if (ndev->cur_params.id == ndev->hci_dev->nfcee_id) in nci_core_conn_create_rsp_packet()
310 ndev->hci_dev->conn_info = conn_info; in nci_core_conn_create_rsp_packet()
319 devm_kfree(&ndev->nfc_dev->dev, conn_info); in nci_core_conn_create_rsp_packet()
322 nci_req_complete(ndev, status); in nci_core_conn_create_rsp_packet()
325 static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev, in nci_core_conn_close_rsp_packet() argument
333 conn_info = nci_get_conn_info_by_conn_id(ndev, in nci_core_conn_close_rsp_packet()
334 ndev->cur_conn_id); in nci_core_conn_close_rsp_packet()
337 if (conn_info == ndev->rf_conn_info) in nci_core_conn_close_rsp_packet()
338 ndev->rf_conn_info = NULL; in nci_core_conn_close_rsp_packet()
339 devm_kfree(&ndev->nfc_dev->dev, conn_info); in nci_core_conn_close_rsp_packet()
342 nci_req_complete(ndev, status); in nci_core_conn_close_rsp_packet()
345 void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) in nci_rsp_packet() argument
350 del_timer(&ndev->cmd_timer); in nci_rsp_packet()
362 if (nci_prop_rsp_packet(ndev, rsp_opcode, skb) == -ENOTSUPP) { in nci_rsp_packet()
372 nci_core_reset_rsp_packet(ndev, skb); in nci_rsp_packet()
376 nci_core_init_rsp_packet(ndev, skb); in nci_rsp_packet()
380 nci_core_set_config_rsp_packet(ndev, skb); in nci_rsp_packet()
384 nci_core_conn_create_rsp_packet(ndev, skb); in nci_rsp_packet()
388 nci_core_conn_close_rsp_packet(ndev, skb); in nci_rsp_packet()
392 nci_rf_disc_map_rsp_packet(ndev, skb); in nci_rsp_packet()
396 nci_rf_disc_rsp_packet(ndev, skb); in nci_rsp_packet()
400 nci_rf_disc_select_rsp_packet(ndev, skb); in nci_rsp_packet()
404 nci_rf_deactivate_rsp_packet(ndev, skb); in nci_rsp_packet()
408 nci_nfcee_discover_rsp_packet(ndev, skb); in nci_rsp_packet()
412 nci_nfcee_mode_set_rsp_packet(ndev, skb); in nci_rsp_packet()
420 nci_core_rsp_packet(ndev, rsp_opcode, skb); in nci_rsp_packet()
425 atomic_set(&ndev->cmd_cnt, 1); in nci_rsp_packet()
426 if (!skb_queue_empty(&ndev->cmd_q)) in nci_rsp_packet()
427 queue_work(ndev->cmd_wq, &ndev->cmd_work); in nci_rsp_packet()