Bluetooth: btusb: Add btusb devcoredump support
authorManish Mandlik <mmandlik@google.com>
Thu, 30 Mar 2023 16:58:25 +0000 (09:58 -0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 24 Apr 2023 04:58:46 +0000 (21:58 -0700)
This patch implements the btusb driver side .coredump() callback to
trigger a devcoredump via sysfs.

Signed-off-by: Manish Mandlik <mmandlik@google.com>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btusb.c

index 9bf1d4e..498e131 100644 (file)
@@ -4397,6 +4397,17 @@ done:
 }
 #endif
 
+#ifdef CONFIG_DEV_COREDUMP
+static void btusb_coredump(struct device *dev)
+{
+       struct btusb_data *data = dev_get_drvdata(dev);
+       struct hci_dev *hdev = data->hdev;
+
+       if (hdev->dump.coredump)
+               hdev->dump.coredump(hdev);
+}
+#endif
+
 static struct usb_driver btusb_driver = {
        .name           = "btusb",
        .probe          = btusb_probe,
@@ -4408,6 +4419,14 @@ static struct usb_driver btusb_driver = {
        .id_table       = btusb_table,
        .supports_autosuspend = 1,
        .disable_hub_initiated_lpm = 1,
+
+#ifdef CONFIG_DEV_COREDUMP
+       .drvwrap = {
+               .driver = {
+                       .coredump = btusb_coredump,
+               },
+       },
+#endif
 };
 
 module_usb_driver(btusb_driver);