Skip to content

Commit

Permalink
NFC: pn533: Start listen timer from start_poll
Browse files Browse the repository at this point in the history
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 dfccd0f as it was impossible to start
from a listening cycle before it.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Samuel Ortiz committed Sep 24, 2013
1 parent 673088f commit cec4b8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,9 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev,
u32 im_protocols, u32 tm_protocols)
{
struct pn533 *dev = nfc_get_drvdata(nfc_dev);
struct pn533_poll_modulations *cur_mod;
u8 rand_mod;
int rc;

dev_dbg(&dev->interface->dev,
"%s: im protocols 0x%x tm protocols 0x%x\n",
Expand Down Expand Up @@ -2060,7 +2062,15 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev,
rand_mod %= dev->poll_mod_count;
dev->poll_mod_curr = rand_mod;

return pn533_send_poll_frame(dev);
cur_mod = dev->poll_mod_active[dev->poll_mod_curr];

rc = pn533_send_poll_frame(dev);

/* Start listen timer */
if (!rc && cur_mod->len == 0 && dev->poll_mod_count > 1)
mod_timer(&dev->listen_timer, jiffies + PN533_LISTEN_TIME * HZ);

return rc;
}

static void pn533_stop_poll(struct nfc_dev *nfc_dev)
Expand Down

0 comments on commit cec4b8e

Please sign in to comment.