From: Amitkumar Karwar <akarwar@marvell.com>
Date: Mon, 6 Jan 2014 20:58:17 +0000 (-0800)
Subject: NFC: NCI: Add setup handler
X-Git-Tag: firefly_0821_release~176^2~4570^2~3^2^2~44^2~6
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=86e8586ed5beea15ce7c359f02a1084c2da93bc7;p=firefly-linux-kernel-4.4.55.git

NFC: NCI: Add setup handler

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>
---

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 6126f1f992b4..5c6fadd63483 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -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
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 6fbb7bab46e7..29c1caf3e975 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -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));