NFC: trf7970a: Don't turn off RF if its already off
authorMark A. Greer <mgreer@animalcreek.com>
Tue, 2 Sep 2014 22:12:40 +0000 (15:12 -0700)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 7 Sep 2014 21:13:45 +0000 (23:13 +0200)
Don't try to turn off of RF transmitter is its
already off.

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

index e4671e54424a375c717ac0539ffb54f15896f925..429146b7e6d8aa7817418ab7a836203cb4e4c67d 100644 (file)
@@ -859,6 +859,10 @@ err_out:
 
 static void trf7970a_switch_rf_off(struct trf7970a *trf)
 {
+       if ((trf->state == TRF7970A_ST_PWR_OFF) ||
+                       (trf->state == TRF7970A_ST_RF_OFF))
+               return;
+
        dev_dbg(trf->dev, "Switching rf off\n");
 
        trf->chip_status_ctrl &= ~TRF7970A_CHIP_STATUS_RF_ON;