Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* Bluetooth HCI driver model support. */ |
| 2 | |
Paul Gortmaker | 3a9a231 | 2011-05-27 09:12:25 -0400 | [diff] [blame] | 3 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #include <net/bluetooth/bluetooth.h> |
| 6 | #include <net/bluetooth/hci_core.h> |
| 7 | |
Marcel Holtmann | aef7d97 | 2010-03-21 05:27:45 +0100 | [diff] [blame] | 8 | static struct class *bt_class; |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 9 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 10 | static inline char *link_typetostr(int type) |
| 11 | { |
| 12 | switch (type) { |
| 13 | case ACL_LINK: |
| 14 | return "ACL"; |
| 15 | case SCO_LINK: |
| 16 | return "SCO"; |
| 17 | case ESCO_LINK: |
| 18 | return "eSCO"; |
Peter Hurley | 21061df | 2011-08-24 10:04:56 -0400 | [diff] [blame] | 19 | case LE_LINK: |
| 20 | return "LE"; |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 21 | default: |
| 22 | return "UNKNOWN"; |
| 23 | } |
| 24 | } |
| 25 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 26 | static ssize_t show_link_type(struct device *dev, |
| 27 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 28 | { |
David Herrmann | 3dc0732 | 2012-02-09 21:58:33 +0100 | [diff] [blame] | 29 | struct hci_conn *conn = to_hci_conn(dev); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 30 | return sprintf(buf, "%s\n", link_typetostr(conn->type)); |
| 31 | } |
| 32 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 33 | static ssize_t show_link_address(struct device *dev, |
| 34 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 35 | { |
David Herrmann | 3dc0732 | 2012-02-09 21:58:33 +0100 | [diff] [blame] | 36 | struct hci_conn *conn = to_hci_conn(dev); |
Andrei Emeltchenko | fcb7333 | 2012-09-25 12:49:44 +0300 | [diff] [blame] | 37 | return sprintf(buf, "%pMR\n", &conn->dst); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 38 | } |
| 39 | |
Gustavo F. Padovan | 602f988 | 2011-02-17 19:22:19 -0300 | [diff] [blame] | 40 | #define LINK_ATTR(_name, _mode, _show, _store) \ |
| 41 | struct device_attribute link_attr_##_name = __ATTR(_name, _mode, _show, _store) |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 42 | |
| 43 | static LINK_ATTR(type, S_IRUGO, show_link_type, NULL); |
| 44 | static LINK_ATTR(address, S_IRUGO, show_link_address, NULL); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 45 | |
| 46 | static struct attribute *bt_link_attrs[] = { |
| 47 | &link_attr_type.attr, |
| 48 | &link_attr_address.attr, |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 49 | NULL |
| 50 | }; |
| 51 | |
| 52 | static struct attribute_group bt_link_group = { |
| 53 | .attrs = bt_link_attrs, |
| 54 | }; |
| 55 | |
David Brownell | a4dbd67 | 2009-06-24 10:06:31 -0700 | [diff] [blame] | 56 | static const struct attribute_group *bt_link_groups[] = { |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 57 | &bt_link_group, |
| 58 | NULL |
| 59 | }; |
| 60 | |
| 61 | static void bt_link_release(struct device *dev) |
| 62 | { |
David Herrmann | 2dd1068 | 2012-02-09 21:58:34 +0100 | [diff] [blame] | 63 | struct hci_conn *conn = to_hci_conn(dev); |
| 64 | kfree(conn); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | static struct device_type bt_link = { |
| 68 | .name = "link", |
| 69 | .groups = bt_link_groups, |
| 70 | .release = bt_link_release, |
| 71 | }; |
| 72 | |
Gustavo F. Padovan | 6d438e3 | 2011-12-17 18:53:02 -0200 | [diff] [blame] | 73 | /* |
| 74 | * The rfcomm tty device will possibly retain even when conn |
| 75 | * is down, and sysfs doesn't support move zombie device, |
| 76 | * so we should move the device before conn device is destroyed. |
| 77 | */ |
| 78 | static int __match_tty(struct device *dev, void *data) |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 79 | { |
Gustavo F. Padovan | 6d438e3 | 2011-12-17 18:53:02 -0200 | [diff] [blame] | 80 | return !strncmp(dev_name(dev), "rfcomm", 6); |
| 81 | } |
| 82 | |
| 83 | void hci_conn_init_sysfs(struct hci_conn *conn) |
| 84 | { |
Marcel Holtmann | 457ca7b | 2009-05-05 13:09:01 -0700 | [diff] [blame] | 85 | struct hci_dev *hdev = conn->hdev; |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 86 | |
Gustavo F. Padovan | 6d438e3 | 2011-12-17 18:53:02 -0200 | [diff] [blame] | 87 | BT_DBG("conn %p", conn); |
| 88 | |
| 89 | conn->dev.type = &bt_link; |
| 90 | conn->dev.class = bt_class; |
| 91 | conn->dev.parent = &hdev->dev; |
| 92 | |
| 93 | device_initialize(&conn->dev); |
| 94 | } |
| 95 | |
| 96 | void hci_conn_add_sysfs(struct hci_conn *conn) |
| 97 | { |
| 98 | struct hci_dev *hdev = conn->hdev; |
| 99 | |
| 100 | BT_DBG("conn %p", conn); |
| 101 | |
Marcel Holtmann | 457ca7b | 2009-05-05 13:09:01 -0700 | [diff] [blame] | 102 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); |
| 103 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 104 | if (device_add(&conn->dev) < 0) { |
| 105 | BT_ERR("Failed to register connection device"); |
| 106 | return; |
| 107 | } |
Marcel Holtmann | 384943e | 2009-05-08 18:20:43 -0700 | [diff] [blame] | 108 | |
| 109 | hci_dev_hold(hdev); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 110 | } |
| 111 | |
Gustavo F. Padovan | 6d438e3 | 2011-12-17 18:53:02 -0200 | [diff] [blame] | 112 | void hci_conn_del_sysfs(struct hci_conn *conn) |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 113 | { |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 114 | struct hci_dev *hdev = conn->hdev; |
| 115 | |
Marcel Holtmann | a67e899 | 2009-05-02 18:24:06 -0700 | [diff] [blame] | 116 | if (!device_is_registered(&conn->dev)) |
| 117 | return; |
Roger Quadros | f3784d8 | 2009-04-23 14:50:54 +0300 | [diff] [blame] | 118 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 119 | while (1) { |
| 120 | struct device *dev; |
| 121 | |
| 122 | dev = device_find_child(&conn->dev, NULL, __match_tty); |
| 123 | if (!dev) |
| 124 | break; |
Cornelia Huck | ffa6a70 | 2009-03-04 12:44:00 +0100 | [diff] [blame] | 125 | device_move(dev, NULL, DPM_ORDER_DEV_LAST); |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 126 | put_device(dev); |
| 127 | } |
| 128 | |
| 129 | device_del(&conn->dev); |
Marcel Holtmann | 384943e | 2009-05-08 18:20:43 -0700 | [diff] [blame] | 130 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 131 | hci_dev_put(hdev); |
| 132 | } |
| 133 | |
Marcel Holtmann | c13854c | 2010-02-08 15:27:07 +0100 | [diff] [blame] | 134 | static inline char *host_bustostr(int bus) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | { |
Marcel Holtmann | c13854c | 2010-02-08 15:27:07 +0100 | [diff] [blame] | 136 | switch (bus) { |
Marcel Holtmann | 0ac5393 | 2006-07-08 13:57:15 +0200 | [diff] [blame] | 137 | case HCI_VIRTUAL: |
Marcel Holtmann | 4d0eb00 | 2006-07-06 12:34:41 +0200 | [diff] [blame] | 138 | return "VIRTUAL"; |
| 139 | case HCI_USB: |
| 140 | return "USB"; |
| 141 | case HCI_PCCARD: |
| 142 | return "PCCARD"; |
| 143 | case HCI_UART: |
| 144 | return "UART"; |
| 145 | case HCI_RS232: |
| 146 | return "RS232"; |
| 147 | case HCI_PCI: |
| 148 | return "PCI"; |
Marcel Holtmann | 0ac5393 | 2006-07-08 13:57:15 +0200 | [diff] [blame] | 149 | case HCI_SDIO: |
| 150 | return "SDIO"; |
Marcel Holtmann | 4d0eb00 | 2006-07-06 12:34:41 +0200 | [diff] [blame] | 151 | default: |
| 152 | return "UNKNOWN"; |
| 153 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 156 | static inline char *host_typetostr(int type) |
| 157 | { |
| 158 | switch (type) { |
| 159 | case HCI_BREDR: |
| 160 | return "BR/EDR"; |
David Vrabel | 8f1e174 | 2010-08-09 17:38:10 -0400 | [diff] [blame] | 161 | case HCI_AMP: |
| 162 | return "AMP"; |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 163 | default: |
| 164 | return "UNKNOWN"; |
| 165 | } |
| 166 | } |
| 167 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 168 | static ssize_t show_bus(struct device *dev, |
| 169 | struct device_attribute *attr, char *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 171 | struct hci_dev *hdev = to_hci_dev(dev); |
Marcel Holtmann | c13854c | 2010-02-08 15:27:07 +0100 | [diff] [blame] | 172 | return sprintf(buf, "%s\n", host_bustostr(hdev->bus)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 175 | static ssize_t show_type(struct device *dev, |
| 176 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 177 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 178 | struct hci_dev *hdev = to_hci_dev(dev); |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 179 | return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type)); |
| 180 | } |
| 181 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 182 | static ssize_t show_name(struct device *dev, |
| 183 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 184 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 185 | struct hci_dev *hdev = to_hci_dev(dev); |
Johan Hedberg | 1f6c637 | 2011-03-16 14:29:35 +0200 | [diff] [blame] | 186 | char name[HCI_MAX_NAME_LENGTH + 1]; |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 187 | int i; |
| 188 | |
Johan Hedberg | 1f6c637 | 2011-03-16 14:29:35 +0200 | [diff] [blame] | 189 | for (i = 0; i < HCI_MAX_NAME_LENGTH; i++) |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 190 | name[i] = hdev->dev_name[i]; |
| 191 | |
Johan Hedberg | 1f6c637 | 2011-03-16 14:29:35 +0200 | [diff] [blame] | 192 | name[HCI_MAX_NAME_LENGTH] = '\0'; |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 193 | return sprintf(buf, "%s\n", name); |
| 194 | } |
| 195 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 196 | static ssize_t show_class(struct device *dev, |
| 197 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 198 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 199 | struct hci_dev *hdev = to_hci_dev(dev); |
Gustavo Padovan | 8fc9ced | 2012-05-23 04:04:21 -0300 | [diff] [blame] | 200 | return sprintf(buf, "0x%.2x%.2x%.2x\n", hdev->dev_class[2], |
| 201 | hdev->dev_class[1], hdev->dev_class[0]); |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 202 | } |
| 203 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 204 | static ssize_t show_address(struct device *dev, |
| 205 | struct device_attribute *attr, char *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 207 | struct hci_dev *hdev = to_hci_dev(dev); |
Andrei Emeltchenko | fcb7333 | 2012-09-25 12:49:44 +0300 | [diff] [blame] | 208 | return sprintf(buf, "%pMR\n", &hdev->bdaddr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | } |
| 210 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 211 | static ssize_t show_manufacturer(struct device *dev, |
| 212 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 213 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 214 | struct hci_dev *hdev = to_hci_dev(dev); |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 215 | return sprintf(buf, "%d\n", hdev->manufacturer); |
| 216 | } |
| 217 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 218 | static ssize_t show_hci_version(struct device *dev, |
| 219 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 220 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 221 | struct hci_dev *hdev = to_hci_dev(dev); |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 222 | return sprintf(buf, "%d\n", hdev->hci_ver); |
| 223 | } |
| 224 | |
Gustavo Padovan | b80f021 | 2012-05-17 00:36:23 -0300 | [diff] [blame] | 225 | static ssize_t show_hci_revision(struct device *dev, |
| 226 | struct device_attribute *attr, char *buf) |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 227 | { |
David Herrmann | aa2b86d | 2012-02-09 21:58:30 +0100 | [diff] [blame] | 228 | struct hci_dev *hdev = to_hci_dev(dev); |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 229 | return sprintf(buf, "%d\n", hdev->hci_rev); |
| 230 | } |
| 231 | |
Marcel Holtmann | c13854c | 2010-02-08 15:27:07 +0100 | [diff] [blame] | 232 | static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL); |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 233 | static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); |
Marcel Holtmann | a9de924 | 2007-10-20 13:33:56 +0200 | [diff] [blame] | 234 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
| 235 | static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); |
Marcel Holtmann | a91f2e3 | 2006-07-03 10:02:41 +0200 | [diff] [blame] | 236 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); |
Marcel Holtmann | 1143e5a | 2006-09-23 09:57:20 +0200 | [diff] [blame] | 237 | static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL); |
| 238 | static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL); |
| 239 | static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 241 | static struct attribute *bt_host_attrs[] = { |
Marcel Holtmann | c13854c | 2010-02-08 15:27:07 +0100 | [diff] [blame] | 242 | &dev_attr_bus.attr, |
Marcel Holtmann | 943da25 | 2010-02-13 02:28:41 +0100 | [diff] [blame] | 243 | &dev_attr_type.attr, |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 244 | &dev_attr_name.attr, |
| 245 | &dev_attr_class.attr, |
| 246 | &dev_attr_address.attr, |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 247 | &dev_attr_manufacturer.attr, |
| 248 | &dev_attr_hci_version.attr, |
| 249 | &dev_attr_hci_revision.attr, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | NULL |
| 251 | }; |
| 252 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 253 | static struct attribute_group bt_host_group = { |
| 254 | .attrs = bt_host_attrs, |
| 255 | }; |
Marcel Holtmann | b219e3a | 2006-07-06 12:38:46 +0200 | [diff] [blame] | 256 | |
David Brownell | a4dbd67 | 2009-06-24 10:06:31 -0700 | [diff] [blame] | 257 | static const struct attribute_group *bt_host_groups[] = { |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 258 | &bt_host_group, |
Marcel Holtmann | b219e3a | 2006-07-06 12:38:46 +0200 | [diff] [blame] | 259 | NULL |
| 260 | }; |
| 261 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 262 | static void bt_host_release(struct device *dev) |
Marcel Holtmann | a91f2e3 | 2006-07-03 10:02:41 +0200 | [diff] [blame] | 263 | { |
David Herrmann | 2dd1068 | 2012-02-09 21:58:34 +0100 | [diff] [blame] | 264 | struct hci_dev *hdev = to_hci_dev(dev); |
| 265 | kfree(hdev); |
David Herrmann | 46e0653 | 2012-01-07 15:47:21 +0100 | [diff] [blame] | 266 | module_put(THIS_MODULE); |
Marcel Holtmann | b219e3a | 2006-07-06 12:38:46 +0200 | [diff] [blame] | 267 | } |
| 268 | |
Marcel Holtmann | 90855d7 | 2008-08-18 13:23:53 +0200 | [diff] [blame] | 269 | static struct device_type bt_host = { |
| 270 | .name = "host", |
| 271 | .groups = bt_host_groups, |
| 272 | .release = bt_host_release, |
| 273 | }; |
Marcel Holtmann | a91f2e3 | 2006-07-03 10:02:41 +0200 | [diff] [blame] | 274 | |
David Herrmann | 0ac7e70 | 2011-10-08 14:58:47 +0200 | [diff] [blame] | 275 | void hci_init_sysfs(struct hci_dev *hdev) |
| 276 | { |
| 277 | struct device *dev = &hdev->dev; |
| 278 | |
| 279 | dev->type = &bt_host; |
| 280 | dev->class = bt_class; |
| 281 | |
David Herrmann | 46e0653 | 2012-01-07 15:47:21 +0100 | [diff] [blame] | 282 | __module_get(THIS_MODULE); |
David Herrmann | 0ac7e70 | 2011-10-08 14:58:47 +0200 | [diff] [blame] | 283 | device_initialize(dev); |
| 284 | } |
| 285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | int __init bt_sysfs_init(void) |
| 287 | { |
Marcel Holtmann | a91f2e3 | 2006-07-03 10:02:41 +0200 | [diff] [blame] | 288 | bt_class = class_create(THIS_MODULE, "bluetooth"); |
Marcel Holtmann | 27d3528 | 2006-07-03 10:02:37 +0200 | [diff] [blame] | 289 | |
Rusty Russell | 8c6ffba | 2013-07-15 11:20:32 +0930 | [diff] [blame] | 290 | return PTR_ERR_OR_ZERO(bt_class); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Arnaud Patard | 860e13b | 2006-09-28 15:29:37 -0700 | [diff] [blame] | 293 | void bt_sysfs_cleanup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | { |
Marcel Holtmann | a91f2e3 | 2006-07-03 10:02:41 +0200 | [diff] [blame] | 295 | class_destroy(bt_class); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | } |