NFC: nci: Add management for NCI state for machine rf_deactivate_ntf
authorChristophe Ricard <christophe.ricard@gmail.com>
Tue, 2 Dec 2014 20:27:48 +0000 (21:27 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 2 Dec 2014 21:47:07 +0000 (22:47 +0100)
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>
net/nfc/nci/ntf.c

index ccc3606fd8b2003579d6d0f122827ee8ae9420ff..17ee28aff68ffc307db9c7f88d32d6a53858238a 100644 (file)
@@ -680,11 +680,21 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
        if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
                nci_data_exchange_complete(ndev, NULL, -EIO);
 
-       nci_clear_target_list(ndev);
-       if (ntf->type == NCI_DEACTIVATE_TYPE_DISCOVERY)
-               atomic_set(&ndev->state, NCI_DISCOVERY);
-       else
+       switch (ntf->type) {
+       case NCI_DEACTIVATE_TYPE_IDLE_MODE:
+               nci_clear_target_list(ndev);
                atomic_set(&ndev->state, NCI_IDLE);
+               break;
+       case NCI_DEACTIVATE_TYPE_SLEEP_MODE:
+       case NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE:
+               atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
+               break;
+       case NCI_DEACTIVATE_TYPE_DISCOVERY:
+               nci_clear_target_list(ndev);
+               atomic_set(&ndev->state, NCI_DISCOVERY);
+               break;
+       }
+
        nci_req_complete(ndev, NCI_STATUS_OK);
 }
 
This page took 0.025581 seconds and 5 git commands to generate.