aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2012-10-02 11:27:36 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-10-26 12:26:46 -0400
commit632c016ab8ba1f98262bd6242b38d73ee4ae652e (patch)
tree7349250c5faa50c93a48ee5eba81e9fdad682439
parentda052850b911dfd0fcd5c8d6308917ebe2edbacf (diff)
NFC: HCI check presence must not fail when driver doesn't support it
When the driver does not support checking the tag is still present, it must return -EOPNOTSUPP. The NFC Core will then stop asking and not report a tag lost event to user space. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/pn544_hci.c2
-rw-r--r--net/nfc/core.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/drivers/nfc/pn544_hci.c b/drivers/nfc/pn544_hci.c
index b66d4681a577..70858b5f81e4 100644
--- a/drivers/nfc/pn544_hci.c
+++ b/drivers/nfc/pn544_hci.c
@@ -986,7 +986,7 @@ static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
986 } else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) { 986 } else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) {
987 if (target->nfcid1_len != 4 && target->nfcid1_len != 7 && 987 if (target->nfcid1_len != 4 && target->nfcid1_len != 7 &&
988 target->nfcid1_len != 10) 988 target->nfcid1_len != 10)
989 return -EPROTO; 989 return -EOPNOTSUPP;
990 990
991 return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE, 991 return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE,
992 PN544_RF_READER_CMD_ACTIVATE_NEXT, 992 PN544_RF_READER_CMD_ACTIVATE_NEXT,
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 479bee36dc3e..4cb069766ce5 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -697,6 +697,8 @@ static void nfc_check_pres_work(struct work_struct *work)
697 697
698 if (dev->active_target && timer_pending(&dev->check_pres_timer) == 0) { 698 if (dev->active_target && timer_pending(&dev->check_pres_timer) == 0) {
699 rc = dev->ops->check_presence(dev, dev->active_target); 699 rc = dev->ops->check_presence(dev, dev->active_target);
700 if (rc == -EOPNOTSUPP)
701 goto exit;
700 if (!rc) { 702 if (!rc) {
701 mod_timer(&dev->check_pres_timer, jiffies + 703 mod_timer(&dev->check_pres_timer, jiffies +
702 msecs_to_jiffies(NFC_CHECK_PRES_FREQ_MS)); 704 msecs_to_jiffies(NFC_CHECK_PRES_FREQ_MS));
@@ -708,6 +710,7 @@ static void nfc_check_pres_work(struct work_struct *work)
708 } 710 }
709 } 711 }
710 712
713exit:
711 device_unlock(&dev->dev); 714 device_unlock(&dev->dev);
712} 715}
713 716