* [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 15:30 ` Dmitry Baryshkov
2026-06-22 18:35 ` Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs bluez.test.bot
2026-06-22 14:52 ` [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
` (11 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Initialize @priv_size at declaration to reduce a redundant assignment.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7f14ce96319b..5209e2418493 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4082,7 +4082,7 @@ static int btusb_probe(struct usb_interface *intf,
struct btusb_data *data;
struct hci_dev *hdev;
unsigned ifnum_base;
- int err, priv_size;
+ int err, priv_size = 0;
BT_DBG("intf %p id %p", intf, id);
@@ -4152,8 +4152,6 @@ static int btusb_probe(struct usb_interface *intf,
init_usb_anchor(&data->ctrl_anchor);
spin_lock_init(&data->rxlock);
- priv_size = 0;
-
data->recv_event = hci_recv_frame;
data->recv_bulk = btusb_recv_bulk;
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe()
2026-06-22 14:52 ` [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe() Zijun Hu
@ 2026-06-22 15:30 ` Dmitry Baryshkov
2026-06-23 8:50 ` Bartosz Golaszewski
2026-06-23 9:33 ` Zijun Hu
2026-06-22 18:35 ` Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs bluez.test.bot
1 sibling, 2 replies; 32+ messages in thread
From: Dmitry Baryshkov @ 2026-06-22 15:30 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm
On Mon, Jun 22, 2026 at 07:52:14AM -0700, Zijun Hu wrote:
> Initialize @priv_size at declaration to reduce a redundant assignment.
This is obvious from the commit. Please tell us, why?
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btusb.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 7f14ce96319b..5209e2418493 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -4082,7 +4082,7 @@ static int btusb_probe(struct usb_interface *intf,
> struct btusb_data *data;
> struct hci_dev *hdev;
> unsigned ifnum_base;
> - int err, priv_size;
> + int err, priv_size = 0;
>
> BT_DBG("intf %p id %p", intf, id);
>
> @@ -4152,8 +4152,6 @@ static int btusb_probe(struct usb_interface *intf,
> init_usb_anchor(&data->ctrl_anchor);
> spin_lock_init(&data->rxlock);
>
> - priv_size = 0;
> -
> data->recv_event = hci_recv_frame;
> data->recv_bulk = btusb_recv_bulk;
>
>
> --
> 2.34.1
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe()
2026-06-22 15:30 ` Dmitry Baryshkov
@ 2026-06-23 8:50 ` Bartosz Golaszewski
2026-06-23 9:33 ` Zijun Hu
1 sibling, 0 replies; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 8:50 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm, Zijun Hu
On Mon, 22 Jun 2026 17:30:25 +0200, Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> said:
> On Mon, Jun 22, 2026 at 07:52:14AM -0700, Zijun Hu wrote:
>> Initialize @priv_size at declaration to reduce a redundant assignment.
>
> This is obvious from the commit. Please tell us, why?
>
I think this is what "to reduce a redundant assignment" says.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe()
2026-06-22 15:30 ` Dmitry Baryshkov
2026-06-23 8:50 ` Bartosz Golaszewski
@ 2026-06-23 9:33 ` Zijun Hu
1 sibling, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 9:33 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm
On 6/22/2026 11:30 PM, Dmitry Baryshkov wrote:
> On Mon, Jun 22, 2026 at 07:52:14AM -0700, Zijun Hu wrote:
>> Initialize @priv_size at declaration to reduce a redundant assignment.
> This is obvious from the commit. Please tell us, why?
It is simpler: one statement completes both declaration and assignment.
More flexible: initializing at declaration makes the variable immediately
usable from that point, so any new priv_size += can be freely inserted
without caring about where the separate priv_size = 0 sits.
Will improve the commit message in v2.
^ permalink raw reply [flat|nested] 32+ messages in thread
* RE: Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs
2026-06-22 14:52 ` [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe() Zijun Hu
2026-06-22 15:30 ` Dmitry Baryshkov
@ 2026-06-22 18:35 ` bluez.test.bot
1 sibling, 0 replies; 32+ messages in thread
From: bluez.test.bot @ 2026-06-22 18:35 UTC (permalink / raw)
To: linux-bluetooth, zijun.hu
[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1114806
---Test result---
Test Summary:
CheckPatch FAIL 14.74 seconds
VerifyFixes PASS 0.31 seconds
VerifySignedoff PASS 0.30 seconds
GitLint FAIL 9.09 seconds
SubjectPrefix PASS 3.49 seconds
BuildKernel PASS 25.01 seconds
CheckAllWarning PASS 27.84 seconds
CheckSparse PASS 29.36 seconds
BuildKernel32 PASS 24.64 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 522.56 seconds
TestRunner_l2cap-tester PASS 57.21 seconds
TestRunner_iso-tester PASS 77.02 seconds
TestRunner_bnep-tester PASS 18.82 seconds
TestRunner_mgmt-tester FAIL 205.87 seconds
TestRunner_rfcomm-tester PASS 25.34 seconds
TestRunner_sco-tester PASS 34.70 seconds
TestRunner_ioctl-tester PASS 25.44 seconds
TestRunner_mesh-tester FAIL 29.97 seconds
TestRunner_smp-tester PASS 22.99 seconds
TestRunner_userchan-tester PASS 20.16 seconds
TestRunner_6lowpan-tester PASS 22.20 seconds
IncrementalBuild PASS 74.92 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#322:
new file mode 100644
total: 0 errors, 1 warnings, 276 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/patch/14639541.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME
1: T1 Title exceeds max length (88>80): "[04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME"
[10/13] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()
1: T1 Title exceeds max length (83>80): "[10/13] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()"
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.234 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.978 seconds
Mesh - Send cancel - 2 Timed out 1.988 seconds
https://github.com/bluez/bluetooth-next/pull/337
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
2026-06-22 14:52 ` [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 15:30 ` Dmitry Baryshkov
2026-06-23 8:51 ` Bartosz Golaszewski
2026-06-22 14:52 ` [PATCH 03/13] Bluetooth: btusb: Record matched usb_device_id into btusb_data Zijun Hu
` (10 subsequent siblings)
12 siblings, 2 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
The driver_info field is a bitmask, so use & instead of == to test the
BTUSB_IGNORE bitflag against it, which is consistent with how the other
flags are tested.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 5209e2418493..fa6a223d472d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4101,7 +4101,7 @@ static int btusb_probe(struct usb_interface *intf,
id = match;
}
- if (id->driver_info == BTUSB_IGNORE)
+ if (id->driver_info & BTUSB_IGNORE)
return -ENODEV;
if (id->driver_info & BTUSB_ATH3012) {
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
2026-06-22 14:52 ` [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
@ 2026-06-22 15:30 ` Dmitry Baryshkov
2026-06-23 8:51 ` Bartosz Golaszewski
1 sibling, 0 replies; 32+ messages in thread
From: Dmitry Baryshkov @ 2026-06-22 15:30 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm
On Mon, Jun 22, 2026 at 07:52:15AM -0700, Zijun Hu wrote:
> The driver_info field is a bitmask, so use & instead of == to test the
> BTUSB_IGNORE bitflag against it, which is consistent with how the other
> flags are tested.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btusb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
2026-06-22 14:52 ` [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
2026-06-22 15:30 ` Dmitry Baryshkov
@ 2026-06-23 8:51 ` Bartosz Golaszewski
1 sibling, 0 replies; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 8:51 UTC (permalink / raw)
To: Zijun Hu
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Bartosz Golaszewski, Ben Young Tae Kim,
Balakrishna Godavarthi, Matthias Kaehlcke
On Mon, 22 Jun 2026 16:52:15 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> The driver_info field is a bitmask, so use & instead of == to test the
> BTUSB_IGNORE bitflag against it, which is consistent with how the other
> flags are tested.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 03/13] Bluetooth: btusb: Record matched usb_device_id into btusb_data
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
2026-06-22 14:52 ` [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe() Zijun Hu
2026-06-22 14:52 ` [PATCH 02/13] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 14:52 ` [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME Zijun Hu
` (9 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Add @match_id to btusb_data to record the matched usb_device_id
which will be used later.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index fa6a223d472d..6a90f012b226 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1012,6 +1012,7 @@ struct btusb_data {
bool usb_alt6_packet_flow;
int isoc_altsetting;
int suspend_count;
+ const struct usb_device_id *match_id;
int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
int (*recv_acl)(struct hci_dev *hdev, struct sk_buff *skb);
@@ -4119,6 +4120,7 @@ static int btusb_probe(struct usb_interface *intf,
if (!data)
return -ENOMEM;
+ data->match_id = id;
err = usb_find_common_endpoints(intf->cur_altsetting, &data->bulk_rx_ep,
&data->bulk_tx_ep, &data->intr_ep, NULL);
if (err)
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (2 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 03/13] Bluetooth: btusb: Record matched usb_device_id into btusb_data Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 15:31 ` Dmitry Baryshkov
2026-06-22 14:52 ` [PATCH 05/13] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data Zijun Hu
` (8 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Devcoredump is disabled on ATH3012 or QCA_ROME, but btusb_setup_qca()
used by both unconditionally populates those two devcoredump fields.
Fix by populating devcoredump fields only for BTUSB_QCA_WCN6855 devices,
which are the only ones that enable devcoredump.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 6a90f012b226..184a87d1234c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3708,8 +3708,10 @@ static int btusb_setup_qca(struct hci_dev *hdev)
if (err < 0)
return err;
- btdata->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
- btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
+ if (btdata->match_id->driver_info & BTUSB_QCA_WCN6855) {
+ btdata->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
+ btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
+ }
if (!(status & QCA_SYSCFG_UPDATED)) {
err = btusb_setup_qca_load_nvm(hdev, &ver, info);
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME
2026-06-22 14:52 ` [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME Zijun Hu
@ 2026-06-22 15:31 ` Dmitry Baryshkov
2026-06-23 9:50 ` Zijun Hu
0 siblings, 1 reply; 32+ messages in thread
From: Dmitry Baryshkov @ 2026-06-22 15:31 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm
On Mon, Jun 22, 2026 at 07:52:17AM -0700, Zijun Hu wrote:
> Devcoredump is disabled on ATH3012 or QCA_ROME, but btusb_setup_qca()
> used by both unconditionally populates those two devcoredump fields.
>
> Fix by populating devcoredump fields only for BTUSB_QCA_WCN6855 devices,
> which are the only ones that enable devcoredump.
Why? Wouldn't it be better to enable devcoredump for all platforms?
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btusb.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 6a90f012b226..184a87d1234c 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3708,8 +3708,10 @@ static int btusb_setup_qca(struct hci_dev *hdev)
> if (err < 0)
> return err;
>
> - btdata->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
> - btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
> + if (btdata->match_id->driver_info & BTUSB_QCA_WCN6855) {
> + btdata->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
> + btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
> + }
>
> if (!(status & QCA_SYSCFG_UPDATED)) {
> err = btusb_setup_qca_load_nvm(hdev, &ver, info);
>
> --
> 2.34.1
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME
2026-06-22 15:31 ` Dmitry Baryshkov
@ 2026-06-23 9:50 ` Zijun Hu
0 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 9:50 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Zijun Hu, linux-bluetooth, linux-kernel,
Luiz Augusto von Dentz, linux-arm-msm
On 6/22/2026 11:31 PM, Dmitry Baryshkov wrote:
>> Devcoredump is disabled on ATH3012 or QCA_ROME, but btusb_setup_qca()
>> used by both unconditionally populates those two devcoredump fields.
>>
>> Fix by populating devcoredump fields only for BTUSB_QCA_WCN6855 devices,
>> which are the only ones that enable devcoredump.
> Why? Wouldn't it be better to enable devcoredump for all platforms?
BTUSB_QCA_WCN6855 marks the first generation of QCA BT SoCs for which
devcoredump is enabled; all later generations are enabled too. ATH3012
and QCA_ROME are much older chips that predate devcoredump in the
Bluetooth core driver — there is no requirement to enable it for them
and it is not clear whether they even support it.
Will optimize the commit message in v2.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 05/13] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (3 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 04/13] Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 14:52 ` [PATCH 06/13] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855() Zijun Hu
` (7 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
'struct btusb_data' ideally should not include vendor specific
fields, but it currently includes the QCA devcoredump member
'struct qca_dump_info qca_dump'.
Fix by moving it into hci_dev private area accessed by hci_get_priv().
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 56 ++++++++++++++++++++++++++++-------------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 184a87d1234c..6f965c313dff 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -939,6 +939,10 @@ struct qca_dump_info {
u16 ram_dump_seqno;
};
+struct btqca_data {
+ struct qca_dump_info qca_dump;
+};
+
#define BTUSB_MAX_ISOC_FRAMES 10
#define BTUSB_INTR_RUNNING 0
@@ -1025,8 +1029,6 @@ struct btusb_data {
int (*disconnect)(struct hci_dev *hdev);
int oob_wake_irq; /* irq for out-of-band wake-on-bt */
-
- struct qca_dump_info qca_dump;
};
static void btusb_reset(struct hci_dev *hdev)
@@ -3116,14 +3118,15 @@ struct qca_dump_hdr {
static void btusb_dump_hdr_qca(struct hci_dev *hdev, struct sk_buff *skb)
{
char buf[128];
- struct btusb_data *btdata = hci_get_drvdata(hdev);
+ struct btqca_data *btqca_data = hci_get_priv(hdev);
+ struct qca_dump_info *qca_dump_ptr = &btqca_data->qca_dump;
snprintf(buf, sizeof(buf), "Controller Name: 0x%x\n",
- btdata->qca_dump.controller_id);
+ qca_dump_ptr->controller_id);
skb_put_data(skb, buf, strlen(buf));
snprintf(buf, sizeof(buf), "Firmware Version: 0x%x\n",
- btdata->qca_dump.fw_version);
+ qca_dump_ptr->fw_version);
skb_put_data(skb, buf, strlen(buf));
snprintf(buf, sizeof(buf), "Driver: %s\nVendor: qca\n",
@@ -3131,7 +3134,7 @@ static void btusb_dump_hdr_qca(struct hci_dev *hdev, struct sk_buff *skb)
skb_put_data(skb, buf, strlen(buf));
snprintf(buf, sizeof(buf), "VID: 0x%x\nPID:0x%x\n",
- btdata->qca_dump.id_vendor, btdata->qca_dump.id_product);
+ qca_dump_ptr->id_vendor, qca_dump_ptr->id_product);
skb_put_data(skb, buf, strlen(buf));
snprintf(buf, sizeof(buf), "Lmp Subversion: 0x%x\n",
@@ -3160,6 +3163,8 @@ static int handle_dump_pkt_qca(struct hci_dev *hdev, struct sk_buff *skb)
struct qca_dump_hdr *dump_hdr;
struct btusb_data *btdata = hci_get_drvdata(hdev);
+ struct btqca_data *btqca_data = hci_get_priv(hdev);
+ struct qca_dump_info *qca_dump_ptr = &btqca_data->qca_dump;
struct usb_device *udev = btdata->udev;
pkt_type = hci_skb_pkt_type(skb);
@@ -3187,8 +3192,8 @@ static int handle_dump_pkt_qca(struct hci_dev *hdev, struct sk_buff *skb)
goto out;
}
- btdata->qca_dump.ram_dump_size = dump_size;
- btdata->qca_dump.ram_dump_seqno = 0;
+ qca_dump_ptr->ram_dump_size = dump_size;
+ qca_dump_ptr->ram_dump_seqno = 0;
skb_pull(skb, offsetof(struct qca_dump_hdr, data0));
@@ -3200,29 +3205,29 @@ static int handle_dump_pkt_qca(struct hci_dev *hdev, struct sk_buff *skb)
skb_pull(skb, offsetof(struct qca_dump_hdr, data));
}
- if (!btdata->qca_dump.ram_dump_size) {
+ if (!qca_dump_ptr->ram_dump_size) {
ret = -EINVAL;
bt_dev_err(hdev, "memdump is not active");
goto out;
}
- if ((seqno > btdata->qca_dump.ram_dump_seqno + 1) && (seqno != QCA_LAST_SEQUENCE_NUM)) {
- dump_size = QCA_MEMDUMP_PKT_SIZE * (seqno - btdata->qca_dump.ram_dump_seqno - 1);
+ if ((seqno > qca_dump_ptr->ram_dump_seqno + 1) && seqno != QCA_LAST_SEQUENCE_NUM) {
+ dump_size = QCA_MEMDUMP_PKT_SIZE * (seqno - qca_dump_ptr->ram_dump_seqno - 1);
hci_devcd_append_pattern(hdev, 0x0, dump_size);
bt_dev_err(hdev,
"expected memdump seqno(%u) is not received(%u)\n",
- btdata->qca_dump.ram_dump_seqno, seqno);
- btdata->qca_dump.ram_dump_seqno = seqno;
+ qca_dump_ptr->ram_dump_seqno, seqno);
+ qca_dump_ptr->ram_dump_seqno = seqno;
kfree_skb(skb);
return ret;
}
hci_devcd_append(hdev, skb);
- btdata->qca_dump.ram_dump_seqno++;
+ qca_dump_ptr->ram_dump_seqno++;
if (seqno == QCA_LAST_SEQUENCE_NUM) {
bt_dev_info(hdev,
"memdump done: pkts(%u), total(%u)\n",
- btdata->qca_dump.ram_dump_seqno, btdata->qca_dump.ram_dump_size);
+ qca_dump_ptr->ram_dump_seqno, qca_dump_ptr->ram_dump_size);
hci_devcd_complete(hdev);
goto out;
@@ -3230,10 +3235,10 @@ static int handle_dump_pkt_qca(struct hci_dev *hdev, struct sk_buff *skb)
return ret;
out:
- if (btdata->qca_dump.ram_dump_size)
+ if (qca_dump_ptr->ram_dump_size)
usb_enable_autosuspend(udev);
- btdata->qca_dump.ram_dump_size = 0;
- btdata->qca_dump.ram_dump_seqno = 0;
+ qca_dump_ptr->ram_dump_size = 0;
+ qca_dump_ptr->ram_dump_seqno = 0;
clear_bit(BTUSB_HW_SSR_ACTIVE, &btdata->flags);
if (ret < 0)
@@ -3709,8 +3714,10 @@ static int btusb_setup_qca(struct hci_dev *hdev)
return err;
if (btdata->match_id->driver_info & BTUSB_QCA_WCN6855) {
- btdata->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
- btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
+ struct btqca_data *btqca_data = hci_get_priv(hdev);
+
+ btqca_data->qca_dump.fw_version = le32_to_cpu(ver.patch_version);
+ btqca_data->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
}
if (!(status & QCA_SYSCFG_UPDATED)) {
@@ -4174,6 +4181,9 @@ static int btusb_probe(struct usb_interface *intf,
} else if (id->driver_info & BTUSB_MEDIATEK) {
/* Allocate extra space for Mediatek device */
priv_size += sizeof(struct btmtk_data);
+ } else if (id->driver_info & BTUSB_QCA_WCN6855) {
+ /* Allocate extra space for QCA WCN6855 device */
+ priv_size += sizeof(struct btqca_data);
}
data->recv_acl = hci_recv_frame;
@@ -4316,8 +4326,10 @@ static int btusb_probe(struct usb_interface *intf,
}
if (id->driver_info & BTUSB_QCA_WCN6855) {
- data->qca_dump.id_vendor = id->idVendor;
- data->qca_dump.id_product = id->idProduct;
+ struct btqca_data *btqca_data = hci_get_priv(hdev);
+
+ btqca_data->qca_dump.id_vendor = id->idVendor;
+ btqca_data->qca_dump.id_product = id->idProduct;
data->recv_event = btusb_recv_evt_qca;
data->recv_acl = btusb_recv_acl_qca;
hci_devcd_register(hdev, btusb_coredump_qca, btusb_dump_hdr_qca, NULL);
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 06/13] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (4 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 05/13] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 14:52 ` [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
` (6 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
For VSC 0xfc14 to set BD_ADDR, the endianness of the BDA parameter is
opposite to other HCI commands like HCI_Create_Connection, but
btusb_set_bdaddr_wcn6855() sends the address without swapping byte
order, resulting in a wrong BD_ADDR being set.
Fix by swapping the input address before issuing the command.
Fixes: b40f58b97386 ("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 6f965c313dff..e78277e24cd8 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3075,14 +3075,15 @@ static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev,
static int btusb_set_bdaddr_wcn6855(struct hci_dev *hdev,
const bdaddr_t *bdaddr)
{
+ bdaddr_t bdaddr_swapped;
struct sk_buff *skb;
- u8 buf[6];
long ret;
- memcpy(buf, bdaddr, sizeof(bdaddr_t));
+ baswap(&bdaddr_swapped, bdaddr);
- skb = __hci_cmd_sync_ev(hdev, 0xfc14, sizeof(buf), buf,
- HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);
+ skb = __hci_cmd_sync_ev(hdev, 0xfc14, sizeof(bdaddr_swapped),
+ &bdaddr_swapped, HCI_EV_CMD_COMPLETE,
+ HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
ret = PTR_ERR(skb);
bt_dev_err(hdev, "Change address command failed (%ld)", ret);
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (5 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 06/13] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-23 8:56 ` Bartosz Golaszewski
2026-06-22 14:52 ` [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync() Zijun Hu
` (5 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Return err directly instead of using an if/return pattern.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
net/bluetooth/hci_sync.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 3be8c3581c6c..fce9f9526cb5 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3678,10 +3678,8 @@ int hci_reset_sync(struct hci_dev *hdev)
err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
HCI_CMD_TIMEOUT);
- if (err)
- return err;
- return 0;
+ return err;
}
static int hci_init0_sync(struct hci_dev *hdev)
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync()
2026-06-22 14:52 ` [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
@ 2026-06-23 8:56 ` Bartosz Golaszewski
0 siblings, 0 replies; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 8:56 UTC (permalink / raw)
To: Zijun Hu
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Bartosz Golaszewski, Ben Young Tae Kim,
Balakrishna Godavarthi, Matthias Kaehlcke
On Mon, 22 Jun 2026 16:52:20 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> Return err directly instead of using an if/return pattern.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> net/bluetooth/hci_sync.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index 3be8c3581c6c..fce9f9526cb5 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -3678,10 +3678,8 @@ int hci_reset_sync(struct hci_dev *hdev)
>
> err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
> HCI_CMD_TIMEOUT);
> - if (err)
> - return err;
>
> - return 0;
> + return err;
> }
>
> static int hci_init0_sync(struct hci_dev *hdev)
>
> --
> 2.34.1
>
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (6 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 15:35 ` Luiz Augusto von Dentz
2026-06-22 14:52 ` [PATCH 09/13] Bluetooth: hci_sync: Add __hci_reset_sync() for device driver Zijun Hu
` (4 subsequent siblings)
12 siblings, 1 reply; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
hci_reset_sync() may return positive HCI status byte as-is, but callers
in the chain hci_reset_sync() -> hci_init0_sync() -> hci_unconf_init_sync()
check errors with < 0, so a positive status is silently ignored.
Fix by converting positive HCI status to a negative errno using
bt_to_errno().
Fixes: d0b137062b2d ("Bluetooth: hci_sync: Rework init stages")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
net/bluetooth/hci_sync.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index fce9f9526cb5..601d44ef975f 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3678,8 +3678,10 @@ int hci_reset_sync(struct hci_dev *hdev)
err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
HCI_CMD_TIMEOUT);
+ if (err < 0)
+ return err;
- return err;
+ return -bt_to_errno(err);
}
static int hci_init0_sync(struct hci_dev *hdev)
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync()
2026-06-22 14:52 ` [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync() Zijun Hu
@ 2026-06-22 15:35 ` Luiz Augusto von Dentz
2026-06-23 10:48 ` Zijun Hu
0 siblings, 1 reply; 32+ messages in thread
From: Luiz Augusto von Dentz @ 2026-06-22 15:35 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Rocky Liao, Bartosz Golaszewski,
Ben Young Tae Kim, Balakrishna Godavarthi, Matthias Kaehlcke,
Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm
Hi Zijun,
On Mon, Jun 22, 2026 at 10:52 AM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote:
>
> hci_reset_sync() may return positive HCI status byte as-is, but callers
> in the chain hci_reset_sync() -> hci_init0_sync() -> hci_unconf_init_sync()
> check errors with < 0, so a positive status is silently ignored.
>
> Fix by converting positive HCI status to a negative errno using
> bt_to_errno().
>
> Fixes: d0b137062b2d ("Bluetooth: hci_sync: Rework init stages")
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> net/bluetooth/hci_sync.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index fce9f9526cb5..601d44ef975f 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -3678,8 +3678,10 @@ int hci_reset_sync(struct hci_dev *hdev)
>
> err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
> HCI_CMD_TIMEOUT);
> + if (err < 0)
> + return err;
>
> - return err;
> + return -bt_to_errno(err);
> }
There seem to be 2 consecutive changes to hci_reset_sync that conflict
with each other, also the expectation should be that positive errors
are HCI errors and negative errors are stack generated ones, so the
callers should really check `err` and not `err < 0`.
> static int hci_init0_sync(struct hci_dev *hdev)
>
> --
> 2.34.1
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync()
2026-06-22 15:35 ` Luiz Augusto von Dentz
@ 2026-06-23 10:48 ` Zijun Hu
0 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 10:48 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: Marcel Holtmann, Rocky Liao, Bartosz Golaszewski,
Ben Young Tae Kim, Balakrishna Godavarthi, Matthias Kaehlcke,
Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm
On 6/22/2026 11:35 PM, Luiz Augusto von Dentz wrote:
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index fce9f9526cb5..601d44ef975f 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -3678,8 +3678,10 @@ int hci_reset_sync(struct hci_dev *hdev)
>>
>> err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
>> HCI_CMD_TIMEOUT);
>> + if (err < 0)
>> + return err;
>>
>> - return err;
>> + return -bt_to_errno(err);
>> }
> There seem to be 2 consecutive changes to hci_reset_sync that conflict
> with each other, also the expectation should be that positive errors
> are HCI errors and negative errors are stack generated ones, so the
> callers should really check `err` and not `err < 0`.
Hi Luiz,
Checking the full call chains:
- hci_reset_sync() → hci_init0_sync() [if (err)] → hci_unconf_init_sync() [if (err < 0)]
- hci_reset_sync() → hci_init1_sync() [if (err)] → hci_init_sync() [if (err < 0)]
A positive HCI status from hci_reset_sync() propagates through
hci_init0_sync()/hci_init1_sync() but is then silently ignored by
hci_unconf_init_sync()/hci_init_sync() due to their if (err < 0)
checks.
Will not change hci_reset_sync(). Any suggestion on how to fix it?
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 09/13] Bluetooth: hci_sync: Add __hci_reset_sync() for device driver
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (7 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 08/13] Bluetooth: hci_sync: Fix return value of hci_reset_sync() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 14:52 ` [PATCH 10/13] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync() Zijun Hu
` (3 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Many vendor drivers have requirements to send a raw HCI reset
synchronously with HCI_INIT_TIMEOUT.
Add a dedicated API for them to use.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
include/net/bluetooth/hci_sync.h | 1 +
net/bluetooth/hci_sync.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/net/bluetooth/hci_sync.h b/include/net/bluetooth/hci_sync.h
index 73e494b2591d..7005fc9f257a 100644
--- a/include/net/bluetooth/hci_sync.h
+++ b/include/net/bluetooth/hci_sync.h
@@ -59,6 +59,7 @@ int __hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen,
int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen,
const void *param, u8 event, u32 timeout,
struct sock *sk);
+int __hci_reset_sync(struct hci_dev *hdev);
int hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen,
const void *param, u32 timeout);
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 601d44ef975f..40c9725585cb 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3684,6 +3684,20 @@ int hci_reset_sync(struct hci_dev *hdev)
return -bt_to_errno(err);
}
+/* Send a raw HCI reset for use by vendor drivers */
+int __hci_reset_sync(struct hci_dev *hdev)
+{
+ int err;
+
+ err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
+ HCI_INIT_TIMEOUT);
+ if (err < 0)
+ return err;
+
+ return -bt_to_errno(err);
+}
+EXPORT_SYMBOL(__hci_reset_sync);
+
static int hci_init0_sync(struct hci_dev *hdev)
{
int err;
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 10/13] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (8 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 09/13] Bluetooth: hci_sync: Add __hci_reset_sync() for device driver Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-22 14:52 ` [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h Zijun Hu
` (2 subsequent siblings)
12 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Use the new __hci_reset_sync() API instead of open-coding the HCI reset.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e78277e24cd8..21e125db1b1f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3900,16 +3900,13 @@ static bool btusb_wakeup(struct hci_dev *hdev)
static int btusb_shutdown_qca(struct hci_dev *hdev)
{
- struct sk_buff *skb;
+ int err;
- skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
- if (IS_ERR(skb)) {
+ err = __hci_reset_sync(hdev);
+ if (err)
bt_dev_err(hdev, "HCI reset during shutdown failed");
- return PTR_ERR(skb);
- }
- kfree_skb(skb);
- return 0;
+ return err;
}
static ssize_t force_poll_sync_read(struct file *file, char __user *user_buf,
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (9 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 10/13] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-23 9:02 ` Bartosz Golaszewski
2026-06-22 14:52 ` [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset() Zijun Hu
2026-06-22 14:52 ` [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type Zijun Hu
12 siblings, 1 reply; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
btusb.c is growing large as vendor-specific code accumulates. Ideally,
btusb.c contains only the default implementation while vendor-specific
code lives in separate files for easier maintenance.
The newly added btusb.h also reduces unnecessary data copies in hooks
like btusb_mtk_setup().
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btusb.c | 119 +--------------------------------------
drivers/bluetooth/btusb.h | 139 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 140 insertions(+), 118 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 21e125db1b1f..0d0bd7b559c6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -23,6 +23,7 @@
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci_drv.h>
+#include "btusb.h"
#include "btintel.h"
#include "btbcm.h"
#include "btrtl.h"
@@ -38,36 +39,6 @@ static bool reset = true;
static struct usb_driver btusb_driver;
-#define BTUSB_IGNORE BIT(0)
-#define BTUSB_DIGIANSWER BIT(1)
-#define BTUSB_CSR BIT(2)
-#define BTUSB_SNIFFER BIT(3)
-#define BTUSB_BCM92035 BIT(4)
-#define BTUSB_BROKEN_ISOC BIT(5)
-#define BTUSB_WRONG_SCO_MTU BIT(6)
-#define BTUSB_ATH3012 BIT(7)
-#define BTUSB_INTEL_COMBINED BIT(8)
-#define BTUSB_INTEL_BOOT BIT(9)
-#define BTUSB_BCM_PATCHRAM BIT(10)
-#define BTUSB_MARVELL BIT(11)
-#define BTUSB_SWAVE BIT(12)
-#define BTUSB_AMP BIT(13)
-#define BTUSB_QCA_ROME BIT(14)
-#define BTUSB_BCM_APPLE BIT(15)
-#define BTUSB_REALTEK BIT(16)
-#define BTUSB_BCM2045 BIT(17)
-#define BTUSB_IFNUM_2 BIT(18)
-#define BTUSB_CW6622 BIT(19)
-#define BTUSB_MEDIATEK BIT(20)
-#define BTUSB_WIDEBAND_SPEECH BIT(21)
-#define BTUSB_INVALID_LE_STATES BIT(22)
-#define BTUSB_QCA_WCN6855 BIT(23)
-#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED BIT(24)
-#define BTUSB_INTEL_BROKEN_INITIAL_NCMD BIT(25)
-#define BTUSB_INTEL_NO_WBS_SUPPORT BIT(26)
-#define BTUSB_ACTIONS_SEMI BIT(27)
-#define BTUSB_BARROT BIT(28)
-
static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
{ USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
@@ -943,94 +914,6 @@ struct btqca_data {
struct qca_dump_info qca_dump;
};
-#define BTUSB_MAX_ISOC_FRAMES 10
-
-#define BTUSB_INTR_RUNNING 0
-#define BTUSB_BULK_RUNNING 1
-#define BTUSB_ISOC_RUNNING 2
-#define BTUSB_SUSPENDING 3
-#define BTUSB_DID_ISO_RESUME 4
-#define BTUSB_BOOTLOADER 5
-#define BTUSB_DOWNLOADING 6
-#define BTUSB_FIRMWARE_LOADED 7
-#define BTUSB_FIRMWARE_FAILED 8
-#define BTUSB_BOOTING 9
-#define BTUSB_DIAG_RUNNING 10
-#define BTUSB_OOB_WAKE_ENABLED 11
-#define BTUSB_HW_RESET_ACTIVE 12
-#define BTUSB_TX_WAIT_VND_EVT 13
-#define BTUSB_WAKEUP_AUTOSUSPEND 14
-#define BTUSB_USE_ALT3_FOR_WBS 15
-#define BTUSB_ALT6_CONTINUOUS_TX 16
-#define BTUSB_HW_SSR_ACTIVE 17
-
-struct btusb_data {
- struct hci_dev *hdev;
- struct usb_device *udev;
- struct usb_interface *intf;
- struct usb_interface *isoc;
- struct usb_interface *diag;
- unsigned isoc_ifnum;
-
- unsigned long flags;
-
- bool poll_sync;
- int intr_interval;
- struct work_struct work;
- struct work_struct waker;
- struct delayed_work rx_work;
-
- struct sk_buff_head acl_q;
-
- struct usb_anchor deferred;
- struct usb_anchor tx_anchor;
- int tx_in_flight;
- spinlock_t txlock;
-
- struct usb_anchor intr_anchor;
- struct usb_anchor bulk_anchor;
- struct usb_anchor isoc_anchor;
- struct usb_anchor diag_anchor;
- struct usb_anchor ctrl_anchor;
- spinlock_t rxlock;
-
- struct sk_buff *evt_skb;
- struct sk_buff *acl_skb;
- struct sk_buff *sco_skb;
-
- struct usb_endpoint_descriptor *intr_ep;
- struct usb_endpoint_descriptor *bulk_tx_ep;
- struct usb_endpoint_descriptor *bulk_rx_ep;
- struct usb_endpoint_descriptor *isoc_tx_ep;
- struct usb_endpoint_descriptor *isoc_rx_ep;
- struct usb_endpoint_descriptor *diag_tx_ep;
- struct usb_endpoint_descriptor *diag_rx_ep;
-
- struct gpio_desc *reset_gpio;
-
- __u8 cmdreq_type;
- __u8 cmdreq;
-
- unsigned int sco_num;
- unsigned int air_mode;
- bool usb_alt6_packet_flow;
- int isoc_altsetting;
- int suspend_count;
- const struct usb_device_id *match_id;
-
- int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
- int (*recv_acl)(struct hci_dev *hdev, struct sk_buff *skb);
- int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
-
- int (*setup_on_usb)(struct hci_dev *hdev);
-
- int (*suspend)(struct hci_dev *hdev);
- int (*resume)(struct hci_dev *hdev);
- int (*disconnect)(struct hci_dev *hdev);
-
- int oob_wake_irq; /* irq for out-of-band wake-on-bt */
-};
-
static void btusb_reset(struct hci_dev *hdev)
{
struct btusb_data *data;
diff --git a/drivers/bluetooth/btusb.h b/drivers/bluetooth/btusb.h
new file mode 100644
index 000000000000..ad13c7d44836
--- /dev/null
+++ b/drivers/bluetooth/btusb.h
@@ -0,0 +1,139 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *
+ * Generic Bluetooth USB driver
+ *
+ * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org>
+ */
+
+#ifndef __BTUSB_H
+#define __BTUSB_H
+
+#include <linux/usb.h>
+#include <linux/skbuff.h>
+#include <linux/workqueue.h>
+#include <linux/spinlock.h>
+#include <linux/gpio/consumer.h>
+#include <net/bluetooth/hci_core.h>
+
+/* driver_info flags */
+#define BTUSB_IGNORE BIT(0)
+#define BTUSB_DIGIANSWER BIT(1)
+#define BTUSB_CSR BIT(2)
+#define BTUSB_SNIFFER BIT(3)
+#define BTUSB_BCM92035 BIT(4)
+#define BTUSB_BROKEN_ISOC BIT(5)
+#define BTUSB_WRONG_SCO_MTU BIT(6)
+#define BTUSB_ATH3012 BIT(7)
+#define BTUSB_INTEL_COMBINED BIT(8)
+#define BTUSB_INTEL_BOOT BIT(9)
+#define BTUSB_BCM_PATCHRAM BIT(10)
+#define BTUSB_MARVELL BIT(11)
+#define BTUSB_SWAVE BIT(12)
+#define BTUSB_AMP BIT(13)
+#define BTUSB_QCA_ROME BIT(14)
+#define BTUSB_BCM_APPLE BIT(15)
+#define BTUSB_REALTEK BIT(16)
+#define BTUSB_BCM2045 BIT(17)
+#define BTUSB_IFNUM_2 BIT(18)
+#define BTUSB_CW6622 BIT(19)
+#define BTUSB_MEDIATEK BIT(20)
+#define BTUSB_WIDEBAND_SPEECH BIT(21)
+#define BTUSB_INVALID_LE_STATES BIT(22)
+#define BTUSB_QCA_WCN6855 BIT(23)
+#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED BIT(24)
+#define BTUSB_INTEL_BROKEN_INITIAL_NCMD BIT(25)
+#define BTUSB_INTEL_NO_WBS_SUPPORT BIT(26)
+#define BTUSB_ACTIONS_SEMI BIT(27)
+#define BTUSB_BARROT BIT(28)
+
+#define BTUSB_MAX_ISOC_FRAMES 10
+
+/* btusb_data flags */
+#define BTUSB_INTR_RUNNING 0
+#define BTUSB_BULK_RUNNING 1
+#define BTUSB_ISOC_RUNNING 2
+#define BTUSB_SUSPENDING 3
+#define BTUSB_DID_ISO_RESUME 4
+#define BTUSB_BOOTLOADER 5
+#define BTUSB_DOWNLOADING 6
+#define BTUSB_FIRMWARE_LOADED 7
+#define BTUSB_FIRMWARE_FAILED 8
+#define BTUSB_BOOTING 9
+#define BTUSB_DIAG_RUNNING 10
+#define BTUSB_OOB_WAKE_ENABLED 11
+#define BTUSB_HW_RESET_ACTIVE 12
+#define BTUSB_TX_WAIT_VND_EVT 13
+#define BTUSB_WAKEUP_AUTOSUSPEND 14
+#define BTUSB_USE_ALT3_FOR_WBS 15
+#define BTUSB_ALT6_CONTINUOUS_TX 16
+#define BTUSB_HW_SSR_ACTIVE 17
+
+struct btusb_data {
+ struct hci_dev *hdev;
+ struct usb_device *udev;
+ struct usb_interface *intf;
+ struct usb_interface *isoc;
+ struct usb_interface *diag;
+ unsigned int isoc_ifnum;
+
+ unsigned long flags;
+
+ bool poll_sync;
+ int intr_interval;
+ struct work_struct work;
+ struct work_struct waker;
+ struct delayed_work rx_work;
+
+ struct sk_buff_head acl_q;
+
+ struct usb_anchor deferred;
+ struct usb_anchor tx_anchor;
+ int tx_in_flight;
+ spinlock_t txlock;
+
+ struct usb_anchor intr_anchor;
+ struct usb_anchor bulk_anchor;
+ struct usb_anchor isoc_anchor;
+ struct usb_anchor diag_anchor;
+ struct usb_anchor ctrl_anchor;
+ spinlock_t rxlock;
+
+ struct sk_buff *evt_skb;
+ struct sk_buff *acl_skb;
+ struct sk_buff *sco_skb;
+
+ struct usb_endpoint_descriptor *intr_ep;
+ struct usb_endpoint_descriptor *bulk_tx_ep;
+ struct usb_endpoint_descriptor *bulk_rx_ep;
+ struct usb_endpoint_descriptor *isoc_tx_ep;
+ struct usb_endpoint_descriptor *isoc_rx_ep;
+ struct usb_endpoint_descriptor *diag_tx_ep;
+ struct usb_endpoint_descriptor *diag_rx_ep;
+
+ struct gpio_desc *reset_gpio;
+
+ __u8 cmdreq_type;
+ __u8 cmdreq;
+
+ unsigned int sco_num;
+ unsigned int air_mode;
+ bool usb_alt6_packet_flow;
+ int isoc_altsetting;
+ int suspend_count;
+ const struct usb_device_id *match_id;
+
+ int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
+ int (*recv_acl)(struct hci_dev *hdev, struct sk_buff *skb);
+ int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
+
+ int (*setup_on_usb)(struct hci_dev *hdev);
+
+ int (*suspend)(struct hci_dev *hdev);
+ int (*resume)(struct hci_dev *hdev);
+ int (*disconnect)(struct hci_dev *hdev);
+
+ int oob_wake_irq; /* irq for out-of-band wake-on-bt */
+};
+
+#endif /* __BTUSB_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h
2026-06-22 14:52 ` [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h Zijun Hu
@ 2026-06-23 9:02 ` Bartosz Golaszewski
2026-06-23 10:09 ` Zijun Hu
0 siblings, 1 reply; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 9:02 UTC (permalink / raw)
To: Zijun Hu
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Bartosz Golaszewski, Ben Young Tae Kim,
Balakrishna Godavarthi, Matthias Kaehlcke
On Mon, 22 Jun 2026 16:52:24 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> btusb.c is growing large as vendor-specific code accumulates. Ideally,
> btusb.c contains only the default implementation while vendor-specific
> code lives in separate files for easier maintenance.
>
> The newly added btusb.h also reduces unnecessary data copies in hooks
> like btusb_mtk_setup().
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
I would be ok with this if you added a user of this new header in the subsequent
patches but I don't see these so I'll hold off my R-b until you can show the
need for one.
Bart
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h
2026-06-23 9:02 ` Bartosz Golaszewski
@ 2026-06-23 10:09 ` Zijun Hu
0 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 10:09 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
On 6/23/2026 5:02 PM, Bartosz Golaszewski wrote:
> On Mon, 22 Jun 2026 16:52:24 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
>> btusb.c is growing large as vendor-specific code accumulates. Ideally,
>> btusb.c contains only the default implementation while vendor-specific
>> code lives in separate files for easier maintenance.
>>
>> The newly added btusb.h also reduces unnecessary data copies in hooks
>> like btusb_mtk_setup().
>>
>> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
>> ---
> I would be ok with this if you added a user of this new header in the subsequent
> patches but I don't see these so I'll hold off my R-b until you can show the
> need for one.
Right. Will drop this patch in v2 and bring it back together with its user
when necessary.
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset()
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (10 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-23 9:03 ` Bartosz Golaszewski
2026-06-23 15:15 ` Luiz Augusto von Dentz
2026-06-22 14:52 ` [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type Zijun Hu
12 siblings, 2 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
qca_send_reset() uses __hci_cmd_sync() which returns an skb but never
reads the HCI status byte from skb->data[0], so a non-zero error status
returned by the controller is silently ignored.
Fix by replacing qca_send_reset() with __hci_reset_sync() which
properly extracts and converts the HCI status byte to a negative errno.
Fixes: 83e81961ff7e ("Bluetooth: btqca: Introduce generic QCA ROME support")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btqca.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 04ebe290bc78..875216e15603 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -190,25 +190,6 @@ static int qca_send_patch_config_cmd(struct hci_dev *hdev)
return err;
}
-static int qca_send_reset(struct hci_dev *hdev)
-{
- struct sk_buff *skb;
- int err;
-
- bt_dev_dbg(hdev, "QCA HCI_RESET");
-
- skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
- if (IS_ERR(skb)) {
- err = PTR_ERR(skb);
- bt_dev_err(hdev, "QCA Reset failed (%d)", err);
- return err;
- }
-
- kfree_skb(skb);
-
- return 0;
-}
-
static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid)
{
u8 cmd;
@@ -990,7 +971,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
/* Perform HCI reset */
- err = qca_send_reset(hdev);
+ bt_dev_dbg(hdev, "QCA HCI_RESET");
+ err = __hci_reset_sync(hdev);
if (err < 0) {
bt_dev_err(hdev, "QCA Failed to run HCI_RESET (%d)", err);
return err;
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset()
2026-06-22 14:52 ` [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset() Zijun Hu
@ 2026-06-23 9:03 ` Bartosz Golaszewski
2026-06-23 10:13 ` Zijun Hu
2026-06-23 15:15 ` Luiz Augusto von Dentz
1 sibling, 1 reply; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 9:03 UTC (permalink / raw)
To: Zijun Hu
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Bartosz Golaszewski, Ben Young Tae Kim,
Balakrishna Godavarthi, Matthias Kaehlcke
On Mon, 22 Jun 2026 16:52:25 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> qca_send_reset() uses __hci_cmd_sync() which returns an skb but never
> reads the HCI status byte from skb->data[0], so a non-zero error status
> returned by the controller is silently ignored.
>
> Fix by replacing qca_send_reset() with __hci_reset_sync() which
> properly extracts and converts the HCI status byte to a negative errno.
>
> Fixes: 83e81961ff7e ("Bluetooth: btqca: Introduce generic QCA ROME support")
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
I think the fix should go in the front of the series. Even if it requires the
new function.
Bart
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset()
2026-06-23 9:03 ` Bartosz Golaszewski
@ 2026-06-23 10:13 ` Zijun Hu
0 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 10:13 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
On 6/23/2026 5:03 PM, Bartosz Golaszewski wrote:
>> Fixes: 83e81961ff7e ("Bluetooth: btqca: Introduce generic QCA ROME support")
>> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
>> ---
> I think the fix should go in the front of the series. Even if it requires the
> new function.
Agreed on the reordering. However, handling HCI status errors for the
reset command needs more discussion before we can finalize the approach,
so the fix may be further optimized accordingly.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset()
2026-06-22 14:52 ` [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset() Zijun Hu
2026-06-23 9:03 ` Bartosz Golaszewski
@ 2026-06-23 15:15 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 32+ messages in thread
From: Luiz Augusto von Dentz @ 2026-06-23 15:15 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Rocky Liao, Bartosz Golaszewski,
Ben Young Tae Kim, Balakrishna Godavarthi, Matthias Kaehlcke,
Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm
Hi Zijun,
On Mon, Jun 22, 2026 at 10:52 AM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote:
>
> qca_send_reset() uses __hci_cmd_sync() which returns an skb but never
> reads the HCI status byte from skb->data[0], so a non-zero error status
> returned by the controller is silently ignored.
>
> Fix by replacing qca_send_reset() with __hci_reset_sync() which
> properly extracts and converts the HCI status byte to a negative errno.
>
> Fixes: 83e81961ff7e ("Bluetooth: btqca: Introduce generic QCA ROME support")
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btqca.c | 22 ++--------------------
> 1 file changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 04ebe290bc78..875216e15603 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -190,25 +190,6 @@ static int qca_send_patch_config_cmd(struct hci_dev *hdev)
> return err;
> }
>
> -static int qca_send_reset(struct hci_dev *hdev)
> -{
> - struct sk_buff *skb;
> - int err;
> -
> - bt_dev_dbg(hdev, "QCA HCI_RESET");
> -
> - skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
> - if (IS_ERR(skb)) {
> - err = PTR_ERR(skb);
> - bt_dev_err(hdev, "QCA Reset failed (%d)", err);
> - return err;
> - }
> -
> - kfree_skb(skb);
> -
> - return 0;
> -}
> -
> static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid)
> {
> u8 cmd;
> @@ -990,7 +971,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> }
>
> /* Perform HCI reset */
> - err = qca_send_reset(hdev);
> + bt_dev_dbg(hdev, "QCA HCI_RESET");
> + err = __hci_reset_sync(hdev);
So All the fuss about the reset is just to use it here? Actually the
distinction between -err and status is rather important. The first
means the command didn't run (timeout, cancel, etc), or it did run but
returned a status != 0. If you want to capture both then you must use
if (err). And yes there are parts of the code that test for < 0, but
that is either a bug or they are intentionally ignoring the reset
status as it is probably a non-recoverable error at that point.
> if (err < 0) {
> bt_dev_err(hdev, "QCA Failed to run HCI_RESET (%d)", err);
> return err;
>
> --
> 2.34.1
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type
2026-06-22 14:52 [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (11 preceding siblings ...)
2026-06-22 14:52 ` [PATCH 12/13] Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset() Zijun Hu
@ 2026-06-22 14:52 ` Zijun Hu
2026-06-23 9:04 ` Bartosz Golaszewski
12 siblings, 1 reply; 32+ messages in thread
From: Zijun Hu @ 2026-06-22 14:52 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
EDL_WRITE_BD_ADDR_OPCODE (0xFC14) returns a command complete event,
not a VSE, but qca_set_bdaddr() waits for HCI_EV_VENDOR.
Fix by passing 0 as the event parameter to __hci_cmd_sync_ev() to
wait for the command complete event instead.
Fixes: 5c0a1001c8be ("Bluetooth: hci_qca: Add helper to set device address")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
drivers/bluetooth/btqca.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 875216e15603..f3487de813c2 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -1011,8 +1011,7 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
baswap(&bdaddr_swapped, bdaddr);
skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6,
- &bdaddr_swapped, HCI_EV_VENDOR,
- HCI_INIT_TIMEOUT);
+ &bdaddr_swapped, 0, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
err = PTR_ERR(skb);
bt_dev_err(hdev, "QCA Change address cmd failed (%d)", err);
--
2.34.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type
2026-06-22 14:52 ` [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type Zijun Hu
@ 2026-06-23 9:04 ` Bartosz Golaszewski
2026-06-23 10:16 ` Zijun Hu
0 siblings, 1 reply; 32+ messages in thread
From: Bartosz Golaszewski @ 2026-06-23 9:04 UTC (permalink / raw)
To: Zijun Hu
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Bartosz Golaszewski, Ben Young Tae Kim,
Balakrishna Godavarthi, Matthias Kaehlcke
On Mon, 22 Jun 2026 16:52:26 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> EDL_WRITE_BD_ADDR_OPCODE (0xFC14) returns a command complete event,
> not a VSE, but qca_set_bdaddr() waits for HCI_EV_VENDOR.
>
> Fix by passing 0 as the event parameter to __hci_cmd_sync_ev() to
> wait for the command complete event instead.
>
> Fixes: 5c0a1001c8be ("Bluetooth: hci_qca: Add helper to set device address")
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btqca.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 875216e15603..f3487de813c2 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -1011,8 +1011,7 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
> baswap(&bdaddr_swapped, bdaddr);
>
> skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6,
> - &bdaddr_swapped, HCI_EV_VENDOR,
> - HCI_INIT_TIMEOUT);
> + &bdaddr_swapped, 0, HCI_INIT_TIMEOUT);
> if (IS_ERR(skb)) {
> err = PTR_ERR(skb);
> bt_dev_err(hdev, "QCA Change address cmd failed (%d)", err);
>
> --
> 2.34.1
>
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Looks good but should go in the front of the series and land upstream earlier.
Bart
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 13/13] Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type
2026-06-23 9:04 ` Bartosz Golaszewski
@ 2026-06-23 10:16 ` Zijun Hu
0 siblings, 0 replies; 32+ messages in thread
From: Zijun Hu @ 2026-06-23 10:16 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Marcel Holtmann, Luiz Augusto von Dentz,
Rocky Liao, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke
On 6/23/2026 5:04 PM, Bartosz Golaszewski wrote:
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>
> Looks good but should go in the front of the series and land upstream earlier.
Thanks for the R-b. Will do it in v2.
^ permalink raw reply [flat|nested] 32+ messages in thread