]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - net/bluetooth/sco.c
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[mirror_ubuntu-artful-kernel.git] / net / bluetooth / sco.c
index 2bb7ef46bb9950e3991616dc3158d7b3d1b77f99..54279ac28120c9356731b6fab29db007c6a412f4 100644 (file)
@@ -1083,9 +1083,13 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)
        return lm;
 }
 
-void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
+static void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
 {
+       if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
+               return;
+
        BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
+
        if (!status) {
                struct sco_conn *conn;
 
@@ -1096,8 +1100,11 @@ void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
                sco_conn_del(hcon, bt_to_errno(status));
 }
 
-void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
+static void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
 {
+       if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
+               return;
+
        BT_DBG("hcon %p reason %d", hcon, reason);
 
        sco_conn_del(hcon, bt_to_errno(reason));
@@ -1122,6 +1129,12 @@ drop:
        return 0;
 }
 
+static struct hci_cb sco_cb = {
+       .name           = "SCO",
+       .connect_cfm    = sco_connect_cfm,
+       .disconn_cfm    = sco_disconn_cfm,
+};
+
 static int sco_debugfs_show(struct seq_file *f, void *p)
 {
        struct sock *sk;
@@ -1203,6 +1216,8 @@ int __init sco_init(void)
 
        BT_INFO("SCO socket layer initialized");
 
+       hci_register_cb(&sco_cb);
+
        if (IS_ERR_OR_NULL(bt_debugfs))
                return 0;
 
@@ -1222,6 +1237,8 @@ void __exit sco_exit(void)
 
        debugfs_remove(sco_debugfs);
 
+       hci_unregister_cb(&sco_cb);
+
        bt_sock_unregister(BTPROTO_SCO);
 
        proto_unregister(&sco_proto);