Bluetooth: Merge L2CAP and SCO modules into bluetooth.ko
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / af_bluetooth.c
index 2abfe2f30453f86d8426a762b070bccb8b846e9f..c258027bc8fe9119838bd64d10b75db6d81e4178 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <net/bluetooth/bluetooth.h>
 
-#define VERSION "2.15"
+#define VERSION "2.16"
 
 /* Bluetooth sockets */
 #define BT_MAX_PROTO   8
@@ -545,13 +545,41 @@ static int __init bt_init(void)
 
        BT_INFO("HCI device and connection manager initialized");
 
-       hci_sock_init();
+       err = hci_sock_init();
+       if (err < 0)
+               goto error;
+
+       err = l2cap_init();
+       if (err < 0) {
+               hci_sock_cleanup();
+               goto sock_err;
+       }
+
+       err = sco_init();
+       if (err < 0) {
+               l2cap_exit();
+               goto sock_err;
+       }
 
        return 0;
+
+sock_err:
+       hci_sock_cleanup();
+
+error:
+       sock_unregister(PF_BLUETOOTH);
+       bt_sysfs_cleanup();
+
+       return err;
 }
 
 static void __exit bt_exit(void)
 {
+
+       sco_exit();
+
+       l2cap_exit();
+
        hci_sock_cleanup();
 
        sock_unregister(PF_BLUETOOTH);