
From: Paul Fulghum <paulkf@microgate.com>

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.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/char/tty_io.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/char/tty_io.c~serial-send_break-duration-fix drivers/char/tty_io.c
--- 25/drivers/char/tty_io.c~serial-send_break-duration-fix	2004-10-21 21:06:47.351569200 -0700
+++ 25-akpm/drivers/char/tty_io.c	2004-10-21 21:06:47.356568440 -0700
@@ -2148,11 +2148,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;
_
