Commit d7f48d1a authored by Samuel Ortiz's avatar Samuel Ortiz Committed by David S. Miller

[IrDA] af_irda: irda_accept cleanup

This patch removes a cut'n'paste copy of wait_event_interruptible
from irda_accept.
Signed-off-by: default avatarSamuel Ortiz <samuel@ortiz.org>
Acked-by: default avatarOlaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6e66aa15
...@@ -872,37 +872,19 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -872,37 +872,19 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
* calling us, the data is waiting for us ;-) * calling us, the data is waiting for us ;-)
* Jean II * Jean II
*/ */
skb = skb_dequeue(&sk->sk_receive_queue); while (1) {
if (skb == NULL) { skb = skb_dequeue(&sk->sk_receive_queue);
int ret = 0; if (skb)
DECLARE_WAITQUEUE(waitq, current); break;
/* Non blocking operation */ /* Non blocking operation */
if (flags & O_NONBLOCK) if (flags & O_NONBLOCK)
return -EWOULDBLOCK; return -EWOULDBLOCK;
/* The following code is a cut'n'paste of the err = wait_event_interruptible(*(sk->sk_sleep),
* wait_event_interruptible() macro. skb_peek(&sk->sk_receive_queue));
* We don't us the macro because the condition has if (err)
* side effects : we want to make sure that only one return err;
* skb get dequeued - Jean II */
add_wait_queue(sk->sk_sleep, &waitq);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
skb = skb_dequeue(&sk->sk_receive_queue);
if (skb != NULL)
break;
if (!signal_pending(current)) {
schedule();
continue;
}
ret = -ERESTARTSYS;
break;
}
current->state = TASK_RUNNING;
remove_wait_queue(sk->sk_sleep, &waitq);
if(ret)
return -ERESTARTSYS;
} }
newsk = newsock->sk; newsk = newsock->sk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment