Skip to content

Commit

Permalink
Bluetooth: Create root debugfs directory during module init
Browse files Browse the repository at this point in the history
Create the root Bluetooth debugfs directory during module init
and remove it on module exit.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Oct 18, 2013
1 parent 0153e2e commit ffcecac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 8 additions & 1 deletion net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/* Bluetooth address family and sockets. */

#include <linux/module.h>
#include <linux/debugfs.h>
#include <asm/ioctls.h>

#include <net/bluetooth/bluetooth.h>
Expand Down Expand Up @@ -708,12 +709,17 @@ static struct net_proto_family bt_sock_family_ops = {
.create = bt_sock_create,
};

struct dentry *bt_debugfs;
EXPORT_SYMBOL_GPL(bt_debugfs);

static int __init bt_init(void)
{
int err;

BT_INFO("Core ver %s", VERSION);

bt_debugfs = debugfs_create_dir("bluetooth", NULL);

err = bt_sysfs_init();
if (err < 0)
return err;
Expand Down Expand Up @@ -754,7 +760,6 @@ static int __init bt_init(void)

static void __exit bt_exit(void)
{

sco_exit();

l2cap_exit();
Expand All @@ -764,6 +769,8 @@ static void __exit bt_exit(void)
sock_unregister(PF_BLUETOOTH);

bt_sysfs_cleanup();

debugfs_remove_recursive(bt_debugfs);
}

subsys_initcall(bt_init);
Expand Down
8 changes: 0 additions & 8 deletions net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
/* Bluetooth HCI driver model support. */

#include <linux/debugfs.h>
#include <linux/module.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>

static struct class *bt_class;

struct dentry *bt_debugfs;
EXPORT_SYMBOL_GPL(bt_debugfs);

static inline char *link_typetostr(int type)
{
switch (type) {
Expand Down Expand Up @@ -426,8 +422,6 @@ void hci_del_sysfs(struct hci_dev *hdev)

int __init bt_sysfs_init(void)
{
bt_debugfs = debugfs_create_dir("bluetooth", NULL);

bt_class = class_create(THIS_MODULE, "bluetooth");

return PTR_ERR_OR_ZERO(bt_class);
Expand All @@ -436,6 +430,4 @@ int __init bt_sysfs_init(void)
void bt_sysfs_cleanup(void)
{
class_destroy(bt_class);

debugfs_remove_recursive(bt_debugfs);
}

0 comments on commit ffcecac

Please sign in to comment.