]> Pileus Git - ~andy/linux/blobdiff - net/nfc/hci/core.c
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
[~andy/linux] / net / nfc / hci / core.c
index f30f6fe815b4b56a009b1021af28a16ce5810f80..91020b210d8774416467bf009130cad9db5870a1 100644 (file)
@@ -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;
        }
 
@@ -673,8 +675,10 @@ static int hci_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
 
        if (hdev->ops->tm_send)
                return hdev->ops->tm_send(hdev, skb);
-       else
-               return -ENOTSUPP;
+
+       kfree_skb(skb);
+
+       return -ENOTSUPP;
 }
 
 static int hci_check_presence(struct nfc_dev *nfc_dev,
@@ -791,7 +795,9 @@ static struct nfc_ops hci_nfc_ops = {
 
 struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
                                            struct nfc_hci_init_data *init_data,
+                                           unsigned long quirks,
                                            u32 protocols,
+                                           u32 supported_se,
                                            const char *llc_name,
                                            int tx_headroom,
                                            int tx_tailroom,
@@ -817,7 +823,7 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
                return NULL;
        }
 
-       hdev->ndev = nfc_allocate_device(&hci_nfc_ops, protocols,
+       hdev->ndev = nfc_allocate_device(&hci_nfc_ops, protocols, supported_se,
                                         tx_headroom + HCI_CMDS_HEADROOM,
                                         tx_tailroom);
        if (!hdev->ndev) {
@@ -834,6 +840,8 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
 
        memset(hdev->gate2pipe, NFC_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe));
 
+       hdev->quirks = quirks;
+
        return hdev;
 }
 EXPORT_SYMBOL(nfc_hci_allocate_device);