Commit 05b9ae6f authored by Maksim Krasnyanskiy's avatar Maksim Krasnyanskiy Committed by Marcel Holtmann

[Bluetooth]

Cleanup and fix __init and __exit functions.
/proc/bluetooth initialization fixes.
parent a1ba2826
...@@ -335,7 +335,9 @@ static int __init bt_init(void) ...@@ -335,7 +335,9 @@ static int __init bt_init(void)
BT_INFO("Core ver %s", VERSION); BT_INFO("Core ver %s", VERSION);
proc_bt = proc_mkdir("bluetooth", NULL); proc_bt = proc_mkdir("bluetooth", NULL);
if (proc_bt)
proc_bt->owner = THIS_MODULE;
/* Init socket cache */ /* Init socket cache */
bt_sock_cache = kmem_cache_create("bt_sock", bt_sock_cache = kmem_cache_create("bt_sock",
sizeof(struct bt_sock), 0, sizeof(struct bt_sock), 0,
......
...@@ -700,7 +700,7 @@ int bnep_get_conninfo(struct bnep_conninfo *ci) ...@@ -700,7 +700,7 @@ int bnep_get_conninfo(struct bnep_conninfo *ci)
return err; return err;
} }
static int __init bnep_init_module(void) static int __init bnep_init_module(void)
{ {
char flt[50] = ""; char flt[50] = "";
......
...@@ -192,13 +192,13 @@ static struct net_proto_family bnep_sock_family_ops = { ...@@ -192,13 +192,13 @@ static struct net_proto_family bnep_sock_family_ops = {
.create = bnep_sock_create .create = bnep_sock_create
}; };
int bnep_sock_init(void) int __init bnep_sock_init(void)
{ {
bt_sock_register(BTPROTO_BNEP, &bnep_sock_family_ops); bt_sock_register(BTPROTO_BNEP, &bnep_sock_family_ops);
return 0; return 0;
} }
int bnep_sock_cleanup(void) int __exit bnep_sock_cleanup(void)
{ {
if (bt_sock_unregister(BTPROTO_BNEP)) if (bt_sock_unregister(BTPROTO_BNEP))
BT_ERR("Can't unregister BNEP socket"); BT_ERR("Can't unregister BNEP socket");
......
...@@ -151,13 +151,13 @@ void hci_dev_proc_cleanup(struct hci_dev *hdev) ...@@ -151,13 +151,13 @@ void hci_dev_proc_cleanup(struct hci_dev *hdev)
remove_proc_entry(id, proc_bt_hci); remove_proc_entry(id, proc_bt_hci);
} }
int __init hci_proc_init(void) int __init hci_proc_init(void)
{ {
proc_bt_hci = proc_mkdir("hci", proc_bt); proc_bt_hci = proc_mkdir("hci", proc_bt);
return 0; return 0;
} }
void __init hci_proc_cleanup(void) void __exit hci_proc_cleanup(void)
{ {
remove_proc_entry("hci", proc_bt); remove_proc_entry("hci", proc_bt);
} }
...@@ -179,7 +179,7 @@ int __init hci_proc_init(void) ...@@ -179,7 +179,7 @@ int __init hci_proc_init(void)
return 0; return 0;
} }
void __init hci_proc_cleanup(void) void __exit hci_proc_cleanup(void)
{ {
return; return;
} }
......
...@@ -625,7 +625,7 @@ struct notifier_block hci_sock_nblock = { ...@@ -625,7 +625,7 @@ struct notifier_block hci_sock_nblock = {
.notifier_call = hci_sock_dev_event .notifier_call = hci_sock_dev_event
}; };
int hci_sock_init(void) int __init hci_sock_init(void)
{ {
if (bt_sock_register(BTPROTO_HCI, &hci_sock_family_ops)) { if (bt_sock_register(BTPROTO_HCI, &hci_sock_family_ops)) {
BT_ERR("HCI socket registration failed"); BT_ERR("HCI socket registration failed");
...@@ -639,7 +639,7 @@ int hci_sock_init(void) ...@@ -639,7 +639,7 @@ int hci_sock_init(void)
return 0; return 0;
} }
int hci_sock_cleanup(void) int __exit hci_sock_cleanup(void)
{ {
if (bt_sock_unregister(BTPROTO_HCI)) if (bt_sock_unregister(BTPROTO_HCI))
BT_ERR("HCI socket unregistration failed"); BT_ERR("HCI socket unregistration failed");
......
...@@ -2054,28 +2054,29 @@ static struct file_operations l2cap_seq_fops = { ...@@ -2054,28 +2054,29 @@ static struct file_operations l2cap_seq_fops = {
.release = seq_release, .release = seq_release,
}; };
static int __init l2cap_proc_init(void) static int __init l2cap_proc_init(void)
{ {
struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
p->owner = THIS_MODULE;
p->proc_fops = &l2cap_seq_fops; p->proc_fops = &l2cap_seq_fops;
return 0; return 0;
} }
static void __init l2cap_proc_cleanup(void) static void __exit l2cap_proc_cleanup(void)
{ {
remove_proc_entry("l2cap", proc_bt); remove_proc_entry("l2cap", proc_bt);
} }
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
static int __init l2cap_proc_init(void) static int __init l2cap_proc_init(void)
{ {
return 0; return 0;
} }
static void __init l2cap_proc_cleanup(void) static void __exit l2cap_proc_cleanup(void)
{ {
return; return;
} }
...@@ -2139,7 +2140,7 @@ int __init l2cap_init(void) ...@@ -2139,7 +2140,7 @@ int __init l2cap_init(void)
return 0; return 0;
} }
void l2cap_cleanup(void) void __exit l2cap_cleanup(void)
{ {
l2cap_proc_cleanup(); l2cap_proc_cleanup();
......
...@@ -1803,19 +1803,22 @@ static struct file_operations rfcomm_seq_fops = { ...@@ -1803,19 +1803,22 @@ static struct file_operations rfcomm_seq_fops = {
.release = seq_release, .release = seq_release,
}; };
static int __init rfcomm_proc_init(void) static int __init rfcomm_proc_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt); proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt);
if (proc_bt_rfcomm) {
proc_bt_rfcomm->owner = THIS_MODULE;
p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm); p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm);
if (p) if (p)
p->proc_fops = &rfcomm_seq_fops; p->proc_fops = &rfcomm_seq_fops;
}
return 0; return 0;
} }
static void __init rfcomm_proc_cleanup(void) static void __exit rfcomm_proc_cleanup(void)
{ {
remove_proc_entry("dlc", proc_bt_rfcomm); remove_proc_entry("dlc", proc_bt_rfcomm);
...@@ -1824,19 +1827,19 @@ static void __init rfcomm_proc_cleanup(void) ...@@ -1824,19 +1827,19 @@ static void __init rfcomm_proc_cleanup(void)
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
static int __init rfcomm_proc_init(void) static int __init rfcomm_proc_init(void)
{ {
return 0; return 0;
} }
static void __init rfcomm_proc_cleanup(void) static void __exit rfcomm_proc_cleanup(void)
{ {
return; return;
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
/* ---- Initialization ---- */ /* ---- Initialization ---- */
int __init rfcomm_init(void) int __init rfcomm_init(void)
{ {
kernel_thread(rfcomm_run, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); kernel_thread(rfcomm_run, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
...@@ -1853,7 +1856,7 @@ int __init rfcomm_init(void) ...@@ -1853,7 +1856,7 @@ int __init rfcomm_init(void)
return 0; return 0;
} }
void rfcomm_cleanup(void) void __exit rfcomm_cleanup(void)
{ {
/* Terminate working thread. /* Terminate working thread.
* ie. Set terminate flag and wake it up */ * ie. Set terminate flag and wake it up */
......
...@@ -828,7 +828,7 @@ static struct file_operations rfcomm_seq_fops = { ...@@ -828,7 +828,7 @@ static struct file_operations rfcomm_seq_fops = {
.release = seq_release, .release = seq_release,
}; };
static int __init rfcomm_sock_proc_init(void) static int __init rfcomm_sock_proc_init(void)
{ {
struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm); struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm);
if (!p) if (!p)
...@@ -837,19 +837,19 @@ static int __init rfcomm_sock_proc_init(void) ...@@ -837,19 +837,19 @@ static int __init rfcomm_sock_proc_init(void)
return 0; return 0;
} }
static void __init rfcomm_sock_proc_cleanup(void) static void __exit rfcomm_sock_proc_cleanup(void)
{ {
remove_proc_entry("sock", proc_bt_rfcomm); remove_proc_entry("sock", proc_bt_rfcomm);
} }
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
static int __init rfcomm_sock_proc_init(void) static int __init rfcomm_sock_proc_init(void)
{ {
return 0; return 0;
} }
static void __init rfcomm_sock_proc_cleanup(void) static void __exit rfcomm_sock_proc_cleanup(void)
{ {
return; return;
} }
...@@ -879,7 +879,7 @@ static struct net_proto_family rfcomm_sock_family_ops = { ...@@ -879,7 +879,7 @@ static struct net_proto_family rfcomm_sock_family_ops = {
.create = rfcomm_sock_create .create = rfcomm_sock_create
}; };
int rfcomm_init_sockets(void) int __init rfcomm_init_sockets(void)
{ {
int err; int err;
...@@ -894,7 +894,7 @@ int rfcomm_init_sockets(void) ...@@ -894,7 +894,7 @@ int rfcomm_init_sockets(void)
return 0; return 0;
} }
void rfcomm_cleanup_sockets(void) void __exit rfcomm_cleanup_sockets(void)
{ {
int err; int err;
......
...@@ -939,28 +939,29 @@ static struct file_operations sco_seq_fops = { ...@@ -939,28 +939,29 @@ static struct file_operations sco_seq_fops = {
.release = seq_release, .release = seq_release,
}; };
static int __init sco_proc_init(void) static int __init sco_proc_init(void)
{ {
struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
p->owner = THIS_MODULE;
p->proc_fops = &sco_seq_fops; p->proc_fops = &sco_seq_fops;
return 0; return 0;
} }
static void __init sco_proc_cleanup(void) static void __exit sco_proc_cleanup(void)
{ {
remove_proc_entry("sco", proc_bt); remove_proc_entry("sco", proc_bt);
} }
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
static int __init sco_proc_init(void) static int __init sco_proc_init(void)
{ {
return 0; return 0;
} }
static void __init sco_proc_cleanup(void) static void __exit sco_proc_cleanup(void)
{ {
return; return;
} }
...@@ -1021,7 +1022,7 @@ int __init sco_init(void) ...@@ -1021,7 +1022,7 @@ int __init sco_init(void)
return 0; return 0;
} }
void sco_cleanup(void) void __exit sco_cleanup(void)
{ {
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment