[PATCH] char/tty_io: replace schedule_timeout() with msleep_interruptible()

Use msleep_interruptible() instead of schedule_timeout() in send_break() to
guarantee the task delays as expected. Change @duration's units to
milliseconds, and modify arguments in callers appropriately. Patch is
compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Domen Puncer and committed by Linus Torvalds b20f3ae5 d8eddb62

+5 -5
+5 -5
drivers/char/tty_io.c
··· 94 #include <linux/idr.h> 95 #include <linux/wait.h> 96 #include <linux/bitops.h> 97 98 #include <asm/uaccess.h> 99 #include <asm/system.h> ··· 2181 return tty_set_ldisc(tty, ldisc); 2182 } 2183 2184 - static int send_break(struct tty_struct *tty, int duration) 2185 { 2186 tty->driver->break_ctl(tty, -1); 2187 if (!signal_pending(current)) { 2188 - set_current_state(TASK_INTERRUPTIBLE); 2189 - schedule_timeout(duration); 2190 } 2191 tty->driver->break_ctl(tty, 0); 2192 if (signal_pending(current)) ··· 2366 * all by anyone? 2367 */ 2368 if (!arg) 2369 - return send_break(tty, HZ/4); 2370 return 0; 2371 case TCSBRKP: /* support for POSIX tcsendbreak() */ 2372 - return send_break(tty, arg ? arg*(HZ/10) : HZ/4); 2373 2374 case TIOCMGET: 2375 return tty_tiocmget(tty, file, p);
··· 94 #include <linux/idr.h> 95 #include <linux/wait.h> 96 #include <linux/bitops.h> 97 + #include <linux/delay.h> 98 99 #include <asm/uaccess.h> 100 #include <asm/system.h> ··· 2180 return tty_set_ldisc(tty, ldisc); 2181 } 2182 2183 + static int send_break(struct tty_struct *tty, unsigned int duration) 2184 { 2185 tty->driver->break_ctl(tty, -1); 2186 if (!signal_pending(current)) { 2187 + msleep_interruptible(duration); 2188 } 2189 tty->driver->break_ctl(tty, 0); 2190 if (signal_pending(current)) ··· 2366 * all by anyone? 2367 */ 2368 if (!arg) 2369 + return send_break(tty, 250); 2370 return 0; 2371 case TCSBRKP: /* support for POSIX tcsendbreak() */ 2372 + return send_break(tty, arg ? arg*100 : 250); 2373 2374 case TIOCMGET: 2375 return tty_tiocmget(tty, file, p);