Skip to content

Commit 973bb97

Browse files
committed
Bluetooth: btintel: Add generic function for handling hardware errors
The handling of hardware error has support for providing a vendor specific callback to deal with the error. Move the Intel specific function out of the USB driver into the generic module so that it can also be utilized by the UART driver. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 20a7e25 commit 973bb97

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

‎drivers/bluetooth/btintel.c‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,40 @@ int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
8989
}
9090
EXPORT_SYMBOL_GPL(btintel_set_bdaddr);
9191

92+
void btintel_hw_error(struct hci_dev *hdev, u8 code)
93+
{
94+
struct sk_buff *skb;
95+
u8 type = 0x00;
96+
97+
BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code);
98+
99+
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
100+
if (IS_ERR(skb)) {
101+
BT_ERR("%s: Reset after hardware error failed (%ld)",
102+
hdev->name, PTR_ERR(skb));
103+
return;
104+
}
105+
kfree_skb(skb);
106+
107+
skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT);
108+
if (IS_ERR(skb)) {
109+
BT_ERR("%s: Retrieving Intel exception info failed (%ld)",
110+
hdev->name, PTR_ERR(skb));
111+
return;
112+
}
113+
114+
if (skb->len != 13) {
115+
BT_ERR("%s: Exception info size mismatch", hdev->name);
116+
kfree_skb(skb);
117+
return;
118+
}
119+
120+
BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1));
121+
122+
kfree_skb(skb);
123+
}
124+
EXPORT_SYMBOL_GPL(btintel_hw_error);
125+
92126
MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
93127
MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
94128
MODULE_VERSION(VERSION);

‎drivers/bluetooth/btintel.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct intel_secure_send_result {
7373

7474
int btintel_check_bdaddr(struct hci_dev *hdev);
7575
int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
76+
void btintel_hw_error(struct hci_dev *hdev, u8 code);
7677

7778
#else
7879

@@ -86,4 +87,8 @@ static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdadd
8687
return -EOPNOTSUPP;
8788
}
8889

90+
static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
91+
{
92+
}
93+
8994
#endif

0 commit comments

Comments
 (0)