aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@intel.com>2012-04-30 12:21:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 16:42:04 -0400
commita9a741a7e2e6337ae5c030e78827c233c08902a7 (patch)
tree3983a98f7fff990d420aa123081ffc3ef9b2c8e1 /net/nfc
parentc32cdbd84ffe289a1386eccb794b047a8366913d (diff)
NFC: Prepare asynchronous error management for driver and shdlc
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/hci/core.c8
-rw-r--r--net/nfc/hci/shdlc.c19
2 files changed, 19 insertions, 8 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index a8b0b71e8f86..1dc6485343b9 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -717,6 +717,14 @@ void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev)
717} 717}
718EXPORT_SYMBOL(nfc_hci_get_clientdata); 718EXPORT_SYMBOL(nfc_hci_get_clientdata);
719 719
720void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err)
721{
722 /* TODO: lower layer has permanent failure.
723 * complete potential HCI command or send an empty tag discovered event
724 */
725}
726EXPORT_SYMBOL(nfc_hci_driver_failure);
727
720void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb) 728void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb)
721{ 729{
722 struct hcp_packet *packet; 730 struct hcp_packet *packet;
diff --git a/net/nfc/hci/shdlc.c b/net/nfc/hci/shdlc.c
index 6b836e6242b7..d7c74d152a72 100644
--- a/net/nfc/hci/shdlc.c
+++ b/net/nfc/hci/shdlc.c
@@ -523,10 +523,6 @@ static void nfc_shdlc_handle_send_queue(struct nfc_shdlc *shdlc)
523 523
524 r = shdlc->ops->xmit(shdlc, skb); 524 r = shdlc->ops->xmit(shdlc, skb);
525 if (r < 0) { 525 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; 526 shdlc->hard_fault = r;
531 break; 527 break;
532 } 528 }
@@ -590,6 +586,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
590 skb_queue_purge(&shdlc->ack_pending_q); 586 skb_queue_purge(&shdlc->ack_pending_q);
591 break; 587 break;
592 case SHDLC_CONNECTING: 588 case SHDLC_CONNECTING:
589 if (shdlc->hard_fault) {
590 nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
591 break;
592 }
593
593 if (shdlc->connect_tries++ < 5) 594 if (shdlc->connect_tries++ < 5)
594 r = nfc_shdlc_connect_initiate(shdlc); 595 r = nfc_shdlc_connect_initiate(shdlc);
595 else 596 else
@@ -610,6 +611,11 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
610 } 611 }
611 612
612 nfc_shdlc_handle_rcv_queue(shdlc); 613 nfc_shdlc_handle_rcv_queue(shdlc);
614
615 if (shdlc->hard_fault) {
616 nfc_shdlc_connect_complete(shdlc, shdlc->hard_fault);
617 break;
618 }
613 break; 619 break;
614 case SHDLC_CONNECTED: 620 case SHDLC_CONNECTED:
615 nfc_shdlc_handle_rcv_queue(shdlc); 621 nfc_shdlc_handle_rcv_queue(shdlc);
@@ -637,10 +643,7 @@ static void nfc_shdlc_sm_work(struct work_struct *work)
637 } 643 }
638 644
639 if (shdlc->hard_fault) { 645 if (shdlc->hard_fault) {
640 /* 646 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 } 647 }
645 break; 648 break;
646 default: 649 default: