[Linux-parport] [patch 2/4] block/pg: replace pg_sleep() with msleep()

domen at coderock.org domen at coderock.org
Sat Mar 5 17:44:54 EST 2005




Use msleep()/ssleep() instead of pg_sleep() to guarantee
the task delays as expected. TASK_INTERRUPTIBLE is used in the original code,
however there is no check on the return values / for signals, thus I believe
TASK_UNINTERRUPTIBLE (and hence msleep()) is more appropriate. Change pg_sleep()
to use TASK_UNINTERRUPTIBLE as well.

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


 kj-domen/drivers/block/paride/pg.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/block/paride/pg.c~msleep-drivers_block_paride_pg drivers/block/paride/pg.c
--- kj/drivers/block/paride/pg.c~msleep-drivers_block_paride_pg	2005-03-05 16:10:46.000000000 +0100
+++ kj-domen/drivers/block/paride/pg.c	2005-03-05 16:10:46.000000000 +0100
@@ -295,7 +295,7 @@ static inline u8 DRIVE(struct pg *dev)
 
 static void pg_sleep(int cs)
 {
-	current->state = TASK_INTERRUPTIBLE;
+	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(cs);
 }
 
@@ -409,7 +409,7 @@ static int pg_reset(struct pg *dev)
 	write_reg(dev, 6, DRIVE(dev));
 	write_reg(dev, 7, 8);
 
-	pg_sleep(20 * HZ / 1000);
+	msleep(20);
 
 	k = 0;
 	while ((k++ < PG_RESET_TMO) && (status_reg(dev) & STAT_BUSY))
_



More information about the Linux-parport mailing list