]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NFC: trf7970a: Only abort a command if one is active
authorMark A. Greer <mgreer@animalcreek.com>
Tue, 25 Mar 2014 15:54:30 +0000 (08:54 -0700)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 21 Apr 2014 22:37:26 +0000 (00:37 +0200)
Only initiate the abort command process when there is an active command.
If the abort process were started and there wasn't an active command
then the next command issued by the digital layer would be incorrectly
aborted.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/trf7970a.c

index 9c93fbef496447726b02fe99f41eda16566dd3f2..cab302ce2c7ed3eb53a867d95b31537696b5b2eb 100644 (file)
@@ -1191,7 +1191,18 @@ static void trf7970a_abort_cmd(struct nfc_digital_dev *ddev)
        dev_dbg(trf->dev, "Abort process initiated\n");
 
        mutex_lock(&trf->lock);
-       trf->aborting = true;
+
+       switch (trf->state) {
+       case TRF7970A_ST_WAIT_FOR_TX_FIFO:
+       case TRF7970A_ST_WAIT_FOR_RX_DATA:
+       case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT:
+       case TRF7970A_ST_WAIT_TO_ISSUE_EOF:
+               trf->aborting = true;
+               break;
+       default:
+               break;
+       }
+
        mutex_unlock(&trf->lock);
 }