From: Jiri Slaby Date: Wed, 16 Nov 2011 15:27:08 +0000 (+0100) Subject: TTY: ldisc, move wait idle to caller X-Git-Tag: v3.0.11~31 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=57ee681901463f23076fa730c7aa1c4cee63952e;p=karo-tx-linux.git TTY: ldisc, move wait idle to caller commit 300420722e0734a4254f3b634e0f82664495d210 upstream. It is the only place where reinit is called from. And we really need to wait for the old ldisc to go once. Actually this is the place where the waiting originally was (before removed and re-added later). This will make the fix in the following patch easier to implement. Signed-off-by: Jiri Slaby Cc: Dave Young Cc: Dave Jones Cc: Ben Hutchings Cc: Dmitriy Matrosov Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 363d5689a842..ba59b0a1fe42 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -764,8 +764,6 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) if (IS_ERR(ld)) return -1; - WARN_ON_ONCE(tty_ldisc_wait_idle(tty, 5 * HZ)); - tty_ldisc_close(tty, tty->ldisc); tty_ldisc_put(tty->ldisc); tty->ldisc = NULL; @@ -849,6 +847,8 @@ void tty_ldisc_hangup(struct tty_struct *tty) it means auditing a lot of other paths so this is a FIXME */ if (tty->ldisc) { /* Not yet closed */ + WARN_ON_ONCE(tty_ldisc_wait_idle(tty, 5 * HZ)); + if (reset == 0) { if (!tty_ldisc_reinit(tty, tty->termios->c_line))