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,6 +335,8 @@ static int __init bt_init(void) ...@@ -335,6 +335,8 @@ 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",
......
...@@ -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");
......
...@@ -157,7 +157,7 @@ int __init hci_proc_init(void) ...@@ -157,7 +157,7 @@ int __init hci_proc_init(void)
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");
......
...@@ -2059,11 +2059,12 @@ static int __init l2cap_proc_init(void) ...@@ -2059,11 +2059,12 @@ 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);
} }
...@@ -2075,7 +2076,7 @@ static int __init l2cap_proc_init(void) ...@@ -2075,7 +2076,7 @@ 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();
......
...@@ -1808,14 +1808,17 @@ static int __init rfcomm_proc_init(void) ...@@ -1808,14 +1808,17 @@ 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);
...@@ -1829,7 +1832,7 @@ static int __init rfcomm_proc_init(void) ...@@ -1829,7 +1832,7 @@ 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;
} }
...@@ -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 */
......
...@@ -837,7 +837,7 @@ static int __init rfcomm_sock_proc_init(void) ...@@ -837,7 +837,7 @@ 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);
} }
...@@ -849,7 +849,7 @@ static int __init rfcomm_sock_proc_init(void) ...@@ -849,7 +849,7 @@ 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;
......
...@@ -944,11 +944,12 @@ static int __init sco_proc_init(void) ...@@ -944,11 +944,12 @@ 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);
} }
...@@ -960,7 +961,7 @@ static int __init sco_proc_init(void) ...@@ -960,7 +961,7 @@ 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