diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-04 19:03:54 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:25 -0500 |
commit | eb9bc6e9a0ac668d2283b8fea1534f8ba31d1692 (patch) | |
tree | 91e9c684e967a7959cce3ae6de256d0f9ac51f85 /net/nfc | |
parent | 0a40acb24602783fcf6881f915659148aa9807d7 (diff) |
NFC: NCI code identation fixes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/nci/core.c | 113 | ||||
-rw-r--r-- | net/nfc/nci/data.c | 28 | ||||
-rw-r--r-- | net/nfc/nci/ntf.c | 75 | ||||
-rw-r--r-- | net/nfc/nci/rsp.c | 17 |
4 files changed, 111 insertions, 122 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index a47e90c7d9d1..9ec065bb9ee1 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -66,9 +66,8 @@ static void nci_req_cancel(struct nci_dev *ndev, int err) | |||
66 | 66 | ||
67 | /* Execute request and wait for completion. */ | 67 | /* Execute request and wait for completion. */ |
68 | static int __nci_request(struct nci_dev *ndev, | 68 | static int __nci_request(struct nci_dev *ndev, |
69 | void (*req)(struct nci_dev *ndev, unsigned long opt), | 69 | void (*req)(struct nci_dev *ndev, unsigned long opt), |
70 | unsigned long opt, | 70 | unsigned long opt, __u32 timeout) |
71 | __u32 timeout) | ||
72 | { | 71 | { |
73 | int rc = 0; | 72 | int rc = 0; |
74 | long completion_rc; | 73 | long completion_rc; |
@@ -77,9 +76,9 @@ static int __nci_request(struct nci_dev *ndev, | |||
77 | 76 | ||
78 | init_completion(&ndev->req_completion); | 77 | init_completion(&ndev->req_completion); |
79 | req(ndev, opt); | 78 | req(ndev, opt); |
80 | completion_rc = wait_for_completion_interruptible_timeout( | 79 | completion_rc = |
81 | &ndev->req_completion, | 80 | wait_for_completion_interruptible_timeout(&ndev->req_completion, |
82 | timeout); | 81 | timeout); |
83 | 82 | ||
84 | pr_debug("wait_for_completion return %ld\n", completion_rc); | 83 | pr_debug("wait_for_completion return %ld\n", completion_rc); |
85 | 84 | ||
@@ -110,8 +109,9 @@ static int __nci_request(struct nci_dev *ndev, | |||
110 | } | 109 | } |
111 | 110 | ||
112 | static inline int nci_request(struct nci_dev *ndev, | 111 | static inline int nci_request(struct nci_dev *ndev, |
113 | void (*req)(struct nci_dev *ndev, unsigned long opt), | 112 | void (*req)(struct nci_dev *ndev, |
114 | unsigned long opt, __u32 timeout) | 113 | unsigned long opt), |
114 | unsigned long opt, __u32 timeout) | ||
115 | { | 115 | { |
116 | int rc; | 116 | int rc; |
117 | 117 | ||
@@ -152,14 +152,14 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | |||
152 | /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ | 152 | /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ |
153 | for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { | 153 | for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { |
154 | if (ndev->supported_rf_interfaces[i] == | 154 | if (ndev->supported_rf_interfaces[i] == |
155 | NCI_RF_INTERFACE_ISO_DEP) { | 155 | NCI_RF_INTERFACE_ISO_DEP) { |
156 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; | 156 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; |
157 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | | 157 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | |
158 | NCI_DISC_MAP_MODE_LISTEN; | 158 | NCI_DISC_MAP_MODE_LISTEN; |
159 | cfg[*num].rf_interface = NCI_RF_INTERFACE_ISO_DEP; | 159 | cfg[*num].rf_interface = NCI_RF_INTERFACE_ISO_DEP; |
160 | (*num)++; | 160 | (*num)++; |
161 | } else if (ndev->supported_rf_interfaces[i] == | 161 | } else if (ndev->supported_rf_interfaces[i] == |
162 | NCI_RF_INTERFACE_NFC_DEP) { | 162 | NCI_RF_INTERFACE_NFC_DEP) { |
163 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | 163 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; |
164 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | | 164 | cfg[*num].mode = NCI_DISC_MAP_MODE_POLL | |
165 | NCI_DISC_MAP_MODE_LISTEN; | 165 | NCI_DISC_MAP_MODE_LISTEN; |
@@ -172,8 +172,7 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, | 174 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, |
175 | (1 + ((*num)*sizeof(struct disc_map_config))), | 175 | (1 + ((*num) * sizeof(struct disc_map_config))), &cmd); |
176 | &cmd); | ||
177 | } | 176 | } |
178 | 177 | ||
179 | static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt) | 178 | static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt) |
@@ -184,36 +183,36 @@ static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt) | |||
184 | cmd.num_disc_configs = 0; | 183 | cmd.num_disc_configs = 0; |
185 | 184 | ||
186 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && | 185 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && |
187 | (protocols & NFC_PROTO_JEWEL_MASK | 186 | (protocols & NFC_PROTO_JEWEL_MASK |
188 | || protocols & NFC_PROTO_MIFARE_MASK | 187 | || protocols & NFC_PROTO_MIFARE_MASK |
189 | || protocols & NFC_PROTO_ISO14443_MASK | 188 | || protocols & NFC_PROTO_ISO14443_MASK |
190 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { | 189 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { |
191 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = | 190 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
192 | NCI_NFC_A_PASSIVE_POLL_MODE; | 191 | NCI_NFC_A_PASSIVE_POLL_MODE; |
193 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 192 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
194 | cmd.num_disc_configs++; | 193 | cmd.num_disc_configs++; |
195 | } | 194 | } |
196 | 195 | ||
197 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && | 196 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && |
198 | (protocols & NFC_PROTO_ISO14443_MASK)) { | 197 | (protocols & NFC_PROTO_ISO14443_MASK)) { |
199 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = | 198 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
200 | NCI_NFC_B_PASSIVE_POLL_MODE; | 199 | NCI_NFC_B_PASSIVE_POLL_MODE; |
201 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 200 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
202 | cmd.num_disc_configs++; | 201 | cmd.num_disc_configs++; |
203 | } | 202 | } |
204 | 203 | ||
205 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && | 204 | if ((cmd.num_disc_configs < NCI_MAX_NUM_RF_CONFIGS) && |
206 | (protocols & NFC_PROTO_FELICA_MASK | 205 | (protocols & NFC_PROTO_FELICA_MASK |
207 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { | 206 | || protocols & NFC_PROTO_NFC_DEP_MASK)) { |
208 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = | 207 | cmd.disc_configs[cmd.num_disc_configs].rf_tech_and_mode = |
209 | NCI_NFC_F_PASSIVE_POLL_MODE; | 208 | NCI_NFC_F_PASSIVE_POLL_MODE; |
210 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; | 209 | cmd.disc_configs[cmd.num_disc_configs].frequency = 1; |
211 | cmd.num_disc_configs++; | 210 | cmd.num_disc_configs++; |
212 | } | 211 | } |
213 | 212 | ||
214 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_CMD, | 213 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_CMD, |
215 | (1 + (cmd.num_disc_configs*sizeof(struct disc_config))), | 214 | (1 + (cmd.num_disc_configs * sizeof(struct disc_config))), |
216 | &cmd); | 215 | &cmd); |
217 | } | 216 | } |
218 | 217 | ||
219 | struct nci_rf_discover_select_param { | 218 | struct nci_rf_discover_select_param { |
@@ -224,7 +223,7 @@ struct nci_rf_discover_select_param { | |||
224 | static void nci_rf_discover_select_req(struct nci_dev *ndev, unsigned long opt) | 223 | static void nci_rf_discover_select_req(struct nci_dev *ndev, unsigned long opt) |
225 | { | 224 | { |
226 | struct nci_rf_discover_select_param *param = | 225 | struct nci_rf_discover_select_param *param = |
227 | (struct nci_rf_discover_select_param *)opt; | 226 | (struct nci_rf_discover_select_param *)opt; |
228 | struct nci_rf_discover_select_cmd cmd; | 227 | struct nci_rf_discover_select_cmd cmd; |
229 | 228 | ||
230 | cmd.rf_discovery_id = param->rf_discovery_id; | 229 | cmd.rf_discovery_id = param->rf_discovery_id; |
@@ -245,8 +244,7 @@ static void nci_rf_discover_select_req(struct nci_dev *ndev, unsigned long opt) | |||
245 | } | 244 | } |
246 | 245 | ||
247 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_SELECT_CMD, | 246 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_SELECT_CMD, |
248 | sizeof(struct nci_rf_discover_select_cmd), | 247 | sizeof(struct nci_rf_discover_select_cmd), &cmd); |
249 | &cmd); | ||
250 | } | 248 | } |
251 | 249 | ||
252 | static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt) | 250 | static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt) |
@@ -256,8 +254,7 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt) | |||
256 | cmd.type = NCI_DEACTIVATE_TYPE_IDLE_MODE; | 254 | cmd.type = NCI_DEACTIVATE_TYPE_IDLE_MODE; |
257 | 255 | ||
258 | nci_send_cmd(ndev, NCI_OP_RF_DEACTIVATE_CMD, | 256 | nci_send_cmd(ndev, NCI_OP_RF_DEACTIVATE_CMD, |
259 | sizeof(struct nci_rf_deactivate_cmd), | 257 | sizeof(struct nci_rf_deactivate_cmd), &cmd); |
260 | &cmd); | ||
261 | } | 258 | } |
262 | 259 | ||
263 | static int nci_open_device(struct nci_dev *ndev) | 260 | static int nci_open_device(struct nci_dev *ndev) |
@@ -281,16 +278,16 @@ static int nci_open_device(struct nci_dev *ndev) | |||
281 | set_bit(NCI_INIT, &ndev->flags); | 278 | set_bit(NCI_INIT, &ndev->flags); |
282 | 279 | ||
283 | rc = __nci_request(ndev, nci_reset_req, 0, | 280 | rc = __nci_request(ndev, nci_reset_req, 0, |
284 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); | 281 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); |
285 | 282 | ||
286 | if (!rc) { | 283 | if (!rc) { |
287 | rc = __nci_request(ndev, nci_init_req, 0, | 284 | rc = __nci_request(ndev, nci_init_req, 0, |
288 | msecs_to_jiffies(NCI_INIT_TIMEOUT)); | 285 | msecs_to_jiffies(NCI_INIT_TIMEOUT)); |
289 | } | 286 | } |
290 | 287 | ||
291 | if (!rc) { | 288 | if (!rc) { |
292 | rc = __nci_request(ndev, nci_init_complete_req, 0, | 289 | rc = __nci_request(ndev, nci_init_complete_req, 0, |
293 | msecs_to_jiffies(NCI_INIT_TIMEOUT)); | 290 | msecs_to_jiffies(NCI_INIT_TIMEOUT)); |
294 | } | 291 | } |
295 | 292 | ||
296 | clear_bit(NCI_INIT, &ndev->flags); | 293 | clear_bit(NCI_INIT, &ndev->flags); |
@@ -340,7 +337,7 @@ static int nci_close_device(struct nci_dev *ndev) | |||
340 | 337 | ||
341 | set_bit(NCI_INIT, &ndev->flags); | 338 | set_bit(NCI_INIT, &ndev->flags); |
342 | __nci_request(ndev, nci_reset_req, 0, | 339 | __nci_request(ndev, nci_reset_req, 0, |
343 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); | 340 | msecs_to_jiffies(NCI_RESET_TIMEOUT)); |
344 | clear_bit(NCI_INIT, &ndev->flags); | 341 | clear_bit(NCI_INIT, &ndev->flags); |
345 | 342 | ||
346 | /* Flush cmd wq */ | 343 | /* Flush cmd wq */ |
@@ -396,7 +393,7 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols) | |||
396 | int rc; | 393 | int rc; |
397 | 394 | ||
398 | if ((atomic_read(&ndev->state) == NCI_DISCOVERY) || | 395 | if ((atomic_read(&ndev->state) == NCI_DISCOVERY) || |
399 | (atomic_read(&ndev->state) == NCI_W4_ALL_DISCOVERIES)) { | 396 | (atomic_read(&ndev->state) == NCI_W4_ALL_DISCOVERIES)) { |
400 | pr_err("unable to start poll, since poll is already active\n"); | 397 | pr_err("unable to start poll, since poll is already active\n"); |
401 | return -EBUSY; | 398 | return -EBUSY; |
402 | } | 399 | } |
@@ -407,17 +404,17 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols) | |||
407 | } | 404 | } |
408 | 405 | ||
409 | if ((atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) || | 406 | if ((atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) || |
410 | (atomic_read(&ndev->state) == NCI_POLL_ACTIVE)) { | 407 | (atomic_read(&ndev->state) == NCI_POLL_ACTIVE)) { |
411 | pr_debug("target active or w4 select, implicitly deactivate\n"); | 408 | pr_debug("target active or w4 select, implicitly deactivate\n"); |
412 | 409 | ||
413 | rc = nci_request(ndev, nci_rf_deactivate_req, 0, | 410 | rc = nci_request(ndev, nci_rf_deactivate_req, 0, |
414 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); | 411 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); |
415 | if (rc) | 412 | if (rc) |
416 | return -EBUSY; | 413 | return -EBUSY; |
417 | } | 414 | } |
418 | 415 | ||
419 | rc = nci_request(ndev, nci_rf_discover_req, protocols, | 416 | rc = nci_request(ndev, nci_rf_discover_req, protocols, |
420 | msecs_to_jiffies(NCI_RF_DISC_TIMEOUT)); | 417 | msecs_to_jiffies(NCI_RF_DISC_TIMEOUT)); |
421 | 418 | ||
422 | if (!rc) | 419 | if (!rc) |
423 | ndev->poll_prots = protocols; | 420 | ndev->poll_prots = protocols; |
@@ -430,17 +427,17 @@ static void nci_stop_poll(struct nfc_dev *nfc_dev) | |||
430 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); | 427 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); |
431 | 428 | ||
432 | if ((atomic_read(&ndev->state) != NCI_DISCOVERY) && | 429 | if ((atomic_read(&ndev->state) != NCI_DISCOVERY) && |
433 | (atomic_read(&ndev->state) != NCI_W4_ALL_DISCOVERIES)) { | 430 | (atomic_read(&ndev->state) != NCI_W4_ALL_DISCOVERIES)) { |
434 | pr_err("unable to stop poll, since poll is not active\n"); | 431 | pr_err("unable to stop poll, since poll is not active\n"); |
435 | return; | 432 | return; |
436 | } | 433 | } |
437 | 434 | ||
438 | nci_request(ndev, nci_rf_deactivate_req, 0, | 435 | nci_request(ndev, nci_rf_deactivate_req, 0, |
439 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); | 436 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); |
440 | } | 437 | } |
441 | 438 | ||
442 | static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, | 439 | static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, |
443 | __u32 protocol) | 440 | __u32 protocol) |
444 | { | 441 | { |
445 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); | 442 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); |
446 | struct nci_rf_discover_select_param param; | 443 | struct nci_rf_discover_select_param param; |
@@ -451,7 +448,7 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, | |||
451 | pr_debug("target_idx %d, protocol 0x%x\n", target_idx, protocol); | 448 | pr_debug("target_idx %d, protocol 0x%x\n", target_idx, protocol); |
452 | 449 | ||
453 | if ((atomic_read(&ndev->state) != NCI_W4_HOST_SELECT) && | 450 | if ((atomic_read(&ndev->state) != NCI_W4_HOST_SELECT) && |
454 | (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { | 451 | (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { |
455 | pr_err("there is no available target to activate\n"); | 452 | pr_err("there is no available target to activate\n"); |
456 | return -EINVAL; | 453 | return -EINVAL; |
457 | } | 454 | } |
@@ -494,8 +491,8 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, | |||
494 | param.rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | 491 | param.rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; |
495 | 492 | ||
496 | rc = nci_request(ndev, nci_rf_discover_select_req, | 493 | rc = nci_request(ndev, nci_rf_discover_select_req, |
497 | (unsigned long)¶m, | 494 | (unsigned long)¶m, |
498 | msecs_to_jiffies(NCI_RF_DISC_SELECT_TIMEOUT)); | 495 | msecs_to_jiffies(NCI_RF_DISC_SELECT_TIMEOUT)); |
499 | } | 496 | } |
500 | 497 | ||
501 | if (!rc) | 498 | if (!rc) |
@@ -519,14 +516,13 @@ static void nci_deactivate_target(struct nfc_dev *nfc_dev, __u32 target_idx) | |||
519 | 516 | ||
520 | if (atomic_read(&ndev->state) == NCI_POLL_ACTIVE) { | 517 | if (atomic_read(&ndev->state) == NCI_POLL_ACTIVE) { |
521 | nci_request(ndev, nci_rf_deactivate_req, 0, | 518 | nci_request(ndev, nci_rf_deactivate_req, 0, |
522 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); | 519 | msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); |
523 | } | 520 | } |
524 | } | 521 | } |
525 | 522 | ||
526 | static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx, | 523 | static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx, |
527 | struct sk_buff *skb, | 524 | struct sk_buff *skb, |
528 | data_exchange_cb_t cb, | 525 | data_exchange_cb_t cb, void *cb_context) |
529 | void *cb_context) | ||
530 | { | 526 | { |
531 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); | 527 | struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); |
532 | int rc; | 528 | int rc; |
@@ -571,9 +567,8 @@ static struct nfc_ops nci_nfc_ops = { | |||
571 | * @supported_protocols: NFC protocols supported by the device | 567 | * @supported_protocols: NFC protocols supported by the device |
572 | */ | 568 | */ |
573 | struct nci_dev *nci_allocate_device(struct nci_ops *ops, | 569 | struct nci_dev *nci_allocate_device(struct nci_ops *ops, |
574 | __u32 supported_protocols, | 570 | __u32 supported_protocols, |
575 | int tx_headroom, | 571 | int tx_headroom, int tx_tailroom) |
576 | int tx_tailroom) | ||
577 | { | 572 | { |
578 | struct nci_dev *ndev; | 573 | struct nci_dev *ndev; |
579 | 574 | ||
@@ -594,9 +589,9 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops, | |||
594 | ndev->tx_tailroom = tx_tailroom; | 589 | ndev->tx_tailroom = tx_tailroom; |
595 | 590 | ||
596 | ndev->nfc_dev = nfc_allocate_device(&nci_nfc_ops, | 591 | ndev->nfc_dev = nfc_allocate_device(&nci_nfc_ops, |
597 | supported_protocols, | 592 | supported_protocols, |
598 | tx_headroom + NCI_DATA_HDR_SIZE, | 593 | tx_headroom + NCI_DATA_HDR_SIZE, |
599 | tx_tailroom); | 594 | tx_tailroom); |
600 | if (!ndev->nfc_dev) | 595 | if (!ndev->nfc_dev) |
601 | goto free_exit; | 596 | goto free_exit; |
602 | 597 | ||
@@ -668,9 +663,9 @@ int nci_register_device(struct nci_dev *ndev) | |||
668 | skb_queue_head_init(&ndev->tx_q); | 663 | skb_queue_head_init(&ndev->tx_q); |
669 | 664 | ||
670 | setup_timer(&ndev->cmd_timer, nci_cmd_timer, | 665 | setup_timer(&ndev->cmd_timer, nci_cmd_timer, |
671 | (unsigned long) ndev); | 666 | (unsigned long) ndev); |
672 | setup_timer(&ndev->data_timer, nci_data_timer, | 667 | setup_timer(&ndev->data_timer, nci_data_timer, |
673 | (unsigned long) ndev); | 668 | (unsigned long) ndev); |
674 | 669 | ||
675 | mutex_init(&ndev->req_lock); | 670 | mutex_init(&ndev->req_lock); |
676 | 671 | ||
@@ -719,7 +714,7 @@ int nci_recv_frame(struct sk_buff *skb) | |||
719 | pr_debug("len %d\n", skb->len); | 714 | pr_debug("len %d\n", skb->len); |
720 | 715 | ||
721 | if (!ndev || (!test_bit(NCI_UP, &ndev->flags) | 716 | if (!ndev || (!test_bit(NCI_UP, &ndev->flags) |
722 | && !test_bit(NCI_INIT, &ndev->flags))) { | 717 | && !test_bit(NCI_INIT, &ndev->flags))) { |
723 | kfree_skb(skb); | 718 | kfree_skb(skb); |
724 | return -ENXIO; | 719 | return -ENXIO; |
725 | } | 720 | } |
@@ -799,7 +794,7 @@ static void nci_tx_work(struct work_struct *work) | |||
799 | 794 | ||
800 | /* Check if data flow control is used */ | 795 | /* Check if data flow control is used */ |
801 | if (atomic_read(&ndev->credits_cnt) != | 796 | if (atomic_read(&ndev->credits_cnt) != |
802 | NCI_DATA_FLOW_CONTROL_NOT_USED) | 797 | NCI_DATA_FLOW_CONTROL_NOT_USED) |
803 | atomic_dec(&ndev->credits_cnt); | 798 | atomic_dec(&ndev->credits_cnt); |
804 | 799 | ||
805 | pr_debug("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d\n", | 800 | pr_debug("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d\n", |
@@ -810,7 +805,7 @@ static void nci_tx_work(struct work_struct *work) | |||
810 | nci_send_frame(skb); | 805 | nci_send_frame(skb); |
811 | 806 | ||
812 | mod_timer(&ndev->data_timer, | 807 | mod_timer(&ndev->data_timer, |
813 | jiffies + msecs_to_jiffies(NCI_DATA_TIMEOUT)); | 808 | jiffies + msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
814 | } | 809 | } |
815 | } | 810 | } |
816 | 811 | ||
@@ -879,6 +874,6 @@ static void nci_cmd_work(struct work_struct *work) | |||
879 | nci_send_frame(skb); | 874 | nci_send_frame(skb); |
880 | 875 | ||
881 | mod_timer(&ndev->cmd_timer, | 876 | mod_timer(&ndev->cmd_timer, |
882 | jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT)); | 877 | jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT)); |
883 | } | 878 | } |
884 | } | 879 | } |
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c index 7880ae924d5e..a0bc326308a5 100644 --- a/net/nfc/nci/data.c +++ b/net/nfc/nci/data.c | |||
@@ -35,8 +35,7 @@ | |||
35 | #include <linux/nfc.h> | 35 | #include <linux/nfc.h> |
36 | 36 | ||
37 | /* Complete data exchange transaction and forward skb to nfc core */ | 37 | /* Complete data exchange transaction and forward skb to nfc core */ |
38 | void nci_data_exchange_complete(struct nci_dev *ndev, | 38 | void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, |
39 | struct sk_buff *skb, | ||
40 | int err) | 39 | int err) |
41 | { | 40 | { |
42 | data_exchange_cb_t cb = ndev->data_exchange_cb; | 41 | data_exchange_cb_t cb = ndev->data_exchange_cb; |
@@ -67,9 +66,9 @@ void nci_data_exchange_complete(struct nci_dev *ndev, | |||
67 | /* ----------------- NCI TX Data ----------------- */ | 66 | /* ----------------- NCI TX Data ----------------- */ |
68 | 67 | ||
69 | static inline void nci_push_data_hdr(struct nci_dev *ndev, | 68 | static inline void nci_push_data_hdr(struct nci_dev *ndev, |
70 | __u8 conn_id, | 69 | __u8 conn_id, |
71 | struct sk_buff *skb, | 70 | struct sk_buff *skb, |
72 | __u8 pbf) | 71 | __u8 pbf) |
73 | { | 72 | { |
74 | struct nci_data_hdr *hdr; | 73 | struct nci_data_hdr *hdr; |
75 | int plen = skb->len; | 74 | int plen = skb->len; |
@@ -86,8 +85,8 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev, | |||
86 | } | 85 | } |
87 | 86 | ||
88 | static int nci_queue_tx_data_frags(struct nci_dev *ndev, | 87 | static int nci_queue_tx_data_frags(struct nci_dev *ndev, |
89 | __u8 conn_id, | 88 | __u8 conn_id, |
90 | struct sk_buff *skb) { | 89 | struct sk_buff *skb) { |
91 | int total_len = skb->len; | 90 | int total_len = skb->len; |
92 | unsigned char *data = skb->data; | 91 | unsigned char *data = skb->data; |
93 | unsigned long flags; | 92 | unsigned long flags; |
@@ -105,8 +104,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev, | |||
105 | min_t(int, total_len, ndev->max_data_pkt_payload_size); | 104 | min_t(int, total_len, ndev->max_data_pkt_payload_size); |
106 | 105 | ||
107 | skb_frag = nci_skb_alloc(ndev, | 106 | skb_frag = nci_skb_alloc(ndev, |
108 | (NCI_DATA_HDR_SIZE + frag_len), | 107 | (NCI_DATA_HDR_SIZE + frag_len), |
109 | GFP_KERNEL); | 108 | GFP_KERNEL); |
110 | if (skb_frag == NULL) { | 109 | if (skb_frag == NULL) { |
111 | rc = -ENOMEM; | 110 | rc = -ENOMEM; |
112 | goto free_exit; | 111 | goto free_exit; |
@@ -118,7 +117,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev, | |||
118 | 117 | ||
119 | /* second, set the header */ | 118 | /* second, set the header */ |
120 | nci_push_data_hdr(ndev, conn_id, skb_frag, | 119 | nci_push_data_hdr(ndev, conn_id, skb_frag, |
121 | ((total_len == frag_len) ? (NCI_PBF_LAST) : (NCI_PBF_CONT))); | 120 | ((total_len == frag_len) ? |
121 | (NCI_PBF_LAST) : (NCI_PBF_CONT))); | ||
122 | 122 | ||
123 | __skb_queue_tail(&frags_q, skb_frag); | 123 | __skb_queue_tail(&frags_q, skb_frag); |
124 | 124 | ||
@@ -186,8 +186,8 @@ exit: | |||
186 | /* ----------------- NCI RX Data ----------------- */ | 186 | /* ----------------- NCI RX Data ----------------- */ |
187 | 187 | ||
188 | static void nci_add_rx_data_frag(struct nci_dev *ndev, | 188 | static void nci_add_rx_data_frag(struct nci_dev *ndev, |
189 | struct sk_buff *skb, | 189 | struct sk_buff *skb, |
190 | __u8 pbf) | 190 | __u8 pbf) |
191 | { | 191 | { |
192 | int reassembly_len; | 192 | int reassembly_len; |
193 | int err = 0; | 193 | int err = 0; |
@@ -211,8 +211,8 @@ static void nci_add_rx_data_frag(struct nci_dev *ndev, | |||
211 | 211 | ||
212 | /* second, combine the two fragments */ | 212 | /* second, combine the two fragments */ |
213 | memcpy(skb_push(skb, reassembly_len), | 213 | memcpy(skb_push(skb, reassembly_len), |
214 | ndev->rx_data_reassembly->data, | 214 | ndev->rx_data_reassembly->data, |
215 | reassembly_len); | 215 | reassembly_len); |
216 | 216 | ||
217 | /* third, free old reassembly */ | 217 | /* third, free old reassembly */ |
218 | kfree_skb(ndev->rx_data_reassembly); | 218 | kfree_skb(ndev->rx_data_reassembly); |
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 03e7b4626a3e..2e3dee42196d 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c | |||
@@ -40,7 +40,7 @@ | |||
40 | /* Handle NCI Notification packets */ | 40 | /* Handle NCI Notification packets */ |
41 | 41 | ||
42 | static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | 42 | static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, |
43 | struct sk_buff *skb) | 43 | struct sk_buff *skb) |
44 | { | 44 | { |
45 | struct nci_core_conn_credit_ntf *ntf = (void *) skb->data; | 45 | struct nci_core_conn_credit_ntf *ntf = (void *) skb->data; |
46 | int i; | 46 | int i; |
@@ -62,7 +62,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | |||
62 | if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { | 62 | if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { |
63 | /* found static rf connection */ | 63 | /* found static rf connection */ |
64 | atomic_add(ntf->conn_entries[i].credits, | 64 | atomic_add(ntf->conn_entries[i].credits, |
65 | &ndev->credits_cnt); | 65 | &ndev->credits_cnt); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
@@ -72,7 +72,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, | 74 | static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, |
75 | struct sk_buff *skb) | 75 | struct sk_buff *skb) |
76 | { | 76 | { |
77 | __u8 status = skb->data[0]; | 77 | __u8 status = skb->data[0]; |
78 | 78 | ||
@@ -80,7 +80,7 @@ static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, | |||
80 | 80 | ||
81 | if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) { | 81 | if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) { |
82 | /* Activation failed, so complete the request | 82 | /* Activation failed, so complete the request |
83 | (the state remains the same) */ | 83 | (the state remains the same) */ |
84 | nci_req_complete(ndev, status); | 84 | nci_req_complete(ndev, status); |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -101,7 +101,7 @@ static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev, | |||
101 | 101 | ||
102 | static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, | 102 | static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, |
103 | struct rf_tech_specific_params_nfca_poll *nfca_poll, | 103 | struct rf_tech_specific_params_nfca_poll *nfca_poll, |
104 | __u8 *data) | 104 | __u8 *data) |
105 | { | 105 | { |
106 | nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); | 106 | nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); |
107 | data += 2; | 107 | data += 2; |
@@ -128,7 +128,7 @@ static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, | |||
128 | 128 | ||
129 | static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, | 129 | static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, |
130 | struct rf_tech_specific_params_nfcb_poll *nfcb_poll, | 130 | struct rf_tech_specific_params_nfcb_poll *nfcb_poll, |
131 | __u8 *data) | 131 | __u8 *data) |
132 | { | 132 | { |
133 | nfcb_poll->sensb_res_len = *data++; | 133 | nfcb_poll->sensb_res_len = *data++; |
134 | 134 | ||
@@ -142,13 +142,13 @@ static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, | |||
142 | 142 | ||
143 | static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev, | 143 | static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev, |
144 | struct rf_tech_specific_params_nfcf_poll *nfcf_poll, | 144 | struct rf_tech_specific_params_nfcf_poll *nfcf_poll, |
145 | __u8 *data) | 145 | __u8 *data) |
146 | { | 146 | { |
147 | nfcf_poll->bit_rate = *data++; | 147 | nfcf_poll->bit_rate = *data++; |
148 | nfcf_poll->sensf_res_len = *data++; | 148 | nfcf_poll->sensf_res_len = *data++; |
149 | 149 | ||
150 | pr_debug("bit_rate %d, sensf_res_len %d\n", | 150 | pr_debug("bit_rate %d, sensf_res_len %d\n", |
151 | nfcf_poll->bit_rate, nfcf_poll->sensf_res_len); | 151 | nfcf_poll->bit_rate, nfcf_poll->sensf_res_len); |
152 | 152 | ||
153 | memcpy(nfcf_poll->sensf_res, data, nfcf_poll->sensf_res_len); | 153 | memcpy(nfcf_poll->sensf_res, data, nfcf_poll->sensf_res_len); |
154 | data += nfcf_poll->sensf_res_len; | 154 | data += nfcf_poll->sensf_res_len; |
@@ -189,7 +189,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev, | |||
189 | target->nfcid1_len = nfca_poll->nfcid1_len; | 189 | target->nfcid1_len = nfca_poll->nfcid1_len; |
190 | if (target->nfcid1_len > 0) { | 190 | if (target->nfcid1_len > 0) { |
191 | memcpy(target->nfcid1, nfca_poll->nfcid1, | 191 | memcpy(target->nfcid1, nfca_poll->nfcid1, |
192 | target->nfcid1_len); | 192 | target->nfcid1_len); |
193 | } | 193 | } |
194 | } else if (rf_tech_and_mode == NCI_NFC_B_PASSIVE_POLL_MODE) { | 194 | } else if (rf_tech_and_mode == NCI_NFC_B_PASSIVE_POLL_MODE) { |
195 | nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params; | 195 | nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params; |
@@ -197,7 +197,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev, | |||
197 | target->sensb_res_len = nfcb_poll->sensb_res_len; | 197 | target->sensb_res_len = nfcb_poll->sensb_res_len; |
198 | if (target->sensb_res_len > 0) { | 198 | if (target->sensb_res_len > 0) { |
199 | memcpy(target->sensb_res, nfcb_poll->sensb_res, | 199 | memcpy(target->sensb_res, nfcb_poll->sensb_res, |
200 | target->sensb_res_len); | 200 | target->sensb_res_len); |
201 | } | 201 | } |
202 | } else if (rf_tech_and_mode == NCI_NFC_F_PASSIVE_POLL_MODE) { | 202 | } else if (rf_tech_and_mode == NCI_NFC_F_PASSIVE_POLL_MODE) { |
203 | nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params; | 203 | nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params; |
@@ -205,7 +205,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev, | |||
205 | target->sensf_res_len = nfcf_poll->sensf_res_len; | 205 | target->sensf_res_len = nfcf_poll->sensf_res_len; |
206 | if (target->sensf_res_len > 0) { | 206 | if (target->sensf_res_len > 0) { |
207 | memcpy(target->sensf_res, nfcf_poll->sensf_res, | 207 | memcpy(target->sensf_res, nfcf_poll->sensf_res, |
208 | target->sensf_res_len); | 208 | target->sensf_res_len); |
209 | } | 209 | } |
210 | } else { | 210 | } else { |
211 | pr_err("unsupported rf_tech_and_mode 0x%x\n", rf_tech_and_mode); | 211 | pr_err("unsupported rf_tech_and_mode 0x%x\n", rf_tech_and_mode); |
@@ -220,7 +220,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev, | |||
220 | } | 220 | } |
221 | 221 | ||
222 | static void nci_add_new_target(struct nci_dev *ndev, | 222 | static void nci_add_new_target(struct nci_dev *ndev, |
223 | struct nci_rf_discover_ntf *ntf) | 223 | struct nci_rf_discover_ntf *ntf) |
224 | { | 224 | { |
225 | struct nfc_target *target; | 225 | struct nfc_target *target; |
226 | int i, rc; | 226 | int i, rc; |
@@ -230,8 +230,8 @@ static void nci_add_new_target(struct nci_dev *ndev, | |||
230 | if (target->idx == ntf->rf_discovery_id) { | 230 | if (target->idx == ntf->rf_discovery_id) { |
231 | /* This target already exists, add the new protocol */ | 231 | /* This target already exists, add the new protocol */ |
232 | nci_add_new_protocol(ndev, target, ntf->rf_protocol, | 232 | nci_add_new_protocol(ndev, target, ntf->rf_protocol, |
233 | ntf->rf_tech_and_mode, | 233 | ntf->rf_tech_and_mode, |
234 | &ntf->rf_tech_specific_params); | 234 | &ntf->rf_tech_specific_params); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | } | 237 | } |
@@ -245,27 +245,27 @@ static void nci_add_new_target(struct nci_dev *ndev, | |||
245 | target = &ndev->targets[ndev->n_targets]; | 245 | target = &ndev->targets[ndev->n_targets]; |
246 | 246 | ||
247 | rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, | 247 | rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, |
248 | ntf->rf_tech_and_mode, | 248 | ntf->rf_tech_and_mode, |
249 | &ntf->rf_tech_specific_params); | 249 | &ntf->rf_tech_specific_params); |
250 | if (!rc) { | 250 | if (!rc) { |
251 | target->idx = ntf->rf_discovery_id; | 251 | target->idx = ntf->rf_discovery_id; |
252 | ndev->n_targets++; | 252 | ndev->n_targets++; |
253 | 253 | ||
254 | pr_debug("target_idx %d, n_targets %d\n", target->idx, | 254 | pr_debug("target_idx %d, n_targets %d\n", target->idx, |
255 | ndev->n_targets); | 255 | ndev->n_targets); |
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
259 | void nci_clear_target_list(struct nci_dev *ndev) | 259 | void nci_clear_target_list(struct nci_dev *ndev) |
260 | { | 260 | { |
261 | memset(ndev->targets, 0, | 261 | memset(ndev->targets, 0, |
262 | (sizeof(struct nfc_target)*NCI_MAX_DISCOVERED_TARGETS)); | 262 | (sizeof(struct nfc_target)*NCI_MAX_DISCOVERED_TARGETS)); |
263 | 263 | ||
264 | ndev->n_targets = 0; | 264 | ndev->n_targets = 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, | 267 | static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, |
268 | struct sk_buff *skb) | 268 | struct sk_buff *skb) |
269 | { | 269 | { |
270 | struct nci_rf_discover_ntf ntf; | 270 | struct nci_rf_discover_ntf ntf; |
271 | __u8 *data = skb->data; | 271 | __u8 *data = skb->data; |
@@ -280,7 +280,7 @@ static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, | |||
280 | pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); | 280 | pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); |
281 | pr_debug("rf_tech_and_mode 0x%x\n", ntf.rf_tech_and_mode); | 281 | pr_debug("rf_tech_and_mode 0x%x\n", ntf.rf_tech_and_mode); |
282 | pr_debug("rf_tech_specific_params_len %d\n", | 282 | pr_debug("rf_tech_specific_params_len %d\n", |
283 | ntf.rf_tech_specific_params_len); | 283 | ntf.rf_tech_specific_params_len); |
284 | 284 | ||
285 | if (ntf.rf_tech_specific_params_len > 0) { | 285 | if (ntf.rf_tech_specific_params_len > 0) { |
286 | switch (ntf.rf_tech_and_mode) { | 286 | switch (ntf.rf_tech_and_mode) { |
@@ -318,7 +318,7 @@ static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, | |||
318 | } else { | 318 | } else { |
319 | atomic_set(&ndev->state, NCI_W4_HOST_SELECT); | 319 | atomic_set(&ndev->state, NCI_W4_HOST_SELECT); |
320 | nfc_targets_found(ndev->nfc_dev, ndev->targets, | 320 | nfc_targets_found(ndev->nfc_dev, ndev->targets, |
321 | ndev->n_targets); | 321 | ndev->n_targets); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
@@ -335,20 +335,17 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, | |||
335 | pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len); | 335 | pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len); |
336 | if (nfca_poll->rats_res_len > 0) { | 336 | if (nfca_poll->rats_res_len > 0) { |
337 | memcpy(nfca_poll->rats_res, | 337 | memcpy(nfca_poll->rats_res, |
338 | data, | 338 | data, nfca_poll->rats_res_len); |
339 | nfca_poll->rats_res_len); | ||
340 | } | 339 | } |
341 | break; | 340 | break; |
342 | 341 | ||
343 | case NCI_NFC_B_PASSIVE_POLL_MODE: | 342 | case NCI_NFC_B_PASSIVE_POLL_MODE: |
344 | nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep; | 343 | nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep; |
345 | nfcb_poll->attrib_res_len = *data++; | 344 | nfcb_poll->attrib_res_len = *data++; |
346 | pr_debug("attrib_res_len %d\n", | 345 | pr_debug("attrib_res_len %d\n", nfcb_poll->attrib_res_len); |
347 | nfcb_poll->attrib_res_len); | ||
348 | if (nfcb_poll->attrib_res_len > 0) { | 346 | if (nfcb_poll->attrib_res_len > 0) { |
349 | memcpy(nfcb_poll->attrib_res, | 347 | memcpy(nfcb_poll->attrib_res, |
350 | data, | 348 | data, nfcb_poll->attrib_res_len); |
351 | nfcb_poll->attrib_res_len); | ||
352 | } | 349 | } |
353 | break; | 350 | break; |
354 | 351 | ||
@@ -362,7 +359,7 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev, | |||
362 | } | 359 | } |
363 | 360 | ||
364 | static void nci_target_auto_activated(struct nci_dev *ndev, | 361 | static void nci_target_auto_activated(struct nci_dev *ndev, |
365 | struct nci_rf_intf_activated_ntf *ntf) | 362 | struct nci_rf_intf_activated_ntf *ntf) |
366 | { | 363 | { |
367 | struct nfc_target *target; | 364 | struct nfc_target *target; |
368 | int rc; | 365 | int rc; |
@@ -370,8 +367,8 @@ static void nci_target_auto_activated(struct nci_dev *ndev, | |||
370 | target = &ndev->targets[ndev->n_targets]; | 367 | target = &ndev->targets[ndev->n_targets]; |
371 | 368 | ||
372 | rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, | 369 | rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, |
373 | ntf->activation_rf_tech_and_mode, | 370 | ntf->activation_rf_tech_and_mode, |
374 | &ntf->rf_tech_specific_params); | 371 | &ntf->rf_tech_specific_params); |
375 | if (rc) | 372 | if (rc) |
376 | return; | 373 | return; |
377 | 374 | ||
@@ -384,7 +381,7 @@ static void nci_target_auto_activated(struct nci_dev *ndev, | |||
384 | } | 381 | } |
385 | 382 | ||
386 | static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | 383 | static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, |
387 | struct sk_buff *skb) | 384 | struct sk_buff *skb) |
388 | { | 385 | { |
389 | struct nci_rf_intf_activated_ntf ntf; | 386 | struct nci_rf_intf_activated_ntf ntf; |
390 | __u8 *data = skb->data; | 387 | __u8 *data = skb->data; |
@@ -405,7 +402,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | |||
405 | ntf.activation_rf_tech_and_mode); | 402 | ntf.activation_rf_tech_and_mode); |
406 | pr_debug("max_data_pkt_payload_size 0x%x\n", | 403 | pr_debug("max_data_pkt_payload_size 0x%x\n", |
407 | ntf.max_data_pkt_payload_size); | 404 | ntf.max_data_pkt_payload_size); |
408 | pr_debug("initial_num_credits 0x%x\n", ntf.initial_num_credits); | 405 | pr_debug("initial_num_credits 0x%x\n", |
406 | ntf.initial_num_credits); | ||
409 | pr_debug("rf_tech_specific_params_len %d\n", | 407 | pr_debug("rf_tech_specific_params_len %d\n", |
410 | ntf.rf_tech_specific_params_len); | 408 | ntf.rf_tech_specific_params_len); |
411 | 409 | ||
@@ -441,18 +439,15 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, | |||
441 | 439 | ||
442 | pr_debug("data_exch_rf_tech_and_mode 0x%x\n", | 440 | pr_debug("data_exch_rf_tech_and_mode 0x%x\n", |
443 | ntf.data_exch_rf_tech_and_mode); | 441 | ntf.data_exch_rf_tech_and_mode); |
444 | pr_debug("data_exch_tx_bit_rate 0x%x\n", | 442 | pr_debug("data_exch_tx_bit_rate 0x%x\n", ntf.data_exch_tx_bit_rate); |
445 | ntf.data_exch_tx_bit_rate); | 443 | pr_debug("data_exch_rx_bit_rate 0x%x\n", ntf.data_exch_rx_bit_rate); |
446 | pr_debug("data_exch_rx_bit_rate 0x%x\n", | 444 | pr_debug("activation_params_len %d\n", ntf.activation_params_len); |
447 | ntf.data_exch_rx_bit_rate); | ||
448 | pr_debug("activation_params_len %d\n", | ||
449 | ntf.activation_params_len); | ||
450 | 445 | ||
451 | if (ntf.activation_params_len > 0) { | 446 | if (ntf.activation_params_len > 0) { |
452 | switch (ntf.rf_interface) { | 447 | switch (ntf.rf_interface) { |
453 | case NCI_RF_INTERFACE_ISO_DEP: | 448 | case NCI_RF_INTERFACE_ISO_DEP: |
454 | err = nci_extract_activation_params_iso_dep(ndev, | 449 | err = nci_extract_activation_params_iso_dep(ndev, |
455 | &ntf, data); | 450 | &ntf, data); |
456 | break; | 451 | break; |
457 | 452 | ||
458 | case NCI_RF_INTERFACE_FRAME: | 453 | case NCI_RF_INTERFACE_FRAME: |
@@ -489,7 +484,7 @@ exit: | |||
489 | } | 484 | } |
490 | 485 | ||
491 | static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, | 486 | static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, |
492 | struct sk_buff *skb) | 487 | struct sk_buff *skb) |
493 | { | 488 | { |
494 | struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; | 489 | struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; |
495 | 490 | ||
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index aa63b1e99188..3003c3390e49 100644 --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c | |||
@@ -67,19 +67,18 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
67 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; | 67 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; |
68 | 68 | ||
69 | if (ndev->num_supported_rf_interfaces > | 69 | if (ndev->num_supported_rf_interfaces > |
70 | NCI_MAX_SUPPORTED_RF_INTERFACES) { | 70 | NCI_MAX_SUPPORTED_RF_INTERFACES) { |
71 | ndev->num_supported_rf_interfaces = | 71 | ndev->num_supported_rf_interfaces = |
72 | NCI_MAX_SUPPORTED_RF_INTERFACES; | 72 | NCI_MAX_SUPPORTED_RF_INTERFACES; |
73 | } | 73 | } |
74 | 74 | ||
75 | memcpy(ndev->supported_rf_interfaces, | 75 | memcpy(ndev->supported_rf_interfaces, |
76 | rsp_1->supported_rf_interfaces, | 76 | rsp_1->supported_rf_interfaces, |
77 | ndev->num_supported_rf_interfaces); | 77 | ndev->num_supported_rf_interfaces); |
78 | 78 | ||
79 | rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces); | 79 | rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces); |
80 | 80 | ||
81 | ndev->max_logical_connections = | 81 | ndev->max_logical_connections = rsp_2->max_logical_connections; |
82 | rsp_2->max_logical_connections; | ||
83 | ndev->max_routing_table_size = | 82 | ndev->max_routing_table_size = |
84 | __le16_to_cpu(rsp_2->max_routing_table_size); | 83 | __le16_to_cpu(rsp_2->max_routing_table_size); |
85 | ndev->max_ctrl_pkt_payload_len = | 84 | ndev->max_ctrl_pkt_payload_len = |
@@ -121,7 +120,7 @@ exit: | |||
121 | } | 120 | } |
122 | 121 | ||
123 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, | 122 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, |
124 | struct sk_buff *skb) | 123 | struct sk_buff *skb) |
125 | { | 124 | { |
126 | __u8 status = skb->data[0]; | 125 | __u8 status = skb->data[0]; |
127 | 126 | ||
@@ -143,7 +142,7 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
143 | } | 142 | } |
144 | 143 | ||
145 | static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev, | 144 | static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev, |
146 | struct sk_buff *skb) | 145 | struct sk_buff *skb) |
147 | { | 146 | { |
148 | __u8 status = skb->data[0]; | 147 | __u8 status = skb->data[0]; |
149 | 148 | ||
@@ -155,7 +154,7 @@ static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev, | |||
155 | } | 154 | } |
156 | 155 | ||
157 | static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, | 156 | static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, |
158 | struct sk_buff *skb) | 157 | struct sk_buff *skb) |
159 | { | 158 | { |
160 | __u8 status = skb->data[0]; | 159 | __u8 status = skb->data[0]; |
161 | 160 | ||
@@ -163,7 +162,7 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, | |||
163 | 162 | ||
164 | /* If target was active, complete the request only in deactivate_ntf */ | 163 | /* If target was active, complete the request only in deactivate_ntf */ |
165 | if ((status != NCI_STATUS_OK) || | 164 | if ((status != NCI_STATUS_OK) || |
166 | (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { | 165 | (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { |
167 | nci_clear_target_list(ndev); | 166 | nci_clear_target_list(ndev); |
168 | atomic_set(&ndev->state, NCI_IDLE); | 167 | atomic_set(&ndev->state, NCI_IDLE); |
169 | nci_req_complete(ndev, status); | 168 | nci_req_complete(ndev, status); |