diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-07 17:08:52 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-14 15:27:36 -0500 |
commit | 642745184f82688eb3ef0cdfaa4ba632055be9af (patch) | |
tree | 481319e39ccd971d770d88e48507469aad4adc87 | |
parent | c4c896e1471aec3b004a693c689f60be3b17ac86 (diff) |
Bluetooth: Merge L2CAP and SCO modules into bluetooth.ko
Actually doesn't make sense have these modules built separately.
The L2CAP layer is needed by almost all Bluetooth protocols and profiles.
There isn't any real use case without having L2CAP loaded.
SCO is only essential for Audio transfers, but it is so small that we can
have it loaded always in bluetooth.ko without problems.
If you really doesn't want it you can disable SCO in the kernel config.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 28 | ||||
-rw-r--r-- | net/bluetooth/Kconfig | 10 | ||||
-rw-r--r-- | net/bluetooth/Makefile | 5 | ||||
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 32 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 16 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 16 |
6 files changed, 66 insertions, 41 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index ed7d775337e0..43750439c521 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -205,4 +205,32 @@ extern void bt_sysfs_cleanup(void); | |||
205 | 205 | ||
206 | extern struct dentry *bt_debugfs; | 206 | extern struct dentry *bt_debugfs; |
207 | 207 | ||
208 | #ifdef CONFIG_BT_L2CAP | ||
209 | int l2cap_init(void); | ||
210 | void l2cap_exit(void); | ||
211 | #else | ||
212 | static inline int l2cap_init(void) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static inline void l2cap_exit(void) | ||
218 | { | ||
219 | } | ||
220 | #endif | ||
221 | |||
222 | #ifdef CONFIG_BT_SCO | ||
223 | int sco_init(void); | ||
224 | void sco_exit(void); | ||
225 | #else | ||
226 | static inline int sco_init(void) | ||
227 | { | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static inline void sco_exit(void) | ||
232 | { | ||
233 | } | ||
234 | #endif | ||
235 | |||
208 | #endif /* __BLUETOOTH_H */ | 236 | #endif /* __BLUETOOTH_H */ |
diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig index e45eae66eaf3..c6f9c2fb4891 100644 --- a/net/bluetooth/Kconfig +++ b/net/bluetooth/Kconfig | |||
@@ -32,7 +32,7 @@ menuconfig BT | |||
32 | more information, see <http://www.bluez.org/>. | 32 | more information, see <http://www.bluez.org/>. |
33 | 33 | ||
34 | config BT_L2CAP | 34 | config BT_L2CAP |
35 | tristate "L2CAP protocol support" | 35 | bool "L2CAP protocol support" |
36 | depends on BT | 36 | depends on BT |
37 | select CRC16 | 37 | select CRC16 |
38 | help | 38 | help |
@@ -40,19 +40,13 @@ config BT_L2CAP | |||
40 | connection oriented and connection-less data transport. L2CAP | 40 | connection oriented and connection-less data transport. L2CAP |
41 | support is required for most Bluetooth applications. | 41 | support is required for most Bluetooth applications. |
42 | 42 | ||
43 | Say Y here to compile L2CAP support into the kernel or say M to | ||
44 | compile it as module (l2cap). | ||
45 | |||
46 | config BT_SCO | 43 | config BT_SCO |
47 | tristate "SCO links support" | 44 | bool "SCO links support" |
48 | depends on BT | 45 | depends on BT |
49 | help | 46 | help |
50 | SCO link provides voice transport over Bluetooth. SCO support is | 47 | SCO link provides voice transport over Bluetooth. SCO support is |
51 | required for voice applications like Headset and Audio. | 48 | required for voice applications like Headset and Audio. |
52 | 49 | ||
53 | Say Y here to compile SCO support into the kernel or say M to | ||
54 | compile it as module (sco). | ||
55 | |||
56 | source "net/bluetooth/rfcomm/Kconfig" | 50 | source "net/bluetooth/rfcomm/Kconfig" |
57 | 51 | ||
58 | source "net/bluetooth/bnep/Kconfig" | 52 | source "net/bluetooth/bnep/Kconfig" |
diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile index 339b42932b33..f04fe9a9d634 100644 --- a/net/bluetooth/Makefile +++ b/net/bluetooth/Makefile | |||
@@ -3,12 +3,11 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_BT) += bluetooth.o | 5 | obj-$(CONFIG_BT) += bluetooth.o |
6 | obj-$(CONFIG_BT_L2CAP) += l2cap.o | ||
7 | obj-$(CONFIG_BT_SCO) += sco.o | ||
8 | obj-$(CONFIG_BT_RFCOMM) += rfcomm/ | 6 | obj-$(CONFIG_BT_RFCOMM) += rfcomm/ |
9 | obj-$(CONFIG_BT_BNEP) += bnep/ | 7 | obj-$(CONFIG_BT_BNEP) += bnep/ |
10 | obj-$(CONFIG_BT_CMTP) += cmtp/ | 8 | obj-$(CONFIG_BT_CMTP) += cmtp/ |
11 | obj-$(CONFIG_BT_HIDP) += hidp/ | 9 | obj-$(CONFIG_BT_HIDP) += hidp/ |
12 | 10 | ||
13 | bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o | 11 | bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o |
14 | l2cap-y := l2cap_core.o l2cap_sock.o | 12 | bluetooth-$(CONFIG_BT_L2CAP) += l2cap_core.o l2cap_sock.o |
13 | bluetooth-$(CONFIG_BT_SCO) += sco.o | ||
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 2abfe2f30453..c258027bc8fe 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #include <net/bluetooth/bluetooth.h> | 41 | #include <net/bluetooth/bluetooth.h> |
42 | 42 | ||
43 | #define VERSION "2.15" | 43 | #define VERSION "2.16" |
44 | 44 | ||
45 | /* Bluetooth sockets */ | 45 | /* Bluetooth sockets */ |
46 | #define BT_MAX_PROTO 8 | 46 | #define BT_MAX_PROTO 8 |
@@ -545,13 +545,41 @@ static int __init bt_init(void) | |||
545 | 545 | ||
546 | BT_INFO("HCI device and connection manager initialized"); | 546 | BT_INFO("HCI device and connection manager initialized"); |
547 | 547 | ||
548 | hci_sock_init(); | 548 | err = hci_sock_init(); |
549 | if (err < 0) | ||
550 | goto error; | ||
551 | |||
552 | err = l2cap_init(); | ||
553 | if (err < 0) { | ||
554 | hci_sock_cleanup(); | ||
555 | goto sock_err; | ||
556 | } | ||
557 | |||
558 | err = sco_init(); | ||
559 | if (err < 0) { | ||
560 | l2cap_exit(); | ||
561 | goto sock_err; | ||
562 | } | ||
549 | 563 | ||
550 | return 0; | 564 | return 0; |
565 | |||
566 | sock_err: | ||
567 | hci_sock_cleanup(); | ||
568 | |||
569 | error: | ||
570 | sock_unregister(PF_BLUETOOTH); | ||
571 | bt_sysfs_cleanup(); | ||
572 | |||
573 | return err; | ||
551 | } | 574 | } |
552 | 575 | ||
553 | static void __exit bt_exit(void) | 576 | static void __exit bt_exit(void) |
554 | { | 577 | { |
578 | |||
579 | sco_exit(); | ||
580 | |||
581 | l2cap_exit(); | ||
582 | |||
555 | hci_sock_cleanup(); | 583 | hci_sock_cleanup(); |
556 | 584 | ||
557 | sock_unregister(PF_BLUETOOTH); | 585 | sock_unregister(PF_BLUETOOTH); |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ba7f9da68998..6f054d906c6f 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -55,8 +55,6 @@ | |||
55 | #include <net/bluetooth/hci_core.h> | 55 | #include <net/bluetooth/hci_core.h> |
56 | #include <net/bluetooth/l2cap.h> | 56 | #include <net/bluetooth/l2cap.h> |
57 | 57 | ||
58 | #define VERSION "2.15" | ||
59 | |||
60 | int disable_ertm; | 58 | int disable_ertm; |
61 | 59 | ||
62 | static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; | 60 | static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; |
@@ -3806,7 +3804,7 @@ static struct hci_proto l2cap_hci_proto = { | |||
3806 | .recv_acldata = l2cap_recv_acldata | 3804 | .recv_acldata = l2cap_recv_acldata |
3807 | }; | 3805 | }; |
3808 | 3806 | ||
3809 | static int __init l2cap_init(void) | 3807 | int __init l2cap_init(void) |
3810 | { | 3808 | { |
3811 | int err; | 3809 | int err; |
3812 | 3810 | ||
@@ -3834,7 +3832,6 @@ static int __init l2cap_init(void) | |||
3834 | BT_ERR("Failed to create L2CAP debug file"); | 3832 | BT_ERR("Failed to create L2CAP debug file"); |
3835 | } | 3833 | } |
3836 | 3834 | ||
3837 | BT_INFO("L2CAP ver %s", VERSION); | ||
3838 | BT_INFO("L2CAP socket layer initialized"); | 3835 | BT_INFO("L2CAP socket layer initialized"); |
3839 | 3836 | ||
3840 | return 0; | 3837 | return 0; |
@@ -3845,7 +3842,7 @@ error: | |||
3845 | return err; | 3842 | return err; |
3846 | } | 3843 | } |
3847 | 3844 | ||
3848 | static void __exit l2cap_exit(void) | 3845 | void l2cap_exit(void) |
3849 | { | 3846 | { |
3850 | debugfs_remove(l2cap_debugfs); | 3847 | debugfs_remove(l2cap_debugfs); |
3851 | 3848 | ||
@@ -3866,14 +3863,5 @@ void l2cap_load(void) | |||
3866 | } | 3863 | } |
3867 | EXPORT_SYMBOL(l2cap_load); | 3864 | EXPORT_SYMBOL(l2cap_load); |
3868 | 3865 | ||
3869 | module_init(l2cap_init); | ||
3870 | module_exit(l2cap_exit); | ||
3871 | |||
3872 | module_param(disable_ertm, bool, 0644); | 3866 | module_param(disable_ertm, bool, 0644); |
3873 | MODULE_PARM_DESC(disable_ertm, "Disable enhanced retransmission mode"); | 3867 | MODULE_PARM_DESC(disable_ertm, "Disable enhanced retransmission mode"); |
3874 | |||
3875 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | ||
3876 | MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION); | ||
3877 | MODULE_VERSION(VERSION); | ||
3878 | MODULE_LICENSE("GPL"); | ||
3879 | MODULE_ALIAS("bt-proto-0"); | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 926ed39912ea..c9348ddda877 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -50,8 +50,6 @@ | |||
50 | #include <net/bluetooth/hci_core.h> | 50 | #include <net/bluetooth/hci_core.h> |
51 | #include <net/bluetooth/sco.h> | 51 | #include <net/bluetooth/sco.h> |
52 | 52 | ||
53 | #define VERSION "0.6" | ||
54 | |||
55 | static int disable_esco; | 53 | static int disable_esco; |
56 | 54 | ||
57 | static const struct proto_ops sco_sock_ops; | 55 | static const struct proto_ops sco_sock_ops; |
@@ -1024,7 +1022,7 @@ static struct hci_proto sco_hci_proto = { | |||
1024 | .recv_scodata = sco_recv_scodata | 1022 | .recv_scodata = sco_recv_scodata |
1025 | }; | 1023 | }; |
1026 | 1024 | ||
1027 | static int __init sco_init(void) | 1025 | int __init sco_init(void) |
1028 | { | 1026 | { |
1029 | int err; | 1027 | int err; |
1030 | 1028 | ||
@@ -1052,7 +1050,6 @@ static int __init sco_init(void) | |||
1052 | BT_ERR("Failed to create SCO debug file"); | 1050 | BT_ERR("Failed to create SCO debug file"); |
1053 | } | 1051 | } |
1054 | 1052 | ||
1055 | BT_INFO("SCO (Voice Link) ver %s", VERSION); | ||
1056 | BT_INFO("SCO socket layer initialized"); | 1053 | BT_INFO("SCO socket layer initialized"); |
1057 | 1054 | ||
1058 | return 0; | 1055 | return 0; |
@@ -1062,7 +1059,7 @@ error: | |||
1062 | return err; | 1059 | return err; |
1063 | } | 1060 | } |
1064 | 1061 | ||
1065 | static void __exit sco_exit(void) | 1062 | void __exit sco_exit(void) |
1066 | { | 1063 | { |
1067 | debugfs_remove(sco_debugfs); | 1064 | debugfs_remove(sco_debugfs); |
1068 | 1065 | ||
@@ -1075,14 +1072,5 @@ static void __exit sco_exit(void) | |||
1075 | proto_unregister(&sco_proto); | 1072 | proto_unregister(&sco_proto); |
1076 | } | 1073 | } |
1077 | 1074 | ||
1078 | module_init(sco_init); | ||
1079 | module_exit(sco_exit); | ||
1080 | |||
1081 | module_param(disable_esco, bool, 0644); | 1075 | module_param(disable_esco, bool, 0644); |
1082 | MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation"); | 1076 | MODULE_PARM_DESC(disable_esco, "Disable eSCO connection creation"); |
1083 | |||
1084 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | ||
1085 | MODULE_DESCRIPTION("Bluetooth SCO ver " VERSION); | ||
1086 | MODULE_VERSION(VERSION); | ||
1087 | MODULE_LICENSE("GPL"); | ||
1088 | MODULE_ALIAS("bt-proto-2"); | ||