Skip to contentSkip to conversation

serial send_break duration fix

PATCH New Paul Fulghum 1 participant 1 message Oct 21, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial send_break duration fix

Fix tty_io.c send_break() to assert break for proper duration. If driver break_ctl() changes task state, then break may end prematurely. USB serial driver break_ctl() sends a URB, changing task state to TASK_RUNNING.

drivers/char/tty_io.c +3 -3
@@ -1703,11 +1703,11 @@ static int tiocsetd(struct tty_struct *t
 
 static int send_break(struct tty_struct *tty, int duration)
 {
-	set_current_state(TASK_INTERRUPTIBLE);
-
 	tty->driver->break_ctl(tty, -1);
-	if (!signal_pending(current))
+	if (!signal_pending(current)) {
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(duration);
+	}
 	tty->driver->break_ctl(tty, 0);
 	if (signal_pending(current))
 		return -EINTR;