aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/hci/shdlc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/hci/shdlc.c')
-rw-r--r--net/nfc/hci/shdlc.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/net/nfc/hci/shdlc.c b/net/nfc/hci/shdlc.c
index 6b836e6242b7..6f840c18c892 100644
--- a/net/nfc/hci/shdlc.c
+++ b/net/nfc/hci/shdlc.c
@@ -340,15 +340,6 @@ static void nfc_shdlc_connect_complete(struct nfc_shdlc *shdlc, int r)
340 shdlc->state = SHDLC_CONNECTED; 340 shdlc->state = SHDLC_CONNECTED;
341 } else { 341 } else {
342 shdlc->state = SHDLC_DISCONNECTED; 342 shdlc->state = SHDLC_DISCONNECTED;
343
344 /*
345 * TODO: Could it be possible that there are pending
346 * executing commands that are waiting for connect to complete
347 * before they can be carried? As connect is a blocking
348 * operation, it would require that the userspace process can
349 * send commands on the same device from a second thread before
350 * the device is up. I don't think that is possible, is it?
351 */
352 } 343 }
353 344
354 shdlc->connect_result = r; 345 shdlc->connect_result = r;
@@ -413,12 +404,12 @@ static void nfc_shdlc_rcv_u_frame(struct nfc_shdlc *shdlc,
413 r = nfc_shdlc_connect_send_ua(shdlc); 404 r = nfc_shdlc_connect_send_ua(shdlc);
414 nfc_shdlc_connect_complete(shdlc, r); 405 nfc_shdlc_connect_complete(shdlc, r);
415 } 406 }
416 } else if (shdlc->state > SHDLC_NEGOCIATING) { 407 } else if (shdlc->state == SHDLC_CONNECTED) {
417 /* 408 /*
418 * TODO: Chip wants to reset link 409 * Chip wants to reset link. This is unexpected and
419 * send ua, empty skb lists, reset counters 410 * unsupported.
420 * propagate info to HCI layer
421 */ 411 */
412 shdlc->hard_fault = -ECONNRESET;
422 } 413 }
423 break; 414 break;
424 case U_FRAME_UA: 415 case U_FRAME_UA:
@@ -523,10 +514,6 @@ static void nfc_shdlc_handle_send_queue(struct nfc_shdlc *shdlc)
523 514
524 r = shdlc->ops->xmit(shdlc, skb); 515 r = shdlc->ops->xmit(shdlc, skb);
525 if (r < 0) { 516 if (r < 0) {
526 /*
527 * TODO: Cannot send, shdlc machine is dead, we
528 * must propagate the information up to HCI.
529 */
530 shdlc->hard_fault = r; 517 shdlc->hard_fault = r;
531 break; 518 break;
532 } 519 }
@@ -590,6 +577,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
590 skb_queue_purge(&shdlc->ack_pending_q); 577 skb_queue_purge(&shdlc->ack_pending_q);
591 break; 578 break;
592 case SHDLC_CONNECTING: 579 case SHDLC_CONNECTING:
580 if (shdlc->hard_fault) {
581 nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
582 break;
583 }
584
593 if (shdlc->connect_tries++ < 5) 585 if (shdlc->connect_tries++ < 5)
594 r = nfc_shdlc_connect_initiate(shdlc); 586 r = nfc_shdlc_connect_initiate(shdlc);
595 else 587 else
@@ -610,6 +602,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
610 } 602 }
611 603
612 nfc_shdlc_handle_rcv_queue(shdlc); 604 nfc_shdlc_handle_rcv_queue(shdlc);
605
606 if (shdlc->hard_fault) {
607 nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
608 break;
609 }
613 break; 610 break;
614 case SHDLC_CONNECTED: 611 case SHDLC_CONNECTED:
615 nfc_shdlc_handle_rcv_queue(shdlc); 612 nfc_shdlc_handle_rcv_queue(shdlc);
@@ -637,10 +634,7 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
637 } 634 }
638 635
639 if (shdlc->hard_fault) { 636 if (shdlc->hard_fault) {
640 /* 637 nfc_hci_driver_failure(shdlc->hdev, shdlc->hard_fault);
641 * TODO: Handle hard_fault that occured during
642 * this invocation of the shdlc worker
643 */
644 } 638 }
645 break; 639 break;
646 default: 640 default:
@@ -923,8 +917,6 @@ void nfc_shdlc_free(struct nfc_shdlc *shdlc)
923{ 917{
924 pr_debug("\n"); 918 pr_debug("\n");
925 919
926 /* TODO: Check that this cannot be called while still in use */
927
928 nfc_hci_unregister_device(shdlc->hdev); 920 nfc_hci_unregister_device(shdlc->hdev);
929 nfc_hci_free_device(shdlc->hdev); 921 nfc_hci_free_device(shdlc->hdev);
930 922