diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-08-21 09:12:06 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-09-24 19:35:41 -0400 |
commit | cec4b8edc9c139ef658e2a26aa38a2a4b768aec6 (patch) | |
tree | 4ad69fc6a954dfe52a84105d630eb678a9949408 | |
parent | 673088fb42d0d6de500c4d3e22527611982dcce1 (diff) |
NFC: pn533: Start listen timer from start_poll
If we start the polling loop from a listening cycle, we need to start
the corresponding timer as well.
This bug showed up after commit dfccd0f5 as it was impossible to start
from a listening cycle before it.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/nfc/pn533.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 8cffd73690b8..dbe962c47a56 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -2027,7 +2027,9 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, | |||
2027 | u32 im_protocols, u32 tm_protocols) | 2027 | u32 im_protocols, u32 tm_protocols) |
2028 | { | 2028 | { |
2029 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); | 2029 | struct pn533 *dev = nfc_get_drvdata(nfc_dev); |
2030 | struct pn533_poll_modulations *cur_mod; | ||
2030 | u8 rand_mod; | 2031 | u8 rand_mod; |
2032 | int rc; | ||
2031 | 2033 | ||
2032 | dev_dbg(&dev->interface->dev, | 2034 | dev_dbg(&dev->interface->dev, |
2033 | "%s: im protocols 0x%x tm protocols 0x%x\n", | 2035 | "%s: im protocols 0x%x tm protocols 0x%x\n", |
@@ -2060,7 +2062,15 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, | |||
2060 | rand_mod %= dev->poll_mod_count; | 2062 | rand_mod %= dev->poll_mod_count; |
2061 | dev->poll_mod_curr = rand_mod; | 2063 | dev->poll_mod_curr = rand_mod; |
2062 | 2064 | ||
2063 | return pn533_send_poll_frame(dev); | 2065 | cur_mod = dev->poll_mod_active[dev->poll_mod_curr]; |
2066 | |||
2067 | rc = pn533_send_poll_frame(dev); | ||
2068 | |||
2069 | /* Start listen timer */ | ||
2070 | if (!rc && cur_mod->len == 0 && dev->poll_mod_count > 1) | ||
2071 | mod_timer(&dev->listen_timer, jiffies + PN533_LISTEN_TIME * HZ); | ||
2072 | |||
2073 | return rc; | ||
2064 | } | 2074 | } |
2065 | 2075 | ||
2066 | static void pn533_stop_poll(struct nfc_dev *nfc_dev) | 2076 | static void pn533_stop_poll(struct nfc_dev *nfc_dev) |