diff options
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 0e8e1a59856c..463ffa4fe042 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -14,8 +14,6 @@ static struct class *bt_class; | |||
14 | struct dentry *bt_debugfs = NULL; | 14 | struct dentry *bt_debugfs = NULL; |
15 | EXPORT_SYMBOL_GPL(bt_debugfs); | 15 | EXPORT_SYMBOL_GPL(bt_debugfs); |
16 | 16 | ||
17 | static struct workqueue_struct *bt_workq; | ||
18 | |||
19 | static inline char *link_typetostr(int type) | 17 | static inline char *link_typetostr(int type) |
20 | { | 18 | { |
21 | switch (type) { | 19 | switch (type) { |
@@ -161,14 +159,14 @@ void hci_conn_add_sysfs(struct hci_conn *conn) | |||
161 | { | 159 | { |
162 | BT_DBG("conn %p", conn); | 160 | BT_DBG("conn %p", conn); |
163 | 161 | ||
164 | queue_work(bt_workq, &conn->work_add); | 162 | queue_work(conn->hdev->workqueue, &conn->work_add); |
165 | } | 163 | } |
166 | 164 | ||
167 | void hci_conn_del_sysfs(struct hci_conn *conn) | 165 | void hci_conn_del_sysfs(struct hci_conn *conn) |
168 | { | 166 | { |
169 | BT_DBG("conn %p", conn); | 167 | BT_DBG("conn %p", conn); |
170 | 168 | ||
171 | queue_work(bt_workq, &conn->work_del); | 169 | queue_work(conn->hdev->workqueue, &conn->work_del); |
172 | } | 170 | } |
173 | 171 | ||
174 | static inline char *host_bustostr(int bus) | 172 | static inline char *host_bustostr(int bus) |
@@ -283,11 +281,9 @@ static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *at | |||
283 | static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 281 | static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
284 | { | 282 | { |
285 | struct hci_dev *hdev = dev_get_drvdata(dev); | 283 | struct hci_dev *hdev = dev_get_drvdata(dev); |
286 | char *ptr; | 284 | unsigned long val; |
287 | __u32 val; | ||
288 | 285 | ||
289 | val = simple_strtoul(buf, &ptr, 10); | 286 | if (strict_strtoul(buf, 0, &val) < 0) |
290 | if (ptr == buf) | ||
291 | return -EINVAL; | 287 | return -EINVAL; |
292 | 288 | ||
293 | if (val != 0 && (val < 500 || val > 3600000)) | 289 | if (val != 0 && (val < 500 || val > 3600000)) |
@@ -307,11 +303,9 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribu | |||
307 | static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 303 | static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
308 | { | 304 | { |
309 | struct hci_dev *hdev = dev_get_drvdata(dev); | 305 | struct hci_dev *hdev = dev_get_drvdata(dev); |
310 | char *ptr; | 306 | unsigned long val; |
311 | __u16 val; | ||
312 | 307 | ||
313 | val = simple_strtoul(buf, &ptr, 10); | 308 | if (strict_strtoul(buf, 0, &val) < 0) |
314 | if (ptr == buf) | ||
315 | return -EINVAL; | 309 | return -EINVAL; |
316 | 310 | ||
317 | if (val < 0x0002 || val > 0xFFFE || val % 2) | 311 | if (val < 0x0002 || val > 0xFFFE || val % 2) |
@@ -334,11 +328,9 @@ static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribu | |||
334 | static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 328 | static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
335 | { | 329 | { |
336 | struct hci_dev *hdev = dev_get_drvdata(dev); | 330 | struct hci_dev *hdev = dev_get_drvdata(dev); |
337 | char *ptr; | 331 | unsigned long val; |
338 | __u16 val; | ||
339 | 332 | ||
340 | val = simple_strtoul(buf, &ptr, 10); | 333 | if (strict_strtoul(buf, 0, &val) < 0) |
341 | if (ptr == buf) | ||
342 | return -EINVAL; | 334 | return -EINVAL; |
343 | 335 | ||
344 | if (val < 0x0002 || val > 0xFFFE || val % 2) | 336 | if (val < 0x0002 || val > 0xFFFE || val % 2) |
@@ -487,17 +479,11 @@ void hci_unregister_sysfs(struct hci_dev *hdev) | |||
487 | 479 | ||
488 | int __init bt_sysfs_init(void) | 480 | int __init bt_sysfs_init(void) |
489 | { | 481 | { |
490 | bt_workq = create_singlethread_workqueue("bluetooth"); | ||
491 | if (!bt_workq) | ||
492 | return -ENOMEM; | ||
493 | |||
494 | bt_debugfs = debugfs_create_dir("bluetooth", NULL); | 482 | bt_debugfs = debugfs_create_dir("bluetooth", NULL); |
495 | 483 | ||
496 | bt_class = class_create(THIS_MODULE, "bluetooth"); | 484 | bt_class = class_create(THIS_MODULE, "bluetooth"); |
497 | if (IS_ERR(bt_class)) { | 485 | if (IS_ERR(bt_class)) |
498 | destroy_workqueue(bt_workq); | ||
499 | return PTR_ERR(bt_class); | 486 | return PTR_ERR(bt_class); |
500 | } | ||
501 | 487 | ||
502 | return 0; | 488 | return 0; |
503 | } | 489 | } |
@@ -507,6 +493,4 @@ void bt_sysfs_cleanup(void) | |||
507 | class_destroy(bt_class); | 493 | class_destroy(bt_class); |
508 | 494 | ||
509 | debugfs_remove_recursive(bt_debugfs); | 495 | debugfs_remove_recursive(bt_debugfs); |
510 | |||
511 | destroy_workqueue(bt_workq); | ||
512 | } | 496 | } |