aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-17 20:24:18 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-18 03:46:27 -0400
commitffcecac6a7380af84d4c1d676a6c3c524d31eeda (patch)
tree5babc43092e683cfbeedf6240f474058c4edd23c
parent0153e2ecab657be17aaecca234b29c1154a98202 (diff)
Bluetooth: Create root debugfs directory during module init
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>
-rw-r--r--net/bluetooth/af_bluetooth.c9
-rw-r--r--net/bluetooth/hci_sysfs.c8
2 files changed, 8 insertions, 9 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 1f1a1118f489..f6a1671ea2ff 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -25,6 +25,7 @@
25/* Bluetooth address family and sockets. */ 25/* Bluetooth address family and sockets. */
26 26
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/debugfs.h>
28#include <asm/ioctls.h> 29#include <asm/ioctls.h>
29 30
30#include <net/bluetooth/bluetooth.h> 31#include <net/bluetooth/bluetooth.h>
@@ -708,12 +709,17 @@ static struct net_proto_family bt_sock_family_ops = {
708 .create = bt_sock_create, 709 .create = bt_sock_create,
709}; 710};
710 711
712struct dentry *bt_debugfs;
713EXPORT_SYMBOL_GPL(bt_debugfs);
714
711static int __init bt_init(void) 715static int __init bt_init(void)
712{ 716{
713 int err; 717 int err;
714 718
715 BT_INFO("Core ver %s", VERSION); 719 BT_INFO("Core ver %s", VERSION);
716 720
721 bt_debugfs = debugfs_create_dir("bluetooth", NULL);
722
717 err = bt_sysfs_init(); 723 err = bt_sysfs_init();
718 if (err < 0) 724 if (err < 0)
719 return err; 725 return err;
@@ -754,7 +760,6 @@ error:
754 760
755static void __exit bt_exit(void) 761static void __exit bt_exit(void)
756{ 762{
757
758 sco_exit(); 763 sco_exit();
759 764
760 l2cap_exit(); 765 l2cap_exit();
@@ -764,6 +769,8 @@ static void __exit bt_exit(void)
764 sock_unregister(PF_BLUETOOTH); 769 sock_unregister(PF_BLUETOOTH);
765 770
766 bt_sysfs_cleanup(); 771 bt_sysfs_cleanup();
772
773 debugfs_remove_recursive(bt_debugfs);
767} 774}
768 775
769subsys_initcall(bt_init); 776subsys_initcall(bt_init);
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 0e71318b0c82..320a76118252 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -1,6 +1,5 @@
1/* Bluetooth HCI driver model support. */ 1/* Bluetooth HCI driver model support. */
2 2
3#include <linux/debugfs.h>
4#include <linux/module.h> 3#include <linux/module.h>
5 4
6#include <net/bluetooth/bluetooth.h> 5#include <net/bluetooth/bluetooth.h>
@@ -8,9 +7,6 @@
8 7
9static struct class *bt_class; 8static struct class *bt_class;
10 9
11struct dentry *bt_debugfs;
12EXPORT_SYMBOL_GPL(bt_debugfs);
13
14static inline char *link_typetostr(int type) 10static inline char *link_typetostr(int type)
15{ 11{
16 switch (type) { 12 switch (type) {
@@ -426,8 +422,6 @@ void hci_del_sysfs(struct hci_dev *hdev)
426 422
427int __init bt_sysfs_init(void) 423int __init bt_sysfs_init(void)
428{ 424{
429 bt_debugfs = debugfs_create_dir("bluetooth", NULL);
430
431 bt_class = class_create(THIS_MODULE, "bluetooth"); 425 bt_class = class_create(THIS_MODULE, "bluetooth");
432 426
433 return PTR_ERR_OR_ZERO(bt_class); 427 return PTR_ERR_OR_ZERO(bt_class);
@@ -436,6 +430,4 @@ int __init bt_sysfs_init(void)
436void bt_sysfs_cleanup(void) 430void bt_sysfs_cleanup(void)
437{ 431{
438 class_destroy(bt_class); 432 class_destroy(bt_class);
439
440 debugfs_remove_recursive(bt_debugfs);
441} 433}