Merge branch 'for-3.20' of git://linux-nfs.org/~bfields/linux
[firefly-linux-kernel-4.4.55.git] / net / bluetooth / sco.c
index 30e5ea3f1ad311388bf7f95aec8f70cb88e8fab9..76321b546e8426146dba242c281c2915464e7d6f 100644 (file)
@@ -618,7 +618,7 @@ done:
 
 static int sco_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, *ch;
        long timeo;
        int err = 0;
@@ -632,8 +632,6 @@ static int sco_sock_accept(struct socket *sock, struct socket *newsock, int flag
        /* 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;
@@ -654,10 +652,10 @@ static int sco_sock_accept(struct socket *sock, struct socket *newsock, int flag
                }
 
                release_sock(sk);
-               timeo = schedule_timeout(timeo);
+
+               timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
                lock_sock(sk);
        }
-       __set_current_state(TASK_RUNNING);
        remove_wait_queue(sk_sleep(sk), &wait);
 
        if (err)
@@ -1184,6 +1182,8 @@ int __init sco_init(void)
 {
        int err;
 
+       BUILD_BUG_ON(sizeof(struct sockaddr_sco) > sizeof(struct sockaddr));
+
        err = proto_register(&sco_proto, 0);
        if (err < 0)
                return err;