public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 03/14] char/sx: replace schedule_timeout() with msleep_interruptible()
@ 2005-03-06 22:36 domen
  0 siblings, 0 replies; only message in thread
From: domen @ 2005-03-06 22:36 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, domen, nacc



Please consider applying. 

Use msleep_interruptible() instead of schedule_timeout() to
guarantee consistent timing regardless of HZ value. schedule_timeout(1) will
vary between 10 and 1 milliseconds, depending on the value of HZ (100 or 1000
respectively). For consistent behavior, msleep_interruptible() should be used.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/drivers/char/sx.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff -puN drivers/char/sx.c~msleep_interruptible-drivers_char_sx drivers/char/sx.c
--- kj/drivers/char/sx.c~msleep_interruptible-drivers_char_sx	2005-03-05 16:11:01.000000000 +0100
+++ kj-domen/drivers/char/sx.c	2005-03-05 16:11:01.000000000 +0100
@@ -1515,13 +1515,9 @@ static void sx_close (void *ptr)
 	sx_reconfigure_port(port);	
 	sx_send_command (port, HS_CLOSE, 0, 0);
 
-	while (to-- && (sx_read_channel_byte (port, hi_hstat) != HS_IDLE_CLOSED)) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout (1);
-		if (signal_pending (current))
+	while (to-- && (sx_read_channel_byte (port, hi_hstat) != HS_IDLE_CLOSED))
+		if (msleep_interruptible(10))
 				break;
-	}
-	current->state = TASK_RUNNING;
 	if (sx_read_channel_byte (port, hi_hstat) != HS_IDLE_CLOSED) {
 		if (sx_send_command (port, HS_FORCE_CLOSED, -1, HS_IDLE_CLOSED) != 1) {
 			printk (KERN_ERR 
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-06 23:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-06 22:36 [patch 03/14] char/sx: replace schedule_timeout() with msleep_interruptible() domen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox