public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 01/10] char/ds1620: use msleep() instead of schedule_timeout()
@ 2005-03-19 13:17 domen
  2005-03-19 19:35 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: domen @ 2005-03-19 13:17 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, domen, nacc



Not sure why any driver needs to sleep for *two* ticks, so let's fix it.

Use msleep() instead of schedule_timeout() to guarantee the
task delays as expected. Signals are never checked for by the callers or
in the function itself, so use TASK_UNINTERRUPTIBLE instead of
TASK_INTERRUPTIBLE. The delay is presumed to have been written when HZ==100,
and thus has been multiplied by 10 to pass to msleep().

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


 kj-domen/drivers/char/ds1620.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

diff -puN drivers/char/ds1620.c~msleep-drivers_char_ds1620 drivers/char/ds1620.c
--- kj/drivers/char/ds1620.c~msleep-drivers_char_ds1620	2005-03-18 20:05:09.000000000 +0100
+++ kj-domen/drivers/char/ds1620.c	2005-03-18 20:05:09.000000000 +0100
@@ -163,8 +163,7 @@ static void ds1620_out(int cmd, int bits
 	netwinder_ds1620_reset();
 	netwinder_unlock(&flags);
 
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(2);
+	msleep(20);
 }
 
 static unsigned int ds1620_in(int cmd, int bits)
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 01/10] char/ds1620: use msleep() instead of schedule_timeout()
  2005-03-19 13:17 [patch 01/10] char/ds1620: use msleep() instead of schedule_timeout() domen
@ 2005-03-19 19:35 ` Russell King
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2005-03-19 19:35 UTC (permalink / raw)
  To: domen; +Cc: akpm, linux-kernel, nacc

On Sat, Mar 19, 2005 at 02:17:15PM +0100, domen@coderock.org wrote:
> Not sure why any driver needs to sleep for *two* ticks, so let's fix it.
> 
> Use msleep() instead of schedule_timeout() to guarantee the
> task delays as expected. Signals are never checked for by the callers or
> in the function itself, so use TASK_UNINTERRUPTIBLE instead of
> TASK_INTERRUPTIBLE. The delay is presumed to have been written when HZ==100,
> and thus has been multiplied by 10 to pass to msleep().
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Signed-off-by: Domen Puncer <domen@coderock.org>

Acked-by: Russell King <rmk@arm.linux.org.uk>

> ---
> 
> 
>  kj-domen/drivers/char/ds1620.c |    3 +--
>  1 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff -puN drivers/char/ds1620.c~msleep-drivers_char_ds1620 drivers/char/ds1620.c
> --- kj/drivers/char/ds1620.c~msleep-drivers_char_ds1620	2005-03-18 20:05:09.000000000 +0100
> +++ kj-domen/drivers/char/ds1620.c	2005-03-18 20:05:09.000000000 +0100
> @@ -163,8 +163,7 @@ static void ds1620_out(int cmd, int bits
>  	netwinder_ds1620_reset();
>  	netwinder_unlock(&flags);
>  
> -	set_current_state(TASK_INTERRUPTIBLE);
> -	schedule_timeout(2);
> +	msleep(20);
>  }
>  
>  static unsigned int ds1620_in(int cmd, int bits)
> _
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-19 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 13:17 [patch 01/10] char/ds1620: use msleep() instead of schedule_timeout() domen
2005-03-19 19:35 ` Russell King

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