Skip to content

Commit

Permalink
NFC: pn533: reset poll modulation list before calling targets_found
Browse files Browse the repository at this point in the history
We need to reset the poll modulation list before calling
nfc_targets_found because otherwise userspace could run
before the modulation list is cleared and then get a "Cannot
activate target while polling" error upon calling activate_target.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Michael Thalmeier authored and Samuel Ortiz committed May 9, 2016
1 parent 30f9848 commit c952f91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/nfc/pn533/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ static int pn533_target_found_type_b(struct nfc_target *nfc_tgt, u8 *tgt_data,
return 0;
}

static void pn533_poll_reset_mod_list(struct pn533 *dev);
static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata,
int tgdata_len)
{
Expand Down Expand Up @@ -914,6 +915,7 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata,

dev->tgt_available_prots = nfc_tgt.supported_protocols;

pn533_poll_reset_mod_list(dev);
nfc_targets_found(dev->nfc_dev, &nfc_tgt, 1);

return 0;
Expand Down Expand Up @@ -980,10 +982,8 @@ static int pn533_start_poll_complete(struct pn533 *dev, struct sk_buff *resp)
rc = pn533_target_found(dev, tg, tgdata, tgdata_len);

/* We must stop the poll after a valid target found */
if (rc == 0) {
pn533_poll_reset_mod_list(dev);
if (rc == 0)
return 0;
}
}

return -EAGAIN;
Expand Down

0 comments on commit c952f91

Please sign in to comment.