summaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-02 15:12:29 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 23:13:43 +0200
commit0e840ed59ba79670b66bba8c1d50b6f67e72d3fb (patch)
tree7b20b0b75f61776f7b55fd31e270339f16832e3a /drivers/nfc
parent7a1e5552af61dce180f70c6fafe31553254b3728 (diff)
downloadlinux-0e840ed59ba79670b66bba8c1d50b6f67e72d3fb.tar.bz2
NFC: trf7970a: Only fill FIFO if there is space
Handle the case where trf7970a_fill_fifo() is called but there is no room in the FIFO for more TX data. When this happens, wait for another interrupt indicating that there is now space (and set a timer in case that interrupt never occurs). Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/trf7970a.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 8a13daf97747..e9e961fe6756 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -580,6 +580,12 @@ static void trf7970a_fill_fifo(struct trf7970a *trf)
/* Calculate how much more data can be written to the fifo */
len = TRF7970A_FIFO_SIZE - fifo_bytes;
+ if (!len) {
+ schedule_delayed_work(&trf->timeout_work,
+ msecs_to_jiffies(TRF7970A_WAIT_FOR_FIFO_DRAIN_TIMEOUT));
+ return;
+ }
+
len = min(skb->len, len);
prefix = TRF7970A_CMD_BIT_CONTINUOUS | TRF7970A_FIFO_IO_REGISTER;