Bluetooth: Implement SendAck() Action on ERTM.
[safe/jmp/linux-2.6] / net / bluetooth / hidp / sock.c
index 8b8a6c1..250dfd4 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/poll.h>
 #include <linux/fcntl.h>
 #include <linux/skbuff.h>
 #include <linux/file.h>
 #include <linux/init.h>
 #include <linux/compat.h>
+#include <linux/gfp.h>
 #include <net/sock.h>
 
 #include "hidp.h"
 
-#ifndef CONFIG_BT_HIDP_DEBUG
-#undef  BT_DBG
-#define BT_DBG(D...)
-#endif
-
 static int hidp_sock_release(struct socket *sock)
 {
        struct sock *sk = sock->sk;
@@ -86,13 +81,13 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
 
                isock = sockfd_lookup(ca.intr_sock, &err);
                if (!isock) {
-                       fput(csock->file);
+                       sockfd_put(csock);
                        return err;
                }
 
                if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) {
-                       fput(csock->file);
-                       fput(isock->file);
+                       sockfd_put(csock);
+                       sockfd_put(isock);
                        return -EBADFD;
                }
 
@@ -101,8 +96,8 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
                        if (copy_to_user(argp, &ca, sizeof(ca)))
                                err = -EFAULT;
                } else {
-                       fput(csock->file);
-                       fput(isock->file);
+                       sockfd_put(csock);
+                       sockfd_put(isock);
                }
 
                return err;
@@ -194,7 +189,7 @@ static int hidp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne
                if (put_user(ca.ctrl_sock, &uca->ctrl_sock) ||
                                put_user(ca.intr_sock, &uca->intr_sock) ||
                                put_user(ca.parser, &uca->parser) ||
-                               put_user(ca.rd_size, &uca->parser) ||
+                               put_user(ca.rd_size, &uca->rd_size) ||
                                put_user(compat_ptr(ca.rd_data), &uca->rd_data) ||
                                put_user(ca.country, &uca->country) ||
                                put_user(ca.subclass, &uca->subclass) ||
@@ -246,7 +241,8 @@ static struct proto hidp_proto = {
        .obj_size       = sizeof(struct bt_sock)
 };
 
-static int hidp_sock_create(struct socket *sock, int protocol)
+static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
+                           int kern)
 {
        struct sock *sk;
 
@@ -255,7 +251,7 @@ static int hidp_sock_create(struct socket *sock, int protocol)
        if (sock->type != SOCK_RAW)
                return -ESOCKTNOSUPPORT;
 
-       sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1);
+       sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto);
        if (!sk)
                return -ENOMEM;
 
@@ -273,7 +269,7 @@ static int hidp_sock_create(struct socket *sock, int protocol)
        return 0;
 }
 
-static struct net_proto_family hidp_sock_family_ops = {
+static const struct net_proto_family hidp_sock_family_ops = {
        .family = PF_BLUETOOTH,
        .owner  = THIS_MODULE,
        .create = hidp_sock_create