Skip to contentSkip to conversation

sbus/aurora: replace schedule_timeout() with msleep_interruptible()

PATCH [email protected] 1 participant 1 message Jan 11, 2005 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

Description: Use msleep_interruptible() instead of schedule_timeout() to guarantee the task delays as expected.

Quoted 6 lines · Domen Puncer

Review

Quoted 3 lines · Nishanth Aravamudan
(quoted diff) +1 -2
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(port->close_delay);
+			msleep_interruptible(port->close_delay);

I think you forgot jiffies_to_msecs here.

Please find the corrected patch below.
Thanks for catching this, Domen.

---

 kj-domen/drivers/sbus/char/aurora.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/sbus/char/aurora.c renamed from drivers/sbus/char/aurora.c~msleep_interruptible-drivers_sbus_char_aurora +2 -4
diff -puN drivers/sbus/char/aurora.c~msleep_interruptible-drivers_sbus_char_aurora drivers/sbus/char/aurora.c
@@ -1519,8 +1519,7 @@ static void aurora_close(struct tty_stru
 		 */
 		timeout = jiffies+HZ;
 		while(port->SRER & SRER_TXEMPTY)  {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(port->timeout);
+			msleep_interruptible(jiffies_to_msecs(port->timeout));
 			if (time_after(jiffies, timeout))
 				break;
 		}
@@ -1537,8 +1536,7 @@ static void aurora_close(struct tty_stru
 	port->tty = 0;
 	if (port->blocked_open) {
 		if (port->close_delay) {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(port->close_delay);
+			msleep_interruptible(jiffies_to_msecs(port->close_delay));
 		}
 		wake_up_interruptible(&port->open_wait);
 	}

_