Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Allow reset via sysfs

Allow sysfs to trigger hdev reset. This is required to recover devices
that are not responsive from userspace.

Signed-off-by: Hsin-chen Chuang <chharry@chromium.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Hsin-chen Chuang and committed by
Luiz Augusto von Dentz
0f8a0013 f07d4780

+19
+19
net/bluetooth/hci_sysfs.c
··· 90 90 module_put(THIS_MODULE); 91 91 } 92 92 93 + static ssize_t reset_store(struct device *dev, struct device_attribute *attr, 94 + const char *buf, size_t count) 95 + { 96 + struct hci_dev *hdev = to_hci_dev(dev); 97 + 98 + if (hdev->reset) 99 + hdev->reset(hdev); 100 + 101 + return count; 102 + } 103 + static DEVICE_ATTR_WO(reset); 104 + 105 + static struct attribute *bt_host_attrs[] = { 106 + &dev_attr_reset.attr, 107 + NULL, 108 + }; 109 + ATTRIBUTE_GROUPS(bt_host); 110 + 93 111 static const struct device_type bt_host = { 94 112 .name = "host", 95 113 .release = bt_host_release, 114 + .groups = bt_host_groups, 96 115 }; 97 116 98 117 void hci_init_sysfs(struct hci_dev *hdev)