aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h3
-rw-r--r--net/bluetooth/hci_core.c21
-rw-r--r--net/bluetooth/hci_event.c4
3 files changed, 27 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 0f5e59f1e3cb..1780f1681ecf 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -232,6 +232,7 @@ struct hci_dev {
232 __u16 conn_info_min_age; 232 __u16 conn_info_min_age;
233 __u16 conn_info_max_age; 233 __u16 conn_info_max_age;
234 __u8 ssp_debug_mode; 234 __u8 ssp_debug_mode;
235 __u8 hw_error_code;
235 __u32 clock; 236 __u32 clock;
236 237
237 __u16 devid_source; 238 __u16 devid_source;
@@ -293,6 +294,7 @@ struct hci_dev {
293 294
294 struct work_struct power_on; 295 struct work_struct power_on;
295 struct delayed_work power_off; 296 struct delayed_work power_off;
297 struct work_struct error_reset;
296 298
297 __u16 discov_timeout; 299 __u16 discov_timeout;
298 struct delayed_work discov_off; 300 struct delayed_work discov_off;
@@ -369,6 +371,7 @@ struct hci_dev {
369 int (*setup)(struct hci_dev *hdev); 371 int (*setup)(struct hci_dev *hdev);
370 int (*send)(struct hci_dev *hdev, struct sk_buff *skb); 372 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
371 void (*notify)(struct hci_dev *hdev, unsigned int evt); 373 void (*notify)(struct hci_dev *hdev, unsigned int evt);
374 void (*hw_error)(struct hci_dev *hdev, u8 code);
372 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr); 375 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
373}; 376};
374 377
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d4c9152474a9..79693a9ef4eb 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2151,6 +2151,26 @@ static void hci_power_off(struct work_struct *work)
2151 smp_unregister(hdev); 2151 smp_unregister(hdev);
2152} 2152}
2153 2153
2154static void hci_error_reset(struct work_struct *work)
2155{
2156 struct hci_dev *hdev = container_of(work, struct hci_dev, error_reset);
2157
2158 BT_DBG("%s", hdev->name);
2159
2160 if (hdev->hw_error)
2161 hdev->hw_error(hdev, hdev->hw_error_code);
2162 else
2163 BT_ERR("%s hardware error 0x%2.2x", hdev->name,
2164 hdev->hw_error_code);
2165
2166 if (hci_dev_do_close(hdev))
2167 return;
2168
2169 smp_unregister(hdev);
2170
2171 hci_dev_do_open(hdev);
2172}
2173
2154static void hci_discov_off(struct work_struct *work) 2174static void hci_discov_off(struct work_struct *work)
2155{ 2175{
2156 struct hci_dev *hdev; 2176 struct hci_dev *hdev;
@@ -2943,6 +2963,7 @@ struct hci_dev *hci_alloc_dev(void)
2943 INIT_WORK(&hdev->cmd_work, hci_cmd_work); 2963 INIT_WORK(&hdev->cmd_work, hci_cmd_work);
2944 INIT_WORK(&hdev->tx_work, hci_tx_work); 2964 INIT_WORK(&hdev->tx_work, hci_tx_work);
2945 INIT_WORK(&hdev->power_on, hci_power_on); 2965 INIT_WORK(&hdev->power_on, hci_power_on);
2966 INIT_WORK(&hdev->error_reset, hci_error_reset);
2946 2967
2947 INIT_DELAYED_WORK(&hdev->power_off, hci_power_off); 2968 INIT_DELAYED_WORK(&hdev->power_off, hci_power_off);
2948 INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off); 2969 INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4175470ff48e..a72a5f50728d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3100,7 +3100,9 @@ static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb)
3100{ 3100{
3101 struct hci_ev_hardware_error *ev = (void *) skb->data; 3101 struct hci_ev_hardware_error *ev = (void *) skb->data;
3102 3102
3103 BT_ERR("%s hardware error 0x%2.2x", hdev->name, ev->code); 3103 hdev->hw_error_code = ev->code;
3104
3105 queue_work(hdev->req_workqueue, &hdev->error_reset);
3104} 3106}
3105 3107
3106static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 3108static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb)