public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcin Dalecki <dalecki@evision.ag>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.5.27 sched
Date: Mon, 22 Jul 2002 12:45:43 +0200	[thread overview]
Message-ID: <3D3BE257.40401@evision.ag> (raw)
In-Reply-To: Pine.LNX.4.44.0207201218390.1230-100000@home.transmeta.com

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

- Don't use __wait_event_interruptible() use wait_event_interruptible()
instead.
- Remove unused get_current_user() macro.

[-- Attachment #2: sched-2.5.27.diff --]
[-- Type: text/plain, Size: 5164 bytes --]

diff -urN linux-2.5.27/drivers/scsi/sg.c linux/drivers/scsi/sg.c
--- linux-2.5.27/drivers/scsi/sg.c	2002-07-20 21:11:17.000000000 +0200
+++ linux/drivers/scsi/sg.c	2002-07-22 00:46:39.000000000 +0200
@@ -295,10 +295,9 @@
 	}
 	if (sdp->headfp && (flags & O_NONBLOCK))
             goto error_out;
-        res = 0; 
-	__wait_event_interruptible(sdp->o_excl_wait,
-	       ((sdp->headfp || sdp->exclude) ? 0 : (sdp->exclude = 1)),
-                                   res);
+
+	res = wait_event_interruptible(sdp->o_excl_wait,
+	       ((sdp->headfp || sdp->exclude) ? 0 : (sdp->exclude = 1)));
         if (res) {
             retval = res; /* -ERESTARTSYS because signal hit process */
 	    goto error_out;
@@ -307,15 +306,14 @@
     else if (sdp->exclude) { /* some other fd has an exclusive lock on dev */
         if (flags & O_NONBLOCK)
             goto error_out;
-        res = 0; 
-        __wait_event_interruptible(sdp->o_excl_wait, (! sdp->exclude), res);
+        res = wait_event_interruptible(sdp->o_excl_wait, (! sdp->exclude));
         if (res) {
             retval = res; /* -ERESTARTSYS because signal hit process */
 	    goto error_out;
         }
     }
     if (sdp->detached) {
-    	retval = -ENODEV;
+	retval = -ENODEV;
 	goto error_out;
     }
     if (! sdp->headfp) { /* no existing opens on this device */
@@ -400,9 +398,8 @@
         if (filp->f_flags & O_NONBLOCK)
             return -EAGAIN;
 	while (1) {
-	    res = 0;  /* following is a macro that beats race condition */
-	    __wait_event_interruptible(sfp->read_wait, (sdp->detached || 
-		    (srp = sg_get_rq_mark(sfp, req_pack_id))), res);
+	    res = wait_event_interruptible(sfp->read_wait, (sdp->detached ||
+		    (srp = sg_get_rq_mark(sfp, req_pack_id))));
 	    if (sdp->detached)
 		return -ENODEV;
 	    if (0 == res)
@@ -783,16 +780,14 @@
 		return -ENODEV;
 	    if(! scsi_block_when_processing_errors(sdp->device) )
 		return -ENXIO;
-	    result = verify_area(VERIFY_WRITE, (void *)arg, SZ_SG_IO_HDR);
-	    if (result) return result;
 	    result = sg_new_write(sfp, (const char *)arg, SZ_SG_IO_HDR,
 				  blocking, read_only, &srp);
-	    if (result < 0) return result;
+	    if (result < 0)
+		    return result;
 	    srp->sg_io_owned = 1;
 	    while (1) {
-		result = 0;  /* following macro to beat race condition */
-		__wait_event_interruptible(sfp->read_wait,
-		       (sdp->detached || sfp->closed || srp->done), result);
+		result = wait_event_interruptible(sfp->read_wait,
+		       (sdp->detached || sfp->closed || srp->done));
 		if (sdp->detached)
 		    return -ENODEV;
 		if (sfp->closed)
diff -urN linux-2.5.27/include/linux/sched.h linux/include/linux/sched.h
--- linux-2.5.27/include/linux/sched.h	2002-07-20 21:11:07.000000000 +0200
+++ linux/include/linux/sched.h	2002-07-22 00:52:37.000000000 +0200
@@ -236,11 +236,6 @@
 	uid_t uid;
 };
 
-#define get_current_user() ({ 				\
-	struct user_struct *__user = current->user;	\
-	atomic_inc(&__user->__count);			\
-	__user; })
-
 extern struct user_struct root_user;
 #define INIT_USER (&root_user)
 
@@ -679,27 +674,6 @@
 	__wait_event(wq, condition);					\
 } while (0)
 
-#define __wait_event_interruptible(wq, condition, ret)			\
-do {									\
-	wait_queue_t __wait;						\
-	init_waitqueue_entry(&__wait, current);				\
-									\
-	add_wait_queue(&wq, &__wait);					\
-	for (;;) {							\
-		set_current_state(TASK_INTERRUPTIBLE);			\
-		if (condition)						\
-			break;						\
-		if (!signal_pending(current)) {				\
-			schedule();					\
-			continue;					\
-		}							\
-		ret = -ERESTARTSYS;					\
-		break;							\
-	}								\
-	current->state = TASK_RUNNING;					\
-	remove_wait_queue(&wq, &__wait);				\
-} while (0)
-	
 /*
  * Must be called with the spinlock in the wait_queue_head_t held.
  */
