Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 00/13] Bluetooth: btusb/btqca/hci_sync: Clean up btusb and fix several bugs
@ 2026-06-22 14:52 Zijun Hu
  2026-06-22 14:52 ` [PATCH 01/13] Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe() Zijun Hu
                   ` (12 more replies)
  0 siblings, 13 replies; 19+ 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

This series originated as a cleanup of btusb in preparation for adding
support for a new chip, QCC2072: specifically, moving struct btusb_data
and the BTUSB_* macros into a new btusb.h header so that the forthcoming
QCC2072 driver can share them without duplicating definitions.

While doing that cleanup, several pre-existing bugs were found and fixed.

Preparatory cleanups:
- Initialize priv_size to 0 at declaration in btusb_probe() to remove a
  redundant assignment a few lines below.
- Move struct btusb_data and the BTUSB_* macros into a new btusb.h header
  so that btqca.c (and future drivers) can access them without duplicating
  definitions.
- Record the matched usb_device_id pointer in struct btusb_data so that
  downstream code (e.g. qca_setup) can inspect driver_info without
  needing to re-scan the id table.
- Move qca_dump out of struct btusb_data into a dedicated struct
  btqca_data stored in hci priv, decoupling the QCA coredump state from
  the generic btusb driver data.
- Simplify the hci_reset_sync() return path (trivial two-liner to one).
- Add __hci_reset_sync() as an exported helper for vendor drivers; it
  sends HCI_OP_RESET and returns a proper errno.
- Use __hci_reset_sync() in btusb_shutdown_qca() to remove open-coded
  __hci_cmd_sync() boilerplate.

Bug fixes found during the cleanup:
- BTUSB_IGNORE is a bitmask flag and must be tested with '&', not '=='.
  The '==' test would miss any device whose driver_info word carries
  additional flags alongside BTUSB_IGNORE.
- qca_setup() unconditionally populated devcoredump fw_version and
  controller_id fields even on ATH3012 and QCA_ROME devices where those
  fields are meaningless.  Guard the assignment behind a WCN6855 check.
- btusb_set_bdaddr_wcn6855() passed the raw bdaddr pointer to the HCI
  command without byte-swapping it first; use baswap() as other set_bdaddr
  implementations do.
- hci_reset_sync() returned the raw HCI status byte instead of a negative
  errno on error.  Add the bt_to_errno() conversion.
- qca_send_reset() used __hci_cmd_sync() which only checks transport-level
  errors and silently ignores a non-zero HCI status in the response.  The
  function is replaced by a call to the new __hci_reset_sync() which does
  the right conversion.
- qca_set_bdaddr() passed HCI_EV_VENDOR as the expected event type; the
  correct value is 0 (any), matching how other set_bdaddr callers behave.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
Zijun Hu (13):
      Bluetooth: btusb: Initialize @priv_size at declaration in btusb_probe()
      Bluetooth: btusb: Use & instead of == to test bitflag BTUSB_IGNORE
      Bluetooth: btusb: Record matched usb_device_id into btusb_data
      Bluetooth: btusb: QCA: Do not populate devcoredump fields on ATH3012 or QCA_ROME
      Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data
      Bluetooth: btusb: Fix BD_ADDR byte order in btusb_set_bdaddr_wcn6855()
      Bluetooth: hci_sync: Simplify hci_reset_sync()
      Bluetooth: hci_sync: Fix return value of hci_reset_sync()
      Bluetooth: hci_sync: Add __hci_reset_sync() for device driver
      Bluetooth: btusb: Simplify btusb_shutdown_qca() by using __hci_reset_sync()
      Bluetooth: btusb: Move struct btusb_data and macros into btusb.h
      Bluetooth: btqca: Fix undetected error HCI status in qca_send_reset()
      Bluetooth: btqca: Fix qca_set_bdaddr() using wrong HCI event type

 drivers/bluetooth/btqca.c        |  25 +----
 drivers/bluetooth/btusb.c        | 197 +++++++++------------------------------
 drivers/bluetooth/btusb.h        | 139 +++++++++++++++++++++++++++
 include/net/bluetooth/hci_sync.h |   1 +
 net/bluetooth/hci_sync.c         |  18 +++-
 5 files changed, 205 insertions(+), 175 deletions(-)
---
base-commit: cb20f6afc25b2b54c0fec61b45ac0ec9eb875d59
change-id: 20260622-bt_bugfix-fbb216ca1ff9

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


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

end of thread, other threads:[~2026-06-22 18:35 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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
2026-06-22 15:30   ` Dmitry Baryshkov
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 ` [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-22 14:52 ` [PATCH 05/13] Bluetooth: btusb: QCA: move qca_dump out of struct btusb_data Zijun Hu
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 ` [PATCH 07/13] Bluetooth: hci_sync: Simplify hci_reset_sync() Zijun Hu
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-22 14:52 ` [PATCH 09/13] Bluetooth: hci_sync: Add __hci_reset_sync() for device driver Zijun Hu
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 ` [PATCH 11/13] Bluetooth: btusb: Move struct btusb_data and macros into btusb.h Zijun Hu
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

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