aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_ldisc.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-03-11 16:44:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-18 19:32:46 -0400
commit21622939fc452c7fb739464b8e49368c3ceaa0ee (patch)
treec96d6a137611e9d976a4d391a48c94f5267db7ff /drivers/tty/tty_ldisc.c
parent91debb0383d6564e0dc8ae76181f6daf8e24717a (diff)
tty: Add diagnostic for halted line discipline
Flip buffer work must not be scheduled by the line discipline after the line discipline has been halted; issue warning. Note: drivers can still schedule flip buffer work. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r--drivers/tty/tty_ldisc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index d794087c327e..c641321b9404 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -375,6 +375,7 @@ static inline void tty_ldisc_put(struct tty_ldisc *ld)
375 375
376void tty_ldisc_enable(struct tty_struct *tty) 376void tty_ldisc_enable(struct tty_struct *tty)
377{ 377{
378 clear_bit(TTY_LDISC_HALTED, &tty->flags);
378 set_bit(TTY_LDISC, &tty->flags); 379 set_bit(TTY_LDISC, &tty->flags);
379 clear_bit(TTY_LDISC_CHANGING, &tty->flags); 380 clear_bit(TTY_LDISC_CHANGING, &tty->flags);
380 wake_up(&tty_ldisc_wait); 381 wake_up(&tty_ldisc_wait);
@@ -513,8 +514,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
513 514
514static int tty_ldisc_halt(struct tty_struct *tty) 515static int tty_ldisc_halt(struct tty_struct *tty)
515{ 516{
517 int scheduled;
516 clear_bit(TTY_LDISC, &tty->flags); 518 clear_bit(TTY_LDISC, &tty->flags);
517 return cancel_work_sync(&tty->port->buf.work); 519 scheduled = cancel_work_sync(&tty->port->buf.work);
520 set_bit(TTY_LDISC_HALTED, &tty->flags);
521 return scheduled;
518} 522}
519 523
520/** 524/**
@@ -820,6 +824,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
820 clear_bit(TTY_LDISC, &tty->flags); 824 clear_bit(TTY_LDISC, &tty->flags);
821 tty_unlock(tty); 825 tty_unlock(tty);
822 cancel_work_sync(&tty->port->buf.work); 826 cancel_work_sync(&tty->port->buf.work);
827 set_bit(TTY_LDISC_HALTED, &tty->flags);
823 mutex_unlock(&tty->ldisc_mutex); 828 mutex_unlock(&tty->ldisc_mutex);
824retry: 829retry:
825 tty_lock(tty); 830 tty_lock(tty);