Bluetooth: hci_core: Introduce __hci_reset_dev() with a hardware error code

hci_reset_dev() injects a constant hardware error code 0x00 to restart
the device. But a transport driver may need a different error code.

Fix by introducing __hci_reset_dev(hdev, hw_err_code), which will be
used by a follow-up patch.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Zijun Hu 2026-08-01 23:31:39 -07:00 committed by Luiz Augusto von Dentz
parent 8824e13fb5
commit e6997c120c
2 changed files with 10 additions and 4 deletions

View File

@ -1785,7 +1785,13 @@ int hci_register_suspend_notifier(struct hci_dev *hdev);
int hci_unregister_suspend_notifier(struct hci_dev *hdev);
int hci_suspend_dev(struct hci_dev *hdev);
int hci_resume_dev(struct hci_dev *hdev);
int hci_reset_dev(struct hci_dev *hdev);
int __hci_reset_dev(struct hci_dev *hdev, u8 hw_err_code);
static inline int hci_reset_dev(struct hci_dev *hdev)
{
return __hci_reset_dev(hdev, 0);
}
int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb);
__printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...);

View File

@ -2852,9 +2852,9 @@ int hci_resume_dev(struct hci_dev *hdev)
EXPORT_SYMBOL(hci_resume_dev);
/* Reset HCI device */
int hci_reset_dev(struct hci_dev *hdev)
int __hci_reset_dev(struct hci_dev *hdev, u8 hw_err_code)
{
static const u8 hw_err[] = { HCI_EV_HARDWARE_ERROR, 0x01, 0x00 };
const u8 hw_err[] = { HCI_EV_HARDWARE_ERROR, 0x01, hw_err_code };
struct sk_buff *skb;
skb = bt_skb_alloc(3, GFP_ATOMIC);
@ -2869,7 +2869,7 @@ int hci_reset_dev(struct hci_dev *hdev)
/* Send Hardware Error to upper stack */
return hci_recv_frame(hdev, skb);
}
EXPORT_SYMBOL(hci_reset_dev);
EXPORT_SYMBOL(__hci_reset_dev);
static u8 hci_dev_classify_pkt_type(struct hci_dev *hdev, struct sk_buff *skb)
{