aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/nci
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-12-02 15:27:48 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2014-12-02 16:47:07 -0500
commit4391590c4038d506a806503f66b9b2521a771e9e (patch)
tree826bd04907beea5f5ac1146f4d43c0566f091d80 /net/nfc/nci
parent98ff416f97c53b727d6a52f4d2b29bdf4775ac69 (diff)
NFC: nci: Add management for NCI state for machine rf_deactivate_ntf
A notification for rf deaction can be IDLE_MODE, SLEEP_MODE, SLEEP_AF_MODE and DISCOVERY. According to each type and the NCI state machine is different (see figure 10 RF Communication State Machine in NCI specification) Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci')
-rw-r--r--net/nfc/nci/ntf.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index ccc3606fd8b2..17ee28aff68f 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -680,11 +680,21 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
680 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags)) 680 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
681 nci_data_exchange_complete(ndev, NULL, -EIO); 681 nci_data_exchange_complete(ndev, NULL, -EIO);
682 682
683 nci_clear_target_list(ndev); 683 switch (ntf->type) {
684 if (ntf->type == NCI_DEACTIVATE_TYPE_DISCOVERY) 684 case NCI_DEACTIVATE_TYPE_IDLE_MODE:
685 atomic_set(&ndev->state, NCI_DISCOVERY); 685 nci_clear_target_list(ndev);
686 else
687 atomic_set(&ndev->state, NCI_IDLE); 686 atomic_set(&ndev->state, NCI_IDLE);
687 break;
688 case NCI_DEACTIVATE_TYPE_SLEEP_MODE:
689 case NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE:
690 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
691 break;
692 case NCI_DEACTIVATE_TYPE_DISCOVERY:
693 nci_clear_target_list(ndev);
694 atomic_set(&ndev->state, NCI_DISCOVERY);
695 break;
696 }
697
688 nci_req_complete(ndev, NCI_STATUS_OK); 698 nci_req_complete(ndev, NCI_STATUS_OK);
689} 699}
690 700