diff options
Diffstat (limited to 'net/nfc/nci/core.c')
-rw-r--r-- | net/nfc/nci/core.c | 113 |
1 files changed, 54 insertions, 59 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 | } |