mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support
@ 2026-07-09  6:14 Zijun Hu
  2026-07-09  6:14 ` [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name() Zijun Hu
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:14 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

This series collects the btusb and devcoredump changes required by the
upcoming Qualcomm QCC2072 Bluetooth driver. None of them are QCC2072-
specific: they refactor btusb into a shape that can host vendor-specific
source files, and make a few coredump helpers reusable.

Posting them as a standalone series because the QCC2072 driver itself is
larger and will take longer to review. These prerequisites are small and
self-contained, so they can hopefully be reviewed and merged on their own
in the meantime.

The series contains:
 - coredump: a readable state-name helper and a fixed-size dump header,
   both reused by the vendor driver
 - btusb: an indirect recv_intr() hook, hci_dev-based recv wrappers, a
   shared reset-prepare helper, and a split into btusb_main.c so vendor
   files can be added later

No functional change intended.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
Zijun Hu (6):
      Bluetooth: coredump: Introduce and apply hci_devcd_state_name()
      Bluetooth: coredump: Allow drivers to pad dump header to fixed size
      Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data
      Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev()
      Bluetooth: btusb: Add a simple static btusb_prepare_reset()
      Bluetooth: btusb: Build the driver from multiple source files

 drivers/bluetooth/Makefile                  |  2 ++
 drivers/bluetooth/{btusb.c => btusb_main.c} | 33 ++++++++++++++++++++++---
 include/net/bluetooth/coredump.h            | 11 +++++++++
 net/bluetooth/coredump.c                    | 38 ++++++++++++++++++++---------
 4 files changed, 68 insertions(+), 16 deletions(-)
---
base-commit: ca75417ab1793f23b3ddc91869f0809b593d6954
change-id: 20260708-btusb_prep_qcc2072-23604a4e81d1

Best regards,
-- 
Zijun Hu <zijun.hu@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name()
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
@ 2026-07-09  6:14 ` Zijun Hu
  2026-07-09  6:14 ` [PATCH 2/6] Bluetooth: coredump: Allow drivers to pad dump header to fixed size Zijun Hu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:14 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

Introduce hci_devcd_state_name() to make devcoredump state more
readable, and apply it in coredump.c. Also remove a trailing space
in two bt_dev_dbg() format strings while applying it.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 include/net/bluetooth/coredump.h |  7 +++++++
 net/bluetooth/coredump.c         | 31 ++++++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/include/net/bluetooth/coredump.h b/include/net/bluetooth/coredump.h
index 72f51b587a04..ab85a6adfffd 100644
--- a/include/net/bluetooth/coredump.h
+++ b/include/net/bluetooth/coredump.h
@@ -60,6 +60,8 @@ struct hci_devcoredump {
 
 #ifdef CONFIG_DEV_COREDUMP
 
+const char *hci_devcd_state_name(enum devcoredump_state state);
+
 void hci_devcd_reset(struct hci_dev *hdev);
 void hci_devcd_rx(struct work_struct *work);
 void hci_devcd_timeout(struct work_struct *work);
@@ -74,6 +76,11 @@ int hci_devcd_abort(struct hci_dev *hdev);
 
 #else
 
+static inline const char *hci_devcd_state_name(enum devcoredump_state state)
+{
+	return "";
+}
+
 static inline void hci_devcd_reset(struct hci_dev *hdev) {}
 static inline void hci_devcd_rx(struct work_struct *work) {}
 static inline void hci_devcd_timeout(struct work_struct *work) {}
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 720cb79adf96..3d4c2194ef43 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -30,8 +30,9 @@ struct hci_devcoredump_skb_pattern {
 
 #define DBG_UNEXPECTED_STATE() \
 	bt_dev_dbg(hdev, \
-		   "Unexpected packet (%d) for state (%d). ", \
-		   hci_dmp_cb(skb)->pkt_type, hdev->dump.state)
+		   "Unexpected packet (%d) for state %s.", \
+		   hci_dmp_cb(skb)->pkt_type, \
+		   hci_devcd_state_name(hdev->dump.state))
 
 #define MAX_DEVCOREDUMP_HDR_SIZE	512	/* bytes */
 
@@ -50,8 +51,9 @@ static int hci_devcd_update_hdr_state(char *buf, size_t size, int state)
 /* Call with hci_dev_lock only. */
 static int hci_devcd_update_state(struct hci_dev *hdev, int state)
 {
-	bt_dev_dbg(hdev, "Updating devcoredump state from %d to %d.",
-		   hdev->dump.state, state);
+	bt_dev_dbg(hdev, "Updating devcoredump state from %s to %s.",
+		   hci_devcd_state_name(hdev->dump.state),
+		   hci_devcd_state_name(state));
 
 	hdev->dump.state = state;
 
@@ -245,7 +247,7 @@ static void hci_devcd_dump(struct hci_dev *hdev)
 	struct sk_buff *skb;
 	u32 size;
 
-	bt_dev_dbg(hdev, "state %d", hdev->dump.state);
+	bt_dev_dbg(hdev, "state %s", hci_devcd_state_name(hdev->dump.state));
 
 	size = hdev->dump.tail - hdev->dump.head;
 
@@ -368,8 +370,9 @@ void hci_devcd_rx(struct work_struct *work)
 			break;
 
 		default:
-			bt_dev_dbg(hdev, "Unknown packet (%d) for state (%d). ",
-				   hci_dmp_cb(skb)->pkt_type, hdev->dump.state);
+			bt_dev_dbg(hdev, "Unknown packet (%d) for state %s.",
+				   hci_dmp_cb(skb)->pkt_type,
+				   hci_devcd_state_name(hdev->dump.state));
 			break;
 		}
 
@@ -551,3 +554,17 @@ int hci_devcd_abort(struct hci_dev *hdev)
 	return 0;
 }
 EXPORT_SYMBOL(hci_devcd_abort);
+
+const char *hci_devcd_state_name(enum devcoredump_state state)
+{
+	static const char * const state_names[] = {
+		[HCI_DEVCOREDUMP_IDLE]		= "IDLE",
+		[HCI_DEVCOREDUMP_ACTIVE]	= "ACTIVE",
+		[HCI_DEVCOREDUMP_DONE]		= "DONE",
+		[HCI_DEVCOREDUMP_ABORT]		= "ABORT",
+		[HCI_DEVCOREDUMP_TIMEOUT]	= "TIMEOUT",
+	};
+
+	return state_names[state];
+}
+EXPORT_SYMBOL(hci_devcd_state_name);

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/6] Bluetooth: coredump: Allow drivers to pad dump header to fixed size
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
  2026-07-09  6:14 ` [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name() Zijun Hu
@ 2026-07-09  6:14 ` Zijun Hu
  2026-07-09  6:15 ` [PATCH 3/6] Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data Zijun Hu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:14 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

To let a driver easily separate header and data in the generated
coredump, allow a vendor driver to pad its header to a fixed size by:
 - exposing MAX_HCI_DEVCD_HDR_SIZE as the max header size
 - exposing HCI_DEVCD_HDR_END as the header-ending marker

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 include/net/bluetooth/coredump.h | 4 ++++
 net/bluetooth/coredump.c         | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/net/bluetooth/coredump.h b/include/net/bluetooth/coredump.h
index ab85a6adfffd..b668277bdb76 100644
--- a/include/net/bluetooth/coredump.h
+++ b/include/net/bluetooth/coredump.h
@@ -8,6 +8,10 @@
 
 #define DEVCOREDUMP_TIMEOUT	msecs_to_jiffies(10000)	/* 10 sec */
 
+/* total size shared by coredump and driver's dmp_hdr() */
+#define MAX_HCI_DEVCD_HDR_SIZE	512
+#define HCI_DEVCD_HDR_END	"--- Start dump ---\n"
+
 typedef void (*coredump_t)(struct hci_dev *hdev);
 typedef void (*dmp_hdr_t)(struct hci_dev *hdev, struct sk_buff *skb);
 typedef void (*notify_change_t)(struct hci_dev *hdev, int state);
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 3d4c2194ef43..c77bf511679d 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -34,8 +34,6 @@ struct hci_devcoredump_skb_pattern {
 		   hci_dmp_cb(skb)->pkt_type, \
 		   hci_devcd_state_name(hdev->dump.state))
 
-#define MAX_DEVCOREDUMP_HDR_SIZE	512	/* bytes */
-
 static int hci_devcd_update_hdr_state(char *buf, size_t size, int state)
 {
 	int len = 0;
@@ -63,7 +61,6 @@ static int hci_devcd_update_state(struct hci_dev *hdev, int state)
 
 static int hci_devcd_mkheader(struct hci_dev *hdev, struct sk_buff *skb)
 {
-	char dump_start[] = "--- Start dump ---\n";
 	char hdr[80];
 	int hdr_len;
 
@@ -74,7 +71,7 @@ static int hci_devcd_mkheader(struct hci_dev *hdev, struct sk_buff *skb)
 	if (hdev->dump.dmp_hdr)
 		hdev->dump.dmp_hdr(hdev, skb);
 
-	skb_put_data(skb, dump_start, strlen(dump_start));
+	skb_put_data(skb, HCI_DEVCD_HDR_END, strlen(HCI_DEVCD_HDR_END));
 
 	return skb->len;
 }
@@ -154,7 +151,7 @@ static int hci_devcd_prepare(struct hci_dev *hdev, u32 dump_size)
 	int dump_hdr_size;
 	int err = 0;
 
-	skb = alloc_skb(MAX_DEVCOREDUMP_HDR_SIZE, GFP_ATOMIC);
+	skb = alloc_skb(MAX_HCI_DEVCD_HDR_SIZE, GFP_ATOMIC);
 	if (!skb)
 		return -ENOMEM;
 

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/6] Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
  2026-07-09  6:14 ` [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name() Zijun Hu
  2026-07-09  6:14 ` [PATCH 2/6] Bluetooth: coredump: Allow drivers to pad dump header to fixed size Zijun Hu
@ 2026-07-09  6:15 ` Zijun Hu
  2026-07-09  6:15 ` [PATCH 4/6] Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev() Zijun Hu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:15 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

Allow a vendor driver to assemble and handle its non-BT frames from the
interrupt endpoint.

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 9726a007d25a..e5642d966153 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1030,6 +1030,7 @@ struct btusb_data {
 
 	int (*recv_event)(struct hci_dev *hdev, struct sk_buff *skb);
 	int (*recv_acl)(struct hci_dev *hdev, struct sk_buff *skb);
+	int (*recv_intr)(struct btusb_data *data, void *buffer, int count);
 	int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
 
 	int (*setup_on_usb)(struct hci_dev *hdev);
@@ -1502,7 +1503,7 @@ static void btusb_intr_complete(struct urb *urb)
 	if (urb->status == 0) {
 		hdev->stat.byte_rx += urb->actual_length;
 
-		if (btusb_recv_intr(data, urb->transfer_buffer,
+		if (data->recv_intr(data, urb->transfer_buffer,
 				    urb->actual_length) < 0) {
 			bt_dev_err(hdev, "corrupted event packet");
 			hdev->stat.err_rx++;
@@ -2709,7 +2710,7 @@ static int btusb_recv_bulk_intel(struct btusb_data *data, void *buffer,
 	 * same way as the ones received from the interrupt endpoint.
 	 */
 	if (btintel_test_flag(hdev, INTEL_BOOTLOADER))
-		return btusb_recv_intr(data, buffer, count);
+		return data->recv_intr(data, buffer, count);
 
 	return btusb_recv_bulk(data, buffer, count);
 }
@@ -4172,6 +4173,7 @@ static int btusb_probe(struct usb_interface *intf,
 	spin_lock_init(&data->rxlock);
 
 	data->recv_event = hci_recv_frame;
+	data->recv_intr = btusb_recv_intr;
 	data->recv_bulk = btusb_recv_bulk;
 
 	if (id->driver_info & BTUSB_INTEL_COMBINED) {

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/6] Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev()
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
                   ` (2 preceding siblings ...)
  2026-07-09  6:15 ` [PATCH 3/6] Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data Zijun Hu
@ 2026-07-09  6:15 ` Zijun Hu
  2026-07-09  6:15 ` [PATCH 5/6] Bluetooth: btusb: Add a simple static btusb_prepare_reset() Zijun Hu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:15 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

Vendor-specific files need to hand BT frames back to btusb for reporting
upwards after filtering out non-BT frames, but the existing helpers take
struct btusb_data *, which is private to btusb_main.c:

  int btusb_recv_event(struct btusb_data *data, struct sk_buff *skb)
  int btusb_recv_acl(struct btusb_data *data, struct sk_buff *skb)

Add two wrappers taking struct hci_dev * so they can be used from
vendor files.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 drivers/bluetooth/btusb.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e5642d966153..d8f076baf3dd 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1261,6 +1261,14 @@ static int btusb_recv_event(struct btusb_data *data, struct sk_buff *skb)
 	return data->recv_event(data->hdev, skb);
 }
 
+static int __maybe_unused btusb_recv_event_hdev(struct hci_dev *hdev,
+						struct sk_buff *skb)
+{
+	struct btusb_data *data = hci_get_drvdata(hdev);
+
+	return btusb_recv_event(data, skb);
+}
+
 static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
 {
 	struct sk_buff *skb;
@@ -1343,6 +1351,14 @@ static int btusb_recv_acl(struct btusb_data *data, struct sk_buff *skb)
 	return 0;
 }
 
+static int __maybe_unused btusb_recv_acl_hdev(struct hci_dev *hdev,
+					      struct sk_buff *skb)
+{
+	struct btusb_data *data = hci_get_drvdata(hdev);
+
+	return btusb_recv_acl(data, skb);
+}
+
 static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
 {
 	struct sk_buff *skb;

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/6] Bluetooth: btusb: Add a simple static btusb_prepare_reset()
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
                   ` (3 preceding siblings ...)
  2026-07-09  6:15 ` [PATCH 4/6] Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev() Zijun Hu
@ 2026-07-09  6:15 ` Zijun Hu
  2026-07-09  6:15 ` [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
  2026-07-09 13:46 ` [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Luiz Augusto von Dentz
  6 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:15 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

Add btusb_prepare_reset() to do cleanup before a reset, and apply
it to btusb_mtk_reset() as well.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 drivers/bluetooth/btusb.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index d8f076baf3dd..e914ed043dc9 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2085,6 +2085,14 @@ static void btusb_stop_traffic(struct btusb_data *data)
 	usb_kill_anchored_urbs(&data->ctrl_anchor);
 }
 
+static void btusb_prepare_reset(struct hci_dev *hdev)
+{
+	struct btusb_data *data = hci_get_drvdata(hdev);
+
+	btusb_stop_traffic(data);
+	usb_kill_anchored_urbs(&data->tx_anchor);
+}
+
 static int btusb_close(struct hci_dev *hdev)
 {
 	struct btusb_data *data = hci_get_drvdata(hdev);
@@ -2927,8 +2935,7 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 	/* Release MediaTek ISO data interface */
 	btusb_mtk_release_iso_intf(hdev);
 
-	btusb_stop_traffic(data);
-	usb_kill_anchored_urbs(&data->tx_anchor);
+	btusb_prepare_reset(hdev);
 
 	/* Toggle the hard reset line. The MediaTek device is going to
 	 * yank itself off the USB and then replug. The cleanup is handled

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
                   ` (4 preceding siblings ...)
  2026-07-09  6:15 ` [PATCH 5/6] Bluetooth: btusb: Add a simple static btusb_prepare_reset() Zijun Hu
@ 2026-07-09  6:15 ` Zijun Hu
  2026-07-09 13:40   ` Luiz Augusto von Dentz
  2026-07-09 13:46 ` [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Luiz Augusto von Dentz
  6 siblings, 1 reply; 11+ messages in thread
From: Zijun Hu @ 2026-07-09  6:15 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

Allow the driver to include vendor-specific source files by:
- renaming btusb.c to btusb_main.c
- making btusb.o a composite object

No functional change.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 drivers/bluetooth/Makefile                  | 2 ++
 drivers/bluetooth/{btusb.c => btusb_main.c} | 0
 2 files changed, 2 insertions(+)

diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index e6b1c1180d1d..8b436c6de8b7 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -51,4 +51,6 @@ hci_uart-$(CONFIG_BT_HCIUART_MRVL)	+= hci_mrvl.o
 hci_uart-$(CONFIG_BT_HCIUART_AML)	+= hci_aml.o
 hci_uart-objs				:= $(hci_uart-y)
 
+btusb-y				:= btusb_main.o
+
 CONTEXT_ANALYSIS := y
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb_main.c
similarity index 100%
rename from drivers/bluetooth/btusb.c
rename to drivers/bluetooth/btusb_main.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files
  2026-07-09  6:15 ` [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
@ 2026-07-09 13:40   ` Luiz Augusto von Dentz
  2026-07-13 10:06     ` Zijun Hu
  0 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2026-07-09 13:40 UTC (permalink / raw)
  To: Zijun Hu; +Cc: Marcel Holtmann, Zijun Hu, linux-bluetooth, linux-kernel

Hi Zijun,

On Thu, Jul 9, 2026 at 2:15 AM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote:
>
> Allow the driver to include vendor-specific source files by:
> - renaming btusb.c to btusb_main.c
> - making btusb.o a composite object

There is already support for including vendor-specific code, see btintel.c.

> No functional change.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
>  drivers/bluetooth/Makefile                  | 2 ++
>  drivers/bluetooth/{btusb.c => btusb_main.c} | 0
>  2 files changed, 2 insertions(+)
>
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index e6b1c1180d1d..8b436c6de8b7 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -51,4 +51,6 @@ hci_uart-$(CONFIG_BT_HCIUART_MRVL)    += hci_mrvl.o
>  hci_uart-$(CONFIG_BT_HCIUART_AML)      += hci_aml.o
>  hci_uart-objs                          := $(hci_uart-y)
>
> +btusb-y                                := btusb_main.o
> +
>  CONTEXT_ANALYSIS := y
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb_main.c
> similarity index 100%
> rename from drivers/bluetooth/btusb.c
> rename to drivers/bluetooth/btusb_main.c
>
> --
> 2.34.1
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support
  2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
                   ` (5 preceding siblings ...)
  2026-07-09  6:15 ` [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
@ 2026-07-09 13:46 ` Luiz Augusto von Dentz
  2026-07-13 10:23   ` Zijun Hu
  6 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2026-07-09 13:46 UTC (permalink / raw)
  To: Zijun Hu; +Cc: Marcel Holtmann, Zijun Hu, linux-bluetooth, linux-kernel

Hi Zijun,

On Thu, Jul 9, 2026 at 2:15 AM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote:
>
> This series collects the btusb and devcoredump changes required by the
> upcoming Qualcomm QCC2072 Bluetooth driver. None of them are QCC2072-
> specific: they refactor btusb into a shape that can host vendor-specific
> source files, and make a few coredump helpers reusable.

I really this not a 'lets redesign btusb because our driver is not
standard Bluetooth Class' kind of thing, we already have hdev->setup
and other callbacks for vendor specific functionality, if you want
more than that perhaps it needs to be become it own driver.

> Posting them as a standalone series because the QCC2072 driver itself is
> larger and will take longer to review. These prerequisites are small and
> self-contained, so they can hopefully be reviewed and merged on their own
> in the meantime.
>
> The series contains:
>  - coredump: a readable state-name helper and a fixed-size dump header,
>    both reused by the vendor driver
>  - btusb: an indirect recv_intr() hook, hci_dev-based recv wrappers, a
>    shared reset-prepare helper, and a split into btusb_main.c so vendor
>    files can be added later
>
> No functional change intended.
>
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> Zijun Hu (6):
>       Bluetooth: coredump: Introduce and apply hci_devcd_state_name()
>       Bluetooth: coredump: Allow drivers to pad dump header to fixed size
>       Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data
>       Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev()
>       Bluetooth: btusb: Add a simple static btusb_prepare_reset()
>       Bluetooth: btusb: Build the driver from multiple source files
>
>  drivers/bluetooth/Makefile                  |  2 ++
>  drivers/bluetooth/{btusb.c => btusb_main.c} | 33 ++++++++++++++++++++++---
>  include/net/bluetooth/coredump.h            | 11 +++++++++
>  net/bluetooth/coredump.c                    | 38 ++++++++++++++++++++---------
>  4 files changed, 68 insertions(+), 16 deletions(-)
> ---
> base-commit: ca75417ab1793f23b3ddc91869f0809b593d6954
> change-id: 20260708-btusb_prep_qcc2072-23604a4e81d1
>
> Best regards,
> --
> Zijun Hu <zijun.hu@oss.qualcomm.com>
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files
  2026-07-09 13:40   ` Luiz Augusto von Dentz
@ 2026-07-13 10:06     ` Zijun Hu
  0 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-13 10:06 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Marcel Holtmann, Zijun Hu, linux-bluetooth, linux-kernel

On 7/9/2026 9:40 PM, Luiz Augusto von Dentz wrote:
> Hi Zijun,
> 
> On Thu, Jul 9, 2026 at 2:15 AM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote:
>> Allow the driver to include vendor-specific source files by:
>> - renaming btusb.c to btusb_main.c
>> - making btusb.o a composite object
> There is already support for including vendor-specific code, see btintel.c.

Agreed, but there are two kinds of vendor code:

So the layering I have in mind is:
btusb_main.c  ->  btusb_<vendor>.c  ->  bt<vendor>.c
- btusb_<vendor>.c: vendor USB-specific code, compiled into btusb.
- bt<vendor>.c: vendor transport-independent code, its own module (btintel.c).

One of my goals is to move the qualcomm code in btusb.c into a new
btusb_qcom.c, linked into the btusb module to keep the migration low-risk.

Does this split make sense to you, or would you prefer a different approach?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support
  2026-07-09 13:46 ` [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Luiz Augusto von Dentz
@ 2026-07-13 10:23   ` Zijun Hu
  0 siblings, 0 replies; 11+ messages in thread
From: Zijun Hu @ 2026-07-13 10:23 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Marcel Holtmann, Zijun Hu, linux-bluetooth, linux-kernel

On 7/9/2026 9:46 PM, Luiz Augusto von Dentz wrote:
>> This series collects the btusb and devcoredump changes required by the
>> upcoming Qualcomm QCC2072 Bluetooth driver. None of them are QCC2072-
>> specific: they refactor btusb into a shape that can host vendor-specific
>> source files, and make a few coredump helpers reusable.
> I really this not a 'lets redesign btusb because our driver is not
> standard Bluetooth Class' kind of thing, we already have hdev->setup
> and other callbacks for vendor specific functionality, if you want
> more than that perhaps it needs to be become it own driver.

  Sorry, the cover letter was misleading — this isn't a redesign, and the
  QCC2072 driver does use the existing callbacks (hdev->setup, hdev->send, and
  the recv hooks). The change to btusb_main.c is small (+67/-2):

    https://lore.kernel.org/all/20260713-btusb_qcom-v1-1-39cabc0dd601@oss.qualcomm.com

  The only reason for the file split is size: the Qualcomm code is ~3700 lines,
  which I'd rather not add to btusb_main.c. 

  Please take a look — if you still think it warrants a standalone driver after
  seeing it, I'm happy to discuss that.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-07-13 10:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09  6:14 [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Zijun Hu
2026-07-09  6:14 ` [PATCH 1/6] Bluetooth: coredump: Introduce and apply hci_devcd_state_name() Zijun Hu
2026-07-09  6:14 ` [PATCH 2/6] Bluetooth: coredump: Allow drivers to pad dump header to fixed size Zijun Hu
2026-07-09  6:15 ` [PATCH 3/6] Bluetooth: btusb: Add an indirect recv_intr() hook to btusb_data Zijun Hu
2026-07-09  6:15 ` [PATCH 4/6] Bluetooth: btusb: Add wrappers btusb_recv_{event,acl}_hdev() Zijun Hu
2026-07-09  6:15 ` [PATCH 5/6] Bluetooth: btusb: Add a simple static btusb_prepare_reset() Zijun Hu
2026-07-09  6:15 ` [PATCH 6/6] Bluetooth: btusb: Build the driver from multiple source files Zijun Hu
2026-07-09 13:40   ` Luiz Augusto von Dentz
2026-07-13 10:06     ` Zijun Hu
2026-07-09 13:46 ` [PATCH 0/6] Bluetooth: btusb: Preparation for upcoming Qualcomm QCC2072 support Luiz Augusto von Dentz
2026-07-13 10:23   ` Zijun Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®