Bluetooth: move l2cap_sock_accept() to l2cap_sock.c
authorGustavo F. Padovan <padovan@profusion.mobi>
Fri, 4 Feb 2011 04:42:23 +0000 (02:42 -0200)
committerGustavo F. Padovan <padovan@profusion.mobi>
Tue, 8 Feb 2011 03:43:30 +0000 (01:43 -0200)
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
include/net/bluetooth/l2cap.h
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c

index 3ca4fe30d75e0daaa7e8ba706130a4ea984c46cf..7921b6b980cba7265a579d9c2ae1bd9a873f059e 100644 (file)
@@ -439,7 +439,6 @@ struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
                                                        int proto, gfp_t prio);
 
 int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags);
-int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags);
 int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer);
 int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len);
 int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags);
index 6af38722d5cb3357530b67961dc4131c143a86df..ff6a54ffed890762a577a08f2d6ead2fdbbef01f 100644 (file)
@@ -993,62 +993,6 @@ done:
        return err;
 }
 
-int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags)
-{
-       DECLARE_WAITQUEUE(wait, current);
-       struct sock *sk = sock->sk, *nsk;
-       long timeo;
-       int err = 0;
-
-       lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
-
-       if (sk->sk_state != BT_LISTEN) {
-               err = -EBADFD;
-               goto done;
-       }
-
-       timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
-
-       BT_DBG("sk %p timeo %ld", sk, timeo);
-
-       /* Wait for an incoming connection. (wake-one). */
-       add_wait_queue_exclusive(sk_sleep(sk), &wait);
-       while (!(nsk = bt_accept_dequeue(sk, newsock))) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               if (!timeo) {
-                       err = -EAGAIN;
-                       break;
-               }
-
-               release_sock(sk);
-               timeo = schedule_timeout(timeo);
-               lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
-
-               if (sk->sk_state != BT_LISTEN) {
-                       err = -EBADFD;
-                       break;
-               }
-
-               if (signal_pending(current)) {
-                       err = sock_intr_errno(timeo);
-                       break;
-               }
-       }
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(sk_sleep(sk), &wait);
-
-       if (err)
-               goto done;
-
-       newsock->state = SS_CONNECTED;
-
-       BT_DBG("new socket %p", nsk);
-
-done:
-       release_sock(sk);
-       return err;
-}
-
 int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)
 {
        struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
index ef9a60fda495463af7c1310e46cc94667616b7e6..b19a386332fc80153a51de74a6677b59ea747323 100644 (file)
@@ -197,6 +197,62 @@ done:
        return err;
 }
 
+static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags)
+{
+       DECLARE_WAITQUEUE(wait, current);
+       struct sock *sk = sock->sk, *nsk;
+       long timeo;
+       int err = 0;
+
+       lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
+
+       if (sk->sk_state != BT_LISTEN) {
+               err = -EBADFD;
+               goto done;
+       }
+
+       timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
+
+       BT_DBG("sk %p timeo %ld", sk, timeo);
+
+       /* Wait for an incoming connection. (wake-one). */
+       add_wait_queue_exclusive(sk_sleep(sk), &wait);
+       while (!(nsk = bt_accept_dequeue(sk, newsock))) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (!timeo) {
+                       err = -EAGAIN;
+                       break;
+               }
+
+               release_sock(sk);
+               timeo = schedule_timeout(timeo);
+               lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
+
+               if (sk->sk_state != BT_LISTEN) {
+                       err = -EBADFD;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       err = sock_intr_errno(timeo);
+                       break;
+               }
+       }
+       set_current_state(TASK_RUNNING);
+       remove_wait_queue(sk_sleep(sk), &wait);
+
+       if (err)
+               goto done;
+
+       newsock->state = SS_CONNECTED;
+
+       BT_DBG("new socket %p", nsk);
+
+done:
+       release_sock(sk);
+       return err;
+}
+
 static int l2cap_sock_release(struct socket *sock)
 {
        struct sock *sk = sock->sk;