@@ -722,8 +696,25 @@
 #define wait_event_interruptible(wq, condition)				\
 ({									\
 	int __ret = 0;							\
-	if (!(condition))						\
-		__wait_event_interruptible(wq, condition, __ret);	\
+	if (!(condition)) {						\
+		wait_queue_t __wait;					\
+		init_waitqueue_entry(&__wait, current);			\
+									\
+		add_wait_queue(&wq, &__wait);				\
+		for (;;) {						\
+			set_current_state(TASK_INTERRUPTIBLE);		\
+			if (condition)					\
+				break;					\
+			if (!signal_pending(current)) {			\
+				schedule();				\
+				continue;				\
+			}						\
+			__ret = -ERESTARTSYS;				\
+			break;						\
+		}							\
+		current->state = TASK_RUNNING;				\
+		remove_wait_queue(&wq, &__wait);			\
+	}								\
 	__ret;								\
 })
 
diff -urN linux-2.5.27/net/irda/af_irda.c linux/net/irda/af_irda.c
--- linux-2.5.27/net/irda/af_irda.c	2002-07-20 21:11:12.000000000 +0200
+++ linux/net/irda/af_irda.c	2002-07-22 00:48:04.000000000 +0200
@@ -2373,9 +2373,8 @@
 			add_timer(&(self->watchdog));
 
 			/* Wait for IR-LMP to call us back */
-			__wait_event_interruptible(self->query_wait,
-			   (self->cachediscovery!=NULL || self->errno==-ETIME),
-						   ret);
+			ret = wait_event_interruptible(self->query_wait,
+			   (self->cachediscovery!=NULL || self->errno==-ETIME));
 
 			/* If watchdog is still activated, kill it! */
 			if(timer_pending(&(self->watchdog)))

  parent reply	other threads:[~2002-07-22 10:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-20 19:22 Linux-2.5.27 Linus Torvalds
2002-07-22 10:42 ` [PATCH] 2.5.27 sysctl Marcin Dalecki
2002-07-22 10:53   ` Christoph Hellwig
2002-07-22 10:56     ` Marcin Dalecki
2002-07-22 11:02       ` Christoph Hellwig
2002-07-22 11:03         ` Marcin Dalecki
2002-07-22 12:51           ` Alexander Viro
2002-07-22 13:02             ` Marcin Dalecki
2002-07-22 11:13       ` Christoph Hellwig
2002-07-22 11:19       ` Dave Jones
2002-07-22 11:19       ` bart
2002-07-22 11:21       ` BALBIR SINGH
2002-07-22 12:30       ` Alan Cox
2002-07-22 11:21         ` Marcin Dalecki
2002-07-22 15:57   ` Daniel Egger
2002-07-22 10:43 ` [PATCH] 2.5.27 devfs Marcin Dalecki
2002-07-22 17:28   ` Richard Gooch
2002-07-22 18:03     ` Marcin Dalecki
2002-07-22 18:19       ` Alexander Viro
2002-07-22 18:46         ` Marcin Dalecki
2002-07-23  5:04       ` Richard Gooch
2002-07-22 10:45 ` Marcin Dalecki [this message]
2002-07-22 10:47 ` [PATCH] 2.5.27 smbiod Marcin Dalecki
2002-07-22 22:29   ` Albert D. Cahalan
2002-07-22 10:50 ` [PATCH] 2.5.27 spinlock Marcin Dalecki
2002-07-24  4:40   ` Rusty Russell
2002-07-22 10:51 ` [PATCH] 2.5.27 wait Marcin Dalecki
2002-07-22 10:53 ` [PATCH] 2.5.27 enum Marcin Dalecki
2002-07-22 20:01   ` Benjamin LaHaise
2002-07-23  2:11     ` David S. Miller
2002-07-23  2:55       ` Alexander Viro
2002-07-24  6:44       ` James H. Cloos Jr.
2002-07-23 12:27     ` Dave Jones
2002-07-23 12:41       ` Marcin Dalecki
2002-07-23 13:05       ` Bartlomiej Zolnierkiewicz
2002-07-24  4:49       ` Rusty Russell
2002-07-24  9:47         ` Dave Jones
2002-07-22 14:08 ` [PATCH] 2.5.27 read_write Marcin Dalecki
2002-07-22 16:55   ` Alan Cox
2002-07-22 16:15     ` [PATCH] 2.5.27 read_write - take 2 Marcin Dalecki
2002-07-22 17:04   ` [PATCH] 2.5.27 read_write Alan Cox

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=3D3BE257.40401@evision.ag \
    --to=dalecki@evision.ag \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@dalecki.de \
    --cc=torvalds@transmeta.com \
    /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