From: Eric Lapuyade <eric.lapuyade@linux.intel.com>
Date: Mon, 29 Apr 2013 15:47:42 +0000 (+0200)
Subject: NFC: HCI: Implement fw_upload ops
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9a695d23aab889273821c91b4132f1ed315b251b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

NFC: HCI: Implement fw_upload ops

This is a simple forward to the HCI driver. When driver is done with the
operation, it shall directly notify NFC Core by calling
nfc_fw_upload_done().

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---

diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b87a1692b086..14faf2dc7a48 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -61,6 +61,7 @@ struct nfc_hci_ops {
 			      struct sk_buff *skb);
 	int (*enable_se)(struct nfc_dev *dev, u32 secure_element);
 	int (*disable_se)(struct nfc_dev *dev, u32 secure_element);
+	int (*fw_upload)(struct nfc_hci_dev *hdev, const char *firmware_name);
 };
 
 /* Pipes */
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index 91020b210d87..b7e4dac5654e 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -779,6 +779,16 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb)
 	}
 }
 
+static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name)
+{
+	struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
+
+	if (hdev->ops->fw_upload)
+		return hdev->ops->fw_upload(hdev, firmware_name);
+
+	return -ENOTSUPP;
+}
+
 static struct nfc_ops hci_nfc_ops = {
 	.dev_up = hci_dev_up,
 	.dev_down = hci_dev_down,
@@ -791,6 +801,7 @@ static struct nfc_ops hci_nfc_ops = {
 	.im_transceive = hci_transceive,
 	.tm_send = hci_tm_send,
 	.check_presence = hci_check_presence,
+	.fw_upload = hci_fw_upload,
 };
 
 struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,