* [PATCH v2 01/12] Bluetooth: btqca: Fix qca_set_bdaddr() waiting for wrong HCI event
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 02/12] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855() Zijun Hu
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu, Bartosz Golaszewski
qca_set_bdaddr() waits for HCI_EV_VENDOR when sending
EDL_WRITE_BD_ADDR_OPCODE (0xFC14), but the controller responds with
Command Complete event as confirmed by btmon on WCN7850:
< HCI Command: Vendor (0x3f|0x0014) plen 6 #3 [hci0]
11 22 33 44 55 66
> HCI Event: Command Complete (0x0e) plen 4 #4 [hci0]
Vendor (0x3f|0x0014) ncmd 1
Status: Success (0x00)
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")
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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 04ebe290bc78..27f03690af54 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -1029,8 +1029,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] 15+ messages in thread* [PATCH v2 02/12] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
2026-06-26 5:19 ` [PATCH v2 01/12] Bluetooth: btqca: Fix qca_set_bdaddr() waiting for wrong HCI event Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 03/12] Bluetooth: btusb: Record matched usb_device_id into btusb_data Zijun Hu
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
btusb_set_bdaddr_wcn6855() sends the address without swapping byte
order for VSC 0xFC14, but the command expects the address in reversed
byte order compared to other HCI commands like HCI_Create_Connection,
resulting in a wrong BD_ADDR being set.
btmon log on WCN6855 shows VSC 0xFC14 is sent with swapped bytes
11 22 33 44 55 66, and Read BD ADDR returns the expected address
11:22:33:44:55:66:
< HCI Command: Vendor (0x3f|0x0014) plen 6 #3 [hci0]
11 22 33 44 55 66
> HCI Event: Command Complete (0x0e) plen 4 #4 [hci0]
Vendor (0x3f|0x0014) ncmd 1
Status: Success (0x00)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0 #11 [hci0]
> HCI Event: Command Complete (0x0e) plen 10 #12 [hci0]
Read BD ADDR (0x04|0x0009) ncmd 1
Status: Success (0x00)
Address: 11:22:33:44:55:66 (OUI 11-22-33)
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 7f14ce96319b..17573749adda 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3072,14 +3072,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] 15+ messages in thread* [PATCH v2 03/12] Bluetooth: btusb: Record matched usb_device_id into btusb_data
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
2026-06-26 5:19 ` [PATCH v2 01/12] Bluetooth: btqca: Fix qca_set_bdaddr() waiting for wrong HCI event Zijun Hu
2026-06-26 5:19 ` [PATCH v2 02/12] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855() Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 04/12] Bluetooth: btusb: QCA: Fix populating devcoredump fields on unenabled devices Zijun Hu
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
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 17573749adda..31cbe075edc9 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);
@@ -4120,6 +4121,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] 15+ messages in thread* [PATCH v2 04/12] Bluetooth: btusb: QCA: Fix populating devcoredump fields on unenabled devices
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (2 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 03/12] Bluetooth: btusb: Record matched usb_device_id into btusb_data Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 05/12] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data Zijun Hu
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Devcoredump is not enabled for ATH3012 or QCA_ROME, but they
unconditionally populate devcoredump fields in btusb_setup_qca().
Fix by populating devcoredump fields only when BTUSB_QCA_WCN6855 is
set, which marks the first generation of QCA BT SoCs for which
devcoredump is enabled.
Fixes: 20981ce2d5a5 ("Bluetooth: btusb: Add WCN6855 devcoredump support")
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 31cbe075edc9..0bc7d7b61b25 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3709,8 +3709,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] 15+ messages in thread* [PATCH v2 05/12] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (3 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 04/12] Bluetooth: btusb: QCA: Fix populating devcoredump fields on unenabled devices Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 06/12] Bluetooth: hci_sync: Introduce __hci_reset_sync() for device drivers Zijun Hu
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
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 0bc7d7b61b25..a5ff4af90675 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)
@@ -3117,14 +3119,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",
@@ -3132,7 +3135,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",
@@ -3161,6 +3164,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);
@@ -3188,8 +3193,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));
@@ -3201,29 +3206,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;
@@ -3231,10 +3236,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)
@@ -3710,8 +3715,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)) {
@@ -4177,6 +4184,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;
@@ -4319,8 +4329,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] 15+ messages in thread* [PATCH v2 06/12] Bluetooth: hci_sync: Introduce __hci_reset_sync() for device drivers
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (4 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 05/12] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 07/12] Bluetooth: btqca: Simplify qca_send_reset() by using __hci_reset_sync() Zijun Hu
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
Several vendor drivers have a requirement to send a synchronous raw HCI
reset with HCI_INIT_TIMEOUT.
Add a dedicated __hci_reset_sync() 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 | 8 ++++++++
2 files changed, 9 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 3be8c3581c6c..ca1ee6c89739 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3684,6 +3684,14 @@ int hci_reset_sync(struct hci_dev *hdev)
return 0;
}
+/* Send a raw HCI reset for use by vendor drivers */
+int __hci_reset_sync(struct hci_dev *hdev)
+{
+ return __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
+ HCI_INIT_TIMEOUT);
+}
+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] 15+ messages in thread* [PATCH v2 07/12] Bluetooth: btqca: Simplify qca_send_reset() by using __hci_reset_sync()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (5 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 06/12] Bluetooth: hci_sync: Introduce __hci_reset_sync() for device drivers Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 08/12] Bluetooth: btusb: Simplify btusb_shutdown_qca() " Zijun Hu
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
qca_send_reset() is functionally equivalent to the newly added
__hci_reset_sync().
Drop qca_send_reset() and call __hci_reset_sync() directly.
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 27f03690af54..a940fa48179b 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,11 +971,12 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
/* Perform HCI reset */
- err = qca_send_reset(hdev);
+ err = __hci_reset_sync(hdev);
if (err < 0) {
bt_dev_err(hdev, "QCA Failed to run HCI_RESET (%d)", err);
return err;
}
+ bt_dev_dbg(hdev, "QCA HCI_RESET succeed");
switch (soc_type) {
case QCA_WCN3991:
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 08/12] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (6 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 07/12] Bluetooth: btqca: Simplify qca_send_reset() by using __hci_reset_sync() Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 09/12] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
btusb_shutdown_qca() open-codes a synchronous raw HCI reset that is
functionally equivalent to the newly added __hci_reset_sync().
Replace it with __hci_reset_sync() and return its result directly.
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 a5ff4af90675..25bbee8f5d93 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] 15+ messages in thread* [PATCH v2 09/12] Bluetooth: hci_sync: Simplify hci_reset_sync()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (7 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 08/12] Bluetooth: btusb: Simplify btusb_shutdown_qca() " Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset() Zijun Hu
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu, Bartosz Golaszewski
Return the reset command status directly instead of storing it in a
local variable and using an if/return pattern.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
net/bluetooth/hci_sync.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index ca1ee6c89739..97caac7a1963 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3672,16 +3672,10 @@ static const struct hci_init_stage hci_init0[] = {
int hci_reset_sync(struct hci_dev *hdev)
{
- int err;
-
set_bit(HCI_RESET, &hdev->flags);
- err = __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
- HCI_CMD_TIMEOUT);
- if (err)
- return err;
-
- return 0;
+ return __hci_cmd_sync_status(hdev, HCI_OP_RESET, 0, NULL,
+ HCI_CMD_TIMEOUT);
}
/* Send a raw HCI reset for use by vendor drivers */
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (8 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 09/12] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-30 14:43 ` Bartosz Golaszewski
2026-06-26 5:19 ` [PATCH v2 11/12] Bluetooth: btusb: Reduce a redundant assignment in btusb_probe() Zijun Hu
` (2 subsequent siblings)
12 siblings, 1 reply; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu
HCI_Reset is a critical command, but hci_cc_reset() uses bt_dev_dbg()
to log it, so a non-zero error status response may not be noticed.
Fix by using bt_dev_err() when a status error occurs.
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
net/bluetooth/hci_event.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b6d963ce26d0..a90d2c6a6e59 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -269,7 +269,10 @@ static u8 hci_cc_reset(struct hci_dev *hdev, void *data, struct sk_buff *skb)
{
struct hci_ev_status *rp = data;
- bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
+ if (rp->status)
+ bt_dev_err(hdev, "HCI reset failed (status 0x%2.2x)", rp->status);
+ else
+ bt_dev_dbg(hdev, "HCI reset succeeded");
clear_bit(HCI_RESET, &hdev->flags);
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v2 10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset()
2026-06-26 5:19 ` [PATCH v2 10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset() Zijun Hu
@ 2026-06-30 14:43 ` Bartosz Golaszewski
0 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2026-06-30 14:43 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, Tim Jiang, Zijun Hu, linux-bluetooth,
linux-kernel, Luiz Augusto von Dentz, linux-arm-msm
On Fri, 26 Jun 2026 07:19:55 +0200, Zijun Hu <zijun.hu@oss.qualcomm.com> said:
> HCI_Reset is a critical command, but hci_cc_reset() uses bt_dev_dbg()
> to log it, so a non-zero error status response may not be noticed.
>
> Fix by using bt_dev_err() when a status error occurs.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> net/bluetooth/hci_event.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index b6d963ce26d0..a90d2c6a6e59 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -269,7 +269,10 @@ static u8 hci_cc_reset(struct hci_dev *hdev, void *data, struct sk_buff *skb)
> {
> struct hci_ev_status *rp = data;
>
> - bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
> + if (rp->status)
> + bt_dev_err(hdev, "HCI reset failed (status 0x%2.2x)", rp->status);
> + else
> + bt_dev_dbg(hdev, "HCI reset succeeded");
>
> clear_bit(HCI_RESET, &hdev->flags);
>
>
> --
> 2.34.1
>
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 11/12] Bluetooth: btusb: Reduce a redundant assignment in btusb_probe()
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (9 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset() Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-26 5:19 ` [PATCH v2 12/12] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
2026-06-30 20:32 ` [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs patchwork-bot+bluetooth
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu, Bartosz Golaszewski
Initialize @priv_size at declaration rather than separately:
- Simpler: one statement completes both declaration and assignment.
- More flexible: the variable is immediately usable from that point,
so any new priv_size += can be freely inserted without caring about
where the separate priv_size = 0 sits.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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 25bbee8f5d93..d2e15a91584f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4090,7 +4090,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);
@@ -4161,8 +4161,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] 15+ messages in thread* [PATCH v2 12/12] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (10 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 11/12] Bluetooth: btusb: Reduce a redundant assignment in btusb_probe() Zijun Hu
@ 2026-06-26 5:19 ` Zijun Hu
2026-06-30 20:32 ` [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs patchwork-bot+bluetooth
12 siblings, 0 replies; 15+ messages in thread
From: Zijun Hu @ 2026-06-26 5:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Rocky Liao,
Bartosz Golaszewski, Ben Young Tae Kim, Balakrishna Godavarthi,
Matthias Kaehlcke, Tim Jiang
Cc: Zijun Hu, linux-bluetooth, linux-kernel, Luiz Augusto von Dentz,
linux-arm-msm, Zijun Hu, Bartosz Golaszewski, Dmitry Baryshkov
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.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
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 d2e15a91584f..21e125db1b1f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4109,7 +4109,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] 15+ messages in thread* Re: [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs
2026-06-26 5:19 [PATCH v2 00/12] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs Zijun Hu
` (11 preceding siblings ...)
2026-06-26 5:19 ` [PATCH v2 12/12] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE Zijun Hu
@ 2026-06-30 20:32 ` patchwork-bot+bluetooth
12 siblings, 0 replies; 15+ messages in thread
From: patchwork-bot+bluetooth @ 2026-06-30 20:32 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, luiz.dentz, quic_rjliao, brgl, ytkim, quic_bgodavar, mka,
quic_tjiang, zijun_hu, linux-bluetooth, linux-kernel,
luiz.von.dentz, linux-arm-msm, bartosz.golaszewski,
dmitry.baryshkov
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 25 Jun 2026 22:19:45 -0700 you wrote:
> This series cleans up btusb in preparation for adding a new chip,
> QCC2072, and fixes several pre-existing bugs found along the way.
>
> Bug fixes:
> - qca_set_bdaddr() waited for HCI_EV_VENDOR, but the controller replies
> with a Command Complete event.
> - btusb_set_bdaddr_wcn6855() sent the BD_ADDR without byte-swapping it.
> - btusb QCA populated devcoredump fields on devices where devcoredump is
> not enabled.
> - BTUSB_IGNORE is a bitmask and must be tested with '&', not '=='.
>
> [...]
Here is the summary with links:
- [v2,01/12] Bluetooth: btqca: Fix qca_set_bdaddr() waiting for wrong HCI event
https://git.kernel.org/bluetooth/bluetooth-next/c/1718f3a121dd
- [v2,02/12] Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855()
https://git.kernel.org/bluetooth/bluetooth-next/c/cb9fed45d399
- [v2,03/12] Bluetooth: btusb: Record matched usb_device_id into btusb_data
https://git.kernel.org/bluetooth/bluetooth-next/c/97138867591e
- [v2,04/12] Bluetooth: btusb: QCA: Fix populating devcoredump fields on unenabled devices
https://git.kernel.org/bluetooth/bluetooth-next/c/0a7575521e2e
- [v2,05/12] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data
https://git.kernel.org/bluetooth/bluetooth-next/c/bafbbfe43876
- [v2,06/12] Bluetooth: hci_sync: Introduce __hci_reset_sync() for device drivers
https://git.kernel.org/bluetooth/bluetooth-next/c/dc4d5e617358
- [v2,07/12] Bluetooth: btqca: Simplify qca_send_reset() by using __hci_reset_sync()
https://git.kernel.org/bluetooth/bluetooth-next/c/6ccd5c9a56dd
- [v2,08/12] Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()
https://git.kernel.org/bluetooth/bluetooth-next/c/738df2031c56
- [v2,09/12] Bluetooth: hci_sync: Simplify hci_reset_sync()
https://git.kernel.org/bluetooth/bluetooth-next/c/a16a8312f80f
- [v2,10/12] Bluetooth: hci_event: Log error for HCI reset status error in hci_cc_reset()
(no matching commit)
- [v2,11/12] Bluetooth: btusb: Reduce a redundant assignment in btusb_probe()
https://git.kernel.org/bluetooth/bluetooth-next/c/37ecdbcfd7cb
- [v2,12/12] Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
https://git.kernel.org/bluetooth/bluetooth-next/c/5d490bc8bda1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 15+ messages in thread