diff options
author | Samuel Ortiz <samuel@ortiz.org> | 2007-04-20 22:09:33 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-25 22:29:29 -0700 |
commit | d7f48d1a9398a3bd7bb6f4774640b24a0294cda3 (patch) | |
tree | 0c98a259f3b391f9d545ae28e6c2b1e1bbf644e0 /net/irda/af_irda.c | |
parent | 6e66aa15d8873ae7418d5afc6476daec466ff93b (diff) | |
download | linux-stable-d7f48d1a9398a3bd7bb6f4774640b24a0294cda3.tar.gz linux-stable-d7f48d1a9398a3bd7bb6f4774640b24a0294cda3.tar.bz2 linux-stable-d7f48d1a9398a3bd7bb6f4774640b24a0294cda3.zip |
[IrDA] af_irda: irda_accept cleanup
This patch removes a cut'n'paste copy of wait_event_interruptible
from irda_accept.
Signed-off-by: Samuel Ortiz <samuel@ortiz.org>
Acked-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/af_irda.c')
-rw-r--r-- | net/irda/af_irda.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index e9aa1626ea89..4eda10d79141 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -872,37 +872,19 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) * calling us, the data is waiting for us ;-) * Jean II */ - skb = skb_dequeue(&sk->sk_receive_queue); - if (skb == NULL) { - int ret = 0; - DECLARE_WAITQUEUE(waitq, current); + while (1) { + skb = skb_dequeue(&sk->sk_receive_queue); + if (skb) + break; /* Non blocking operation */ if (flags & O_NONBLOCK) return -EWOULDBLOCK; - /* The following code is a cut'n'paste of the - * wait_event_interruptible() macro. - * We don't us the macro because the condition has - * side effects : we want to make sure that only one - * 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; + err = wait_event_interruptible(*(sk->sk_sleep), + skb_peek(&sk->sk_receive_queue)); + if (err) + return err; } newsk = newsock->sk; |