NFC: NCI: Add setup handler
authorAmitkumar Karwar <akarwar@marvell.com>
Mon, 6 Jan 2014 20:58:17 +0000 (12:58 -0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 7 Jan 2014 00:32:40 +0000 (01:32 +0100)
Some drivers require special configuration while initializing.
This patch adds setup handler for this custom configuration.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
include/net/nfc/nci_core.h
net/nfc/nci/core.c

index 6126f1f992b40068923771cf0a7967395f88017e..5c6fadd634833b7ec5912ccc9e87d752b878db61 100644 (file)
@@ -68,6 +68,7 @@ struct nci_ops {
        int (*open)(struct nci_dev *ndev);
        int (*close)(struct nci_dev *ndev);
        int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
+       int (*setup)(struct nci_dev *ndev);
 };
 
 #define NCI_MAX_SUPPORTED_RF_INTERFACES                4
index 6fbb7bab46e719f2193037911dbe9bf49a5926d6..29c1caf3e975447eb270e11b967aba085bd72b32 100644 (file)
@@ -301,6 +301,9 @@ static int nci_open_device(struct nci_dev *ndev)
        rc = __nci_request(ndev, nci_reset_req, 0,
                           msecs_to_jiffies(NCI_RESET_TIMEOUT));
 
+       if (ndev->ops->setup(ndev))
+               ndev->ops->setup(ndev);
+
        if (!rc) {
                rc = __nci_request(ndev, nci_init_req, 0,
                                   msecs_to_jiffies(NCI_INIT_TIMEOUT));