Browse Source

NFC: trf7970a: Only abort a command if one is active

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>
Mark A. Greer 11 năm trước cách đây
mục cha
commit
5876bc75e2
1 tập tin đã thay đổi với 12 bổ sung1 xóa
  1. 12 1
      drivers/nfc/trf7970a.c

+ 12 - 1
drivers/nfc/trf7970a.c

@@ -1191,7 +1191,18 @@ static void trf7970a_abort_cmd(struct nfc_digital_dev *ddev)
 	dev_dbg(trf->dev, "Abort process initiated\n");
 	dev_dbg(trf->dev, "Abort process initiated\n");
 
 
 	mutex_lock(&trf->lock);
 	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);
 	mutex_unlock(&trf->lock);
 }
 }