Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdc3e0f1 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg
Browse files

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent ffcecac6
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -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);
int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);


void hci_init_sysfs(struct hci_dev *hdev);
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_init_sysfs(struct hci_conn *conn);
void hci_conn_add_sysfs(struct hci_conn *conn);
void hci_conn_add_sysfs(struct hci_conn *conn);
void hci_conn_del_sysfs(struct hci_conn *conn);
void hci_conn_del_sysfs(struct hci_conn *conn);
+4 −2
Original line number Original line Diff line number Diff line
@@ -2482,7 +2482,9 @@ int hci_register_dev(struct hci_dev *hdev)
	if (!IS_ERR_OR_NULL(bt_debugfs))
	if (!IS_ERR_OR_NULL(bt_debugfs))
		hdev->debugfs = debugfs_create_dir(hdev->name, 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)
	if (error < 0)
		goto err_wqueue;
		goto err_wqueue;


@@ -2570,7 +2572,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
		rfkill_destroy(hdev->rfkill);
		rfkill_destroy(hdev->rfkill);
	}
	}


	hci_del_sysfs(hdev);
	device_del(&hdev->dev);


	debugfs_remove_recursive(hdev->debugfs);
	debugfs_remove_recursive(hdev->debugfs);


+0 −18
Original line number Original line Diff line number Diff line
@@ -402,24 +402,6 @@ void hci_init_sysfs(struct hci_dev *hdev)
	device_initialize(dev);
	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)
int __init bt_sysfs_init(void)
{
{
	bt_class = class_create(THIS_MODULE, "bluetooth");
	bt_class = class_create(THIS_MODULE, "bluetooth");