summaryrefslogtreecommitdiffstats
path: root/net/nfc/hci
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2012-12-04 16:43:24 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-10 00:51:49 +0100
commit40d06d3647ea872a7346be1f6859f18cd0fe08d3 (patch)
treed219fb5d6eeaa5c0ece6cb554c0cf5b39fb6137f /net/nfc/hci
parentNFC: Added error handling in event_received hci ops (diff)
downloadlinux-40d06d3647ea872a7346be1f6859f18cd0fe08d3.tar.xz
linux-40d06d3647ea872a7346be1f6859f18cd0fe08d3.zip
NFC: Changed event_received hci ops result semantic
Some chips use a standard HCI event code, destined to a proprietary gate, with a different meaning. Therefore, the HCI driver must always have a chance to intercept the event before standard processing is attempted. The new semantic specifies that the result value "1" means that the driver doesn't especially handle the event. result <= 0 means it was handled. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/hci')
-rw-r--r--net/nfc/hci/core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index f30f6fe815b4..0430f3086e41 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -297,6 +297,12 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
goto exit;
}
+ if (hdev->ops->event_received) {
+ r = hdev->ops->event_received(hdev, gate, event, skb);
+ if (r <= 0)
+ goto exit_noskb;
+ }
+
switch (event) {
case NFC_HCI_EVT_TARGET_DISCOVERED:
if (skb->len < 1) { /* no status data? */
@@ -322,12 +328,8 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
r = nfc_hci_target_discovered(hdev, gate);
break;
default:
- if (hdev->ops->event_received) {
- r = hdev->ops->event_received(hdev, gate, event, skb);
- goto exit_noskb;
- } else {
- r = -EINVAL;
- }
+ pr_info("Discarded unknown event %x to gate %x\n", event, gate);
+ r = -EINVAL;
break;
}