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>
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)
{
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;
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;