[PATCH] Bluetooth: btrtl: fix rtl_dump.fw_version for firmware v2

Jiajia Liu posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
drivers/bluetooth/btrtl.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] Bluetooth: btrtl: fix rtl_dump.fw_version for firmware v2
Posted by Jiajia Liu 1 month, 3 weeks ago
rtl_dump.fw_version is not set for firmware v2. Since
rtl_epatch_header_v2.fw_version seems to be different with the
release version, set it to the fw version read after downloading
firmware.

Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
---
 drivers/bluetooth/btrtl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 6abd962502e3..6ad3ba7901e9 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -822,6 +822,7 @@ static int rtl_download_firmware(struct hci_dev *hdev,
 	int j = 0;
 	struct sk_buff *skb;
 	struct hci_rp_read_local_version *rp;
+	struct btrealtek_data *coredump_info = hci_get_priv(hdev);
 
 	dl_cmd = kmalloc(sizeof(*dl_cmd), GFP_KERNEL);
 	if (!dl_cmd)
@@ -873,6 +874,9 @@ static int rtl_download_firmware(struct hci_dev *hdev,
 	rp = (struct hci_rp_read_local_version *)skb->data;
 	rtl_dev_info(hdev, "fw version 0x%04x%04x",
 		     __le16_to_cpu(rp->hci_rev), __le16_to_cpu(rp->lmp_subver));
+	if (coredump_info->rtl_dump.fw_version == 0)
+		coredump_info->rtl_dump.fw_version =
+			__le16_to_cpu(rp->hci_rev) << 16 | __le16_to_cpu(rp->lmp_subver);
 	kfree_skb(skb);
 
 out:
-- 
2.50.1
Re: [PATCH] Bluetooth: btrtl: fix rtl_dump.fw_version for firmware v2
Posted by Paul Menzel 1 month, 3 weeks ago
[Cc: +Alex, +Hilda]

Dear Jiajia,


Thank you for the patch.

Am 14.08.25 um 04:55 schrieb Jiajia Liu:
> rtl_dump.fw_version is not set for firmware v2. Since
> rtl_epatch_header_v2.fw_version seems to be different with the
> release version, set it to the fw version read after downloading
> firmware.

What is the released version, and what value does it have?

Please add, how your patch can be tested.

> Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
> ---
>   drivers/bluetooth/btrtl.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 6abd962502e3..6ad3ba7901e9 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -822,6 +822,7 @@ static int rtl_download_firmware(struct hci_dev *hdev,
>   	int j = 0;
>   	struct sk_buff *skb;
>   	struct hci_rp_read_local_version *rp;
> +	struct btrealtek_data *coredump_info = hci_get_priv(hdev);
>   
>   	dl_cmd = kmalloc(sizeof(*dl_cmd), GFP_KERNEL);
>   	if (!dl_cmd)
> @@ -873,6 +874,9 @@ static int rtl_download_firmware(struct hci_dev *hdev,
>   	rp = (struct hci_rp_read_local_version *)skb->data;
>   	rtl_dev_info(hdev, "fw version 0x%04x%04x",
>   		     __le16_to_cpu(rp->hci_rev), __le16_to_cpu(rp->lmp_subver));
> +	if (coredump_info->rtl_dump.fw_version == 0)
> +		coredump_info->rtl_dump.fw_version =
> +			__le16_to_cpu(rp->hci_rev) << 16 | __le16_to_cpu(rp->lmp_subver);
>   	kfree_skb(skb);
>   
>   out:


Kind regards,

Paul