]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Bluetooth: Allow driver specific cmd timeout handling
authorRajat Jain <rajatja@google.com>
Thu, 24 Jan 2019 23:28:13 +0000 (15:28 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 25 Jan 2019 07:46:32 +0000 (08:46 +0100)
Add a hook to allow the BT driver to do device or command specific
handling in case of timeouts. This is to be used by Intel driver to
reset the device after certain number of timeouts.

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index e5ea633ea36880176ac608e20570f46f455c35d2..094e61e07030f5f5418f1aae008db4c00e7ee1f3 100644 (file)
@@ -437,6 +437,7 @@ struct hci_dev {
        int (*post_init)(struct hci_dev *hdev);
        int (*set_diag)(struct hci_dev *hdev, bool enable);
        int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
+       void (*cmd_timeout)(struct hci_dev *hdev);
 };
 
 #define HCI_PHY_HANDLE(handle) (handle & 0xff)
index 7352fe85674be5c3e73ef50ca3702caec7a69e6c..75793265ba9ec3184c18f0ed100a86722cc2a8cb 100644 (file)
@@ -2578,6 +2578,9 @@ static void hci_cmd_timeout(struct work_struct *work)
                bt_dev_err(hdev, "command tx timeout");
        }
 
+       if (hdev->cmd_timeout)
+               hdev->cmd_timeout(hdev);
+
        atomic_set(&hdev->cmd_cnt, 1);
        queue_work(hdev->workqueue, &hdev->cmd_work);
 }