diff options
author | Michael Thalmeier <michael.thalmeier@hale.at> | 2016-04-21 10:43:52 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-05-09 18:01:16 -0400 |
commit | c952f915ce8567120ffdf12998ad0c945fbc93ac (patch) | |
tree | 6519e34422b2ad22b7e562f487c3f0c696ee3c70 /drivers/nfc | |
parent | 30f98489f54e027001cc9b27c59840975871de65 (diff) |
NFC: pn533: reset poll modulation list before calling targets_found
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>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/pn533/pn533.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index d82eecd8daad..745181ea693b 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c | |||
@@ -865,6 +865,7 @@ static int pn533_target_found_type_b(struct nfc_target *nfc_tgt, u8 *tgt_data, | |||
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
867 | 867 | ||
868 | static void pn533_poll_reset_mod_list(struct pn533 *dev); | ||
868 | static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata, | 869 | static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata, |
869 | int tgdata_len) | 870 | int tgdata_len) |
870 | { | 871 | { |
@@ -914,6 +915,7 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata, | |||
914 | 915 | ||
915 | dev->tgt_available_prots = nfc_tgt.supported_protocols; | 916 | dev->tgt_available_prots = nfc_tgt.supported_protocols; |
916 | 917 | ||
918 | pn533_poll_reset_mod_list(dev); | ||
917 | nfc_targets_found(dev->nfc_dev, &nfc_tgt, 1); | 919 | nfc_targets_found(dev->nfc_dev, &nfc_tgt, 1); |
918 | 920 | ||
919 | return 0; | 921 | return 0; |
@@ -980,10 +982,8 @@ static int pn533_start_poll_complete(struct pn533 *dev, struct sk_buff *resp) | |||
980 | rc = pn533_target_found(dev, tg, tgdata, tgdata_len); | 982 | rc = pn533_target_found(dev, tg, tgdata, tgdata_len); |
981 | 983 | ||
982 | /* We must stop the poll after a valid target found */ | 984 | /* We must stop the poll after a valid target found */ |
983 | if (rc == 0) { | 985 | if (rc == 0) |
984 | pn533_poll_reset_mod_list(dev); | ||
985 | return 0; | 986 | return 0; |
986 | } | ||
987 | } | 987 | } |
988 | 988 | ||
989 | return -EAGAIN; | 989 | return -EAGAIN; |