public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: domen@coderock.org
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, domen@coderock.org, nacc@us.ibm.com
Subject: [patch 03/14] char/sx: replace schedule_timeout() with msleep_interruptible()
Date: Sun, 06 Mar 2005 23:36:22 +0100	[thread overview]
Message-ID: <20050306223623.286AD1ED3D@trashy.coderock.org> (raw)



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 
_

                 reply	other threads:[~2005-03-06 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050306223623.286AD1ED3D@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nacc@us.ibm.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