Merge tag 'docs-for-linus' of git://git.lwn.net/linux-2.6
[firefly-linux-kernel-4.4.55.git] / net / bluetooth / l2cap_sock.c
index 20206cd3acbcab3feef0b858f380d163a5e23ee8..60694f0f4c73768dee1db1a4926ced43522dbe83 100644 (file)
@@ -302,7 +302,7 @@ done:
 static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
                             int flags)
 {
-       DECLARE_WAITQUEUE(wait, current);
+       DEFINE_WAIT_FUNC(wait, woken_wake_function);
        struct sock *sk = sock->sk, *nsk;
        long timeo;
        int err = 0;
@@ -316,8 +316,6 @@ static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
        /* Wait for an incoming connection. (wake-one). */
        add_wait_queue_exclusive(sk_sleep(sk), &wait);
        while (1) {
-               set_current_state(TASK_INTERRUPTIBLE);
-
                if (sk->sk_state != BT_LISTEN) {
                        err = -EBADFD;
                        break;
@@ -338,10 +336,11 @@ static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
                }
 
                release_sock(sk);
-               timeo = schedule_timeout(timeo);
+
+               timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
+
                lock_sock_nested(sk, L2CAP_NESTING_PARENT);
        }
-       __set_current_state(TASK_RUNNING);
        remove_wait_queue(sk_sleep(sk), &wait);
 
        if (err)