netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Olaf Kirch <olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 3/7] [IrDA] af_irda: irda_accept cleanup
Date: Thu, 19 Apr 2007 00:32:05 +0300	[thread overview]
Message-ID: <20070418214750.826786570@sortiz.org> (raw)
In-Reply-To: 20070418213202.214829666@sortiz.org

[-- Attachment #1: 0004-IrDA-net-2.6.22-af_irda-irda_accept-cleanup.patch --]
[-- Type: text/plain, Size: 2081 bytes --]

This patch removes a cut'n'paste copy of wait_event_interruptible
from irda_accept.

Signed-off-by: Samuel Ortiz <samuel-1iRGAI7R+ZvYtjvyW6yDsg@public.gmane.org>
Acked-by: Olaf Kirch <olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 net/irda/af_irda.c |   34 ++++++++--------------------------
 1 files changed, 8 insertions(+), 26 deletions(-)

Index: net-2.6.22-quilt/net/irda/af_irda.c
===================================================================
--- net-2.6.22-quilt.orig/net/irda/af_irda.c	2007-04-18 02:16:43.000000000 +0300
+++ net-2.6.22-quilt/net/irda/af_irda.c	2007-04-18 02:16:43.000000000 +0300
@@ -873,37 +873,19 @@
 	 * 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;

--


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-04-18 21:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 21:32 [PATCH 0/7] [IrDA] net-2.6.22 fixes samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-18 21:32 ` [PATCH 1/7] [IrDA] af_irda: irda_recvmsg_stream cleanup samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:05   ` David Miller
2007-04-18 21:32 ` [PATCH 2/7] [IrDA] af_irda: Silence kernel message in irda_recvmsg_stream samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:09   ` David Miller
     [not found]     ` <20070420.220900.45154094.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 12:01       ` Samuel Ortiz
     [not found]         ` <20070421120152.GB4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:43           ` David Miller
2007-04-18 21:32 ` samuel-jcdQHdrhKHMdnm+yROfE0A [this message]
2007-04-21  5:09   ` [PATCH 3/7] [IrDA] af_irda: irda_accept cleanup David Miller
2007-04-18 21:32 ` [PATCH 4/7] [IrDA] af_irda: IRDA_ASSERT cleanups samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:10   ` David Miller
2007-04-18 21:32 ` [PATCH 5/7] [IrDA] IrDA monitor mode samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:11   ` David Miller
     [not found]     ` <20070420.221143.132446079.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 11:42       ` Samuel Ortiz
     [not found]         ` <20070421114239.GA4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:46           ` David Miller
2007-04-22 11:29             ` [irda-users] " Samuel Ortiz
2007-04-22 19:59               ` David Miller
2007-04-18 21:32 ` [PATCH 6/7] [IrDA] Adding carriage returns to mcs7780 debug statements samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:12   ` David Miller
2007-04-18 21:32 ` [PATCH 7/7] [IrDA] Misc spelling corrections samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21  5:13   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070418214750.826786570@sortiz.org \
    --to=samuel-jcdqhdrhkhmdnm+yrofe0a@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olaf.kirch-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).