Message ID | 20200702120315.26768-3-kiran.k@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Refactor firmware download | expand |
Hi Kiran, > 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> > --- > 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..1c820c187421 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. > @@ -679,6 +677,21 @@ int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw, > bt_dev_err(hdev, "Failed to send firmware signature (%d)", err); > goto done; > } Here should be an extra empty line before the label. > +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; > + Scrap the extra empty line here. > > fw_ptr = fw->data + 644; > frag_len = 0; Regards Marcel
Hi Marcel, > -----Original Message----- > From: linux-bluetooth-owner@vger.kernel.org <linux-bluetooth- > owner@vger.kernel.org> On Behalf Of Marcel Holtmann > Sent: Thursday, July 2, 2020 6:56 PM > To: K, Kiran <kiran.k@intel.com> > Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>; Srivatsa, Ravishankar > <ravishankar.srivatsa@intel.com>; Tumkur Narayan, Chethan > <chethan.tumkur.narayan@intel.com>; kiraank@gmail.com; Bag, Amit K > <amit.k.bag@intel.com>; Raghuram Hegde <raghuram.hegde@intel.com> > Subject: Re: [PATCH 2/5] Bluetooth: btintel: Refactor firmware header > download sequence > > Hi Kiran, > > > 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> > > --- > > 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..1c820c187421 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. > > @@ -679,6 +677,21 @@ int btintel_download_firmware(struct hci_dev > *hdev, const struct firmware *fw, > > bt_dev_err(hdev, "Failed to send firmware signature (%d)", > err); > > goto done; > > } > > Here should be an extra empty line before the label. Ack. I will fix it in v2. > > > +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; > > + > > Scrap the extra empty line here. Ack. > > > > > fw_ptr = fw->data + 644; > > frag_len = 0; > > Regards > > Marcel Thanks, Kiran
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index dea96c585ecb..1c820c187421 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. @@ -679,6 +677,21 @@ int btintel_download_firmware(struct hci_dev *hdev, const struct firmware *fw, bt_dev_err(hdev, "Failed to send firmware signature (%d)", err); 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;