ChangeSet 1.2338, 2005/04/01 08:06:50-08:00, [EMAIL PROTECTED]

        Merge bk://kernel.bkbits.net/davem/net-2.6
        into ppc970.osdl.org:/home/torvalds/v2.6/linux



 sco.c |   42 ++++++++++++++++++++++++++++--------------
 1 files changed, 28 insertions(+), 14 deletions(-)


diff -Nru a/net/bluetooth/sco.c b/net/bluetooth/sco.c
--- a/net/bluetooth/sco.c       2005-04-01 09:12:26 -08:00
+++ b/net/bluetooth/sco.c       2005-04-01 09:12:26 -08:00
@@ -413,19 +413,23 @@
                sk->sk_type = parent->sk_type;
 }
 
+static struct proto sco_proto = {
+       .name           = "SCO",
+       .owner          = THIS_MODULE,
+       .obj_size       = sizeof(struct sco_pinfo)
+};
+
 static struct sock *sco_sock_alloc(struct socket *sock, int proto, int prio)
 {
        struct sock *sk;
 
-       sk = sk_alloc(PF_BLUETOOTH, prio, sizeof(struct sco_pinfo), NULL);
+       sk = sk_alloc(PF_BLUETOOTH, prio, &sco_proto, 1);
        if (!sk)
                return NULL;
 
        sock_init_data(sock, sk);
        INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
 
-       sk_set_owner(sk, THIS_MODULE);
-
        sk->sk_destruct = sco_sock_destruct;
        sk->sk_sndtimeo = SCO_CONN_TIMEOUT;
 
@@ -1015,14 +1019,21 @@
 {
        int err;
 
-       if ((err = bt_sock_register(BTPROTO_SCO, &sco_sock_family_ops))) {
-               BT_ERR("SCO socket registration failed");
+       err = proto_register(&sco_proto, 0);
+       if (err < 0)
                return err;
+
+       err = bt_sock_register(BTPROTO_SCO, &sco_sock_family_ops);
+       if (err < 0) {
+               BT_ERR("SCO socket registration failed");
+               goto error;
        }
 
-       if ((err = hci_register_proto(&sco_hci_proto))) {
+       err = hci_register_proto(&sco_hci_proto);
+       if (err < 0) {
                BT_ERR("SCO protocol registration failed");
-               return err;
+               bt_sock_unregister(BTPROTO_SCO);
+               goto error;
        }
 
        sco_proc_init();
@@ -1031,20 +1042,23 @@
        BT_INFO("SCO socket layer initialized");
 
        return 0;
+
+error:
+       proto_unregister(&sco_proto);
+       return err;
 }
 
 static void __exit sco_exit(void)
 {
-       int err;
-
        sco_proc_cleanup();
 
-       /* Unregister socket, protocol and notifier */
-       if ((err = bt_sock_unregister(BTPROTO_SCO)))
-               BT_ERR("SCO socket unregistration failed. %d", err);
+       if (bt_sock_unregister(BTPROTO_SCO) < 0)
+               BT_ERR("SCO socket unregistration failed");
+
+       if (hci_unregister_proto(&sco_hci_proto) < 0)
+               BT_ERR("SCO protocol unregistration failed");
 
-       if ((err = hci_unregister_proto(&sco_hci_proto)))
-               BT_ERR("SCO protocol unregistration failed. %d", err);
+       proto_unregister(&sco_proto);
 }
 
 module_init(sco_init);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to