diff options
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r-- | drivers/tty/tty_ldisc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 0f2a2c5e704c..f4e6754525dc 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -512,7 +512,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |||
512 | static int tty_ldisc_halt(struct tty_struct *tty) | 512 | static int tty_ldisc_halt(struct tty_struct *tty) |
513 | { | 513 | { |
514 | clear_bit(TTY_LDISC, &tty->flags); | 514 | clear_bit(TTY_LDISC, &tty->flags); |
515 | return cancel_work_sync(&tty->buf.work); | 515 | return cancel_work_sync(&tty->port->buf.work); |
516 | } | 516 | } |
517 | 517 | ||
518 | /** | 518 | /** |
@@ -525,7 +525,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty) | |||
525 | { | 525 | { |
526 | flush_work(&tty->hangup_work); | 526 | flush_work(&tty->hangup_work); |
527 | flush_work(&tty->SAK_work); | 527 | flush_work(&tty->SAK_work); |
528 | flush_work(&tty->buf.work); | 528 | flush_work(&tty->port->buf.work); |
529 | } | 529 | } |
530 | 530 | ||
531 | /** | 531 | /** |
@@ -704,9 +704,9 @@ enable: | |||
704 | /* Restart the work queue in case no characters kick it off. Safe if | 704 | /* Restart the work queue in case no characters kick it off. Safe if |
705 | already running */ | 705 | already running */ |
706 | if (work) | 706 | if (work) |
707 | schedule_work(&tty->buf.work); | 707 | schedule_work(&tty->port->buf.work); |
708 | if (o_work) | 708 | if (o_work) |
709 | schedule_work(&o_tty->buf.work); | 709 | schedule_work(&o_tty->port->buf.work); |
710 | mutex_unlock(&tty->ldisc_mutex); | 710 | mutex_unlock(&tty->ldisc_mutex); |
711 | tty_unlock(tty); | 711 | tty_unlock(tty); |
712 | return retval; | 712 | return retval; |
@@ -817,7 +817,7 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
817 | */ | 817 | */ |
818 | clear_bit(TTY_LDISC, &tty->flags); | 818 | clear_bit(TTY_LDISC, &tty->flags); |
819 | tty_unlock(tty); | 819 | tty_unlock(tty); |
820 | cancel_work_sync(&tty->buf.work); | 820 | cancel_work_sync(&tty->port->buf.work); |
821 | mutex_unlock(&tty->ldisc_mutex); | 821 | mutex_unlock(&tty->ldisc_mutex); |
822 | retry: | 822 | retry: |
823 | tty_lock(tty); | 823 | tty_lock(tty); |
@@ -897,6 +897,11 @@ int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty) | |||
897 | 897 | ||
898 | static void tty_ldisc_kill(struct tty_struct *tty) | 898 | static void tty_ldisc_kill(struct tty_struct *tty) |
899 | { | 899 | { |
900 | /* There cannot be users from userspace now. But there still might be | ||
901 | * drivers holding a reference via tty_ldisc_ref. Do not steal them the | ||
902 | * ldisc until they are done. */ | ||
903 | tty_ldisc_wait_idle(tty, MAX_SCHEDULE_TIMEOUT); | ||
904 | |||
900 | mutex_lock(&tty->ldisc_mutex); | 905 | mutex_lock(&tty->ldisc_mutex); |
901 | /* | 906 | /* |
902 | * Now kill off the ldisc | 907 | * Now kill off the ldisc |