aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_ldisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r--drivers/tty/tty_ldisc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 4214d58276f7..0fc564a97706 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -34,8 +34,6 @@
34#include <linux/vt_kern.h> 34#include <linux/vt_kern.h>
35#include <linux/selection.h> 35#include <linux/selection.h>
36 36
37#include <linux/smp_lock.h> /* For the moment */
38
39#include <linux/kmod.h> 37#include <linux/kmod.h>
40#include <linux/nsproxy.h> 38#include <linux/nsproxy.h>
41 39
@@ -535,6 +533,19 @@ static int tty_ldisc_halt(struct tty_struct *tty)
535} 533}
536 534
537/** 535/**
536 * tty_ldisc_flush_works - flush all works of a tty
537 * @tty: tty device to flush works for
538 *
539 * Sync flush all works belonging to @tty.
540 */
541static void tty_ldisc_flush_works(struct tty_struct *tty)
542{
543 flush_work_sync(&tty->hangup_work);
544 flush_work_sync(&tty->SAK_work);
545 flush_delayed_work_sync(&tty->buf.work);
546}
547
548/**
538 * tty_ldisc_wait_idle - wait for the ldisc to become idle 549 * tty_ldisc_wait_idle - wait for the ldisc to become idle
539 * @tty: tty to wait for 550 * @tty: tty to wait for
540 * 551 *
@@ -653,7 +664,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
653 664
654 mutex_unlock(&tty->ldisc_mutex); 665 mutex_unlock(&tty->ldisc_mutex);
655 666
656 flush_scheduled_work(); 667 tty_ldisc_flush_works(tty);
657 668
658 retval = tty_ldisc_wait_idle(tty); 669 retval = tty_ldisc_wait_idle(tty);
659 670
@@ -905,7 +916,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
905 916
906 tty_unlock(); 917 tty_unlock();
907 tty_ldisc_halt(tty); 918 tty_ldisc_halt(tty);
908 flush_scheduled_work(); 919 tty_ldisc_flush_works(tty);
909 tty_lock(); 920 tty_lock();
910 921
911 mutex_lock(&tty->ldisc_mutex); 922 mutex_lock(&tty->ldisc_mutex);