linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
	kiraank@gmail.com, Kiran K <kiran.k@intel.com>,
	Amit K Bag <amit.k.bag@intel.com>,
	Raghuram Hegde <raghuram.hegde@intel.com>
Subject: [PATCH v2 2/5] Bluetooth: btintel: Refactor firmware header download sequence
Date: Fri,  3 Jul 2020 12:42:09 +0530	[thread overview]
Message-ID: <20200703071212.17046-2-kiran.k@intel.com> (raw)
In-Reply-To: <20200703071212.17046-1-kiran.k@intel.com>

Move firmware header download code to a separate function to
enhance readability and reusability

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
Reviewed-by: Sathish Narasimman <Sathish.Narasimman@intel.com>
Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
---

Changes in v2:
  - Remove unwanted blank line, add empty line before goto label
Changes in v1:
  - Move firmware header download code to new function


 drivers/bluetooth/btintel.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index dea96c585ecb..ffc888c4e9e3 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -646,12 +646,10 @@ int btintel_read_boot_params(struct hci_dev *hdev,
 }
 EXPORT_SYMBOL_GPL(btintel_read_boot_params);
 
-int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw,
-			      u32 *boot_param)
+static int btintel_sfi_rsa_header_secure_send(struct hci_dev *hdev,
+					      const struct firmware *fw)
 {
 	int err;
-	const u8 *fw_ptr;
-	u32 frag_len;
 
 	/* Start the firmware download transaction with the Init fragment
 	 * represented by the 128 bytes of CSS header.
@@ -680,6 +678,21 @@ int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw,
 		goto done;
 	}
 
+done:
+	return err;
+}
+
+int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw,
+			      u32 *boot_param)
+{
+	int err;
+	const u8 *fw_ptr;
+	u32 frag_len;
+
+	err = btintel_sfi_rsa_header_secure_send(hdev, fw);
+	if (err)
+		goto done;
+
 	fw_ptr = fw->data + 644;
 	frag_len = 0;
 
-- 
2.17.1


  reply	other threads:[~2020-07-03  7:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03  7:12 [PATCH v2 1/5] Bluetooth: btintel: Make controller version read generic Kiran K
2020-07-03  7:12 ` Kiran K [this message]
2020-07-03  7:12 ` [PATCH v2 3/5] Bluetooth: btintel: Refactor firmware payload download code Kiran K
2020-07-13 19:16   ` Marcel Holtmann
2020-07-03  7:12 ` [PATCH v2 4/5] Bluetooth: btintel: Define tlv structure for new generation Controllers Kiran K
2020-07-13 19:18   ` Marcel Holtmann
2020-07-03  7:12 ` [PATCH v2 5/5] Bluetooth: btintel: Parse controller information present in TLV format Kiran K
2020-07-13 19:26   ` Marcel Holtmann
2020-07-13 19:14 ` [PATCH v2 1/5] Bluetooth: btintel: Make controller version read generic Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200703071212.17046-2-kiran.k@intel.com \
    --to=kiran.k@intel.com \
    --cc=amit.k.bag@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=kiraank@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=raghuram.hegde@intel.com \
    --cc=ravishankar.srivatsa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).