aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-07-05 08:37:38 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-07-23 11:10:49 -0400
commit973bb97e5aee56edddaae3d5c96877101ad509c0 (patch)
tree3d8a8496a0e1a55912ebee5874bb4d66456a076a /drivers/bluetooth
parent20a7e25f4ee173785fded331d2af4b68b1ef5921 (diff)
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>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btintel.c34
-rw-r--r--drivers/bluetooth/btintel.h5
2 files changed, 39 insertions, 0 deletions
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 828f2f8d1568..8b160858f7e8 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -89,6 +89,40 @@ int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
89} 89}
90EXPORT_SYMBOL_GPL(btintel_set_bdaddr); 90EXPORT_SYMBOL_GPL(btintel_set_bdaddr);
91 91
92void 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}
124EXPORT_SYMBOL_GPL(btintel_hw_error);
125
92MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); 126MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
93MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION); 127MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
94MODULE_VERSION(VERSION); 128MODULE_VERSION(VERSION);
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index 4bda6ab34f60..c4680cd44011 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -73,6 +73,7 @@ struct intel_secure_send_result {
73 73
74int btintel_check_bdaddr(struct hci_dev *hdev); 74int btintel_check_bdaddr(struct hci_dev *hdev);
75int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); 75int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
76void btintel_hw_error(struct hci_dev *hdev, u8 code);
76 77
77#else 78#else
78 79
@@ -86,4 +87,8 @@ static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdadd
86 return -EOPNOTSUPP; 87 return -EOPNOTSUPP;
87} 88}
88 89
90static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
91{
92}
93
89#endif 94#endif