diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-17 20:24:19 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-18 03:46:54 -0400 |
commit | bdc3e0f1d2019fbf89f150ed98860b1a7a762fe9 (patch) | |
tree | 8342c38bc031b2287f2934be740c6991feea5069 | |
parent | ffcecac6a7380af84d4c1d676a6c3c524d31eeda (diff) |
Bluetooth: Move device_add handling into hci_register_dev
The device_add handling can be done directly in hci_register_dev and
device_remove within hci_unregister_dev.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 2 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 18 |
3 files changed, 4 insertions, 22 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index c6becda8c466..9b5db01bd1a2 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -768,8 +768,6 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); | |||
768 | int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); | 768 | int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); |
769 | 769 | ||
770 | void hci_init_sysfs(struct hci_dev *hdev); | 770 | void hci_init_sysfs(struct hci_dev *hdev); |
771 | int hci_add_sysfs(struct hci_dev *hdev); | ||
772 | void hci_del_sysfs(struct hci_dev *hdev); | ||
773 | void hci_conn_init_sysfs(struct hci_conn *conn); | 771 | void hci_conn_init_sysfs(struct hci_conn *conn); |
774 | void hci_conn_add_sysfs(struct hci_conn *conn); | 772 | void hci_conn_add_sysfs(struct hci_conn *conn); |
775 | void hci_conn_del_sysfs(struct hci_conn *conn); | 773 | void hci_conn_del_sysfs(struct hci_conn *conn); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f7ba81885b42..940da800f5c3 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2482,7 +2482,9 @@ int hci_register_dev(struct hci_dev *hdev) | |||
2482 | if (!IS_ERR_OR_NULL(bt_debugfs)) | 2482 | if (!IS_ERR_OR_NULL(bt_debugfs)) |
2483 | hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); | 2483 | hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); |
2484 | 2484 | ||
2485 | error = hci_add_sysfs(hdev); | 2485 | dev_set_name(&hdev->dev, "%s", hdev->name); |
2486 | |||
2487 | error = device_add(&hdev->dev); | ||
2486 | if (error < 0) | 2488 | if (error < 0) |
2487 | goto err_wqueue; | 2489 | goto err_wqueue; |
2488 | 2490 | ||
@@ -2570,7 +2572,7 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
2570 | rfkill_destroy(hdev->rfkill); | 2572 | rfkill_destroy(hdev->rfkill); |
2571 | } | 2573 | } |
2572 | 2574 | ||
2573 | hci_del_sysfs(hdev); | 2575 | device_del(&hdev->dev); |
2574 | 2576 | ||
2575 | debugfs_remove_recursive(hdev->debugfs); | 2577 | debugfs_remove_recursive(hdev->debugfs); |
2576 | 2578 | ||
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 320a76118252..9cbf8fefb044 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -402,24 +402,6 @@ void hci_init_sysfs(struct hci_dev *hdev) | |||
402 | device_initialize(dev); | 402 | device_initialize(dev); |
403 | } | 403 | } |
404 | 404 | ||
405 | int hci_add_sysfs(struct hci_dev *hdev) | ||
406 | { | ||
407 | struct device *dev = &hdev->dev; | ||
408 | |||
409 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | ||
410 | |||
411 | dev_set_name(dev, "%s", hdev->name); | ||
412 | |||
413 | return device_add(dev); | ||
414 | } | ||
415 | |||
416 | void hci_del_sysfs(struct hci_dev *hdev) | ||
417 | { | ||
418 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | ||
419 | |||
420 | device_del(&hdev->dev); | ||
421 | } | ||
422 | |||
423 | int __init bt_sysfs_init(void) | 405 | int __init bt_sysfs_init(void) |
424 | { | 406 | { |
425 | bt_class = class_create(THIS_MODULE, "bluetooth"); | 407 | bt_class = class_create(THIS_MODULE, "bluetooth"); |