Bluetooth: Move device_add handling into hci_register_dev
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 18 Oct 2013 00:24:19 +0000 (17:24 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 18 Oct 2013 07:46:54 +0000 (10:46 +0300)
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>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c
net/bluetooth/hci_sysfs.c

index c6becda8c4667e48268b5ae51b8c39e11370f0f6..9b5db01bd1a2a6fa69641d4b80e28ec9db596008 100644 (file)
@@ -768,8 +768,6 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
 int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
 
 void hci_init_sysfs(struct hci_dev *hdev);
-int hci_add_sysfs(struct hci_dev *hdev);
-void hci_del_sysfs(struct hci_dev *hdev);
 void hci_conn_init_sysfs(struct hci_conn *conn);
 void hci_conn_add_sysfs(struct hci_conn *conn);
 void hci_conn_del_sysfs(struct hci_conn *conn);
index f7ba81885b42007fd7068776cc9c88ba6a64ddb7..940da800f5c330da33b286d661846c6e7ef54989 100644 (file)
@@ -2482,7 +2482,9 @@ int hci_register_dev(struct hci_dev *hdev)
        if (!IS_ERR_OR_NULL(bt_debugfs))
                hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
 
-       error = hci_add_sysfs(hdev);
+       dev_set_name(&hdev->dev, "%s", hdev->name);
+
+       error = device_add(&hdev->dev);
        if (error < 0)
                goto err_wqueue;
 
@@ -2570,7 +2572,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
                rfkill_destroy(hdev->rfkill);
        }
 
-       hci_del_sysfs(hdev);
+       device_del(&hdev->dev);
 
        debugfs_remove_recursive(hdev->debugfs);
 
index 320a7611825275c690f0e8007647830720f1c0c7..9cbf8fefb0440307337eb44d31647ac294b9df44 100644 (file)
@@ -402,24 +402,6 @@ void hci_init_sysfs(struct hci_dev *hdev)
        device_initialize(dev);
 }
 
-int hci_add_sysfs(struct hci_dev *hdev)
-{
-       struct device *dev = &hdev->dev;
-
-       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
-
-       dev_set_name(dev, "%s", hdev->name);
-
-       return device_add(dev);
-}
-
-void hci_del_sysfs(struct hci_dev *hdev)
-{
-       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
-
-       device_del(&hdev->dev);
-}
-
 int __init bt_sysfs_init(void)
 {
        bt_class = class_create(THIS_MODULE, "bluetooth");