Skip to contentSkip to conversation

char/ftape-io: replace schedule_timeout() with msleep_interruptible()

PATCH In review [email protected] 1 participant 1 message Sep 24, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/26 char/ftape-io: replace schedule_timeout() with msleep_interruptible()

Any comments would be appreciated.

Description: Use msleep_interruptible() instead of schedule_timeout() to guarantee the task delays as expected. In this case, this allowed for the removal of the entire do-while.

---

 linux-2.6.9-rc2-bk7-max/drivers/char/ftape/lowlevel/ftape-io.c |   20 +++-------
 1 files changed, 7 insertions(+), 13 deletions(-)
drivers/char/ftape/lowlevel/ftape-io.c renamed from drivers/char/ftape/lowlevel/ftape-io.c~msleep_interruptible-drivers_char_ftape-io +7 -13
diff -puN drivers/char/ftape/lowlevel/ftape-io.c~msleep_interruptible-drivers_char_ftape-io drivers/char/ftape/lowlevel/ftape-io.c
@@ -32,6 +32,7 @@
 #include <asm/system.h>
 #include <linux/ioctl.h>
 #include <linux/mtio.h>
+#include <linux/delay.h>
 
 #include <linux/ftape.h>
 #include <linux/qic117.h>
@@ -96,19 +97,12 @@ void ftape_sleep(unsigned int time)
 		timeout = ticks;
 		save_flags(flags);
 		sti();
-		set_current_state(TASK_INTERRUPTIBLE);
-		do {
-			/*  Mmm. Isn't current->blocked == 0xffffffff ?
-			 */
-			if (signal_pending(current)) {
-				TRACE(ft_t_err,
-				      "awoken by non-blocked signal :-(");
-				break;	/* exit on signal */
-			}
-			while (current->state != TASK_RUNNING) {
-				timeout = schedule_timeout(timeout);
-			}
-		} while (timeout);
+		msleep_interruptible(jiffies_to_msecs(timeout));
+		/*  Mmm. Isn't current->blocked == 0xffffffff ?
+		 */
+		if (signal_pending(current)) {
+			TRACE(ft_t_err, "awoken by non-blocked signal :-(");
+		}
 		restore_flags(flags);
 	}
 	TRACE_EXIT;

_