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.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index c5782294e532..d794087c327e 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -64,7 +64,9 @@ static void put_ldisc(struct tty_ldisc *ld)
64 return; 64 return;
65 } 65 }
66 raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags); 66 raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
67 wake_up(&ld->wq_idle); 67
68 if (waitqueue_active(&ld->wq_idle))
69 wake_up(&ld->wq_idle);
68} 70}
69 71
70/** 72/**
@@ -934,17 +936,17 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
934 * race with the set_ldisc code path. 936 * race with the set_ldisc code path.
935 */ 937 */
936 938
937 tty_lock_pair(tty, o_tty);
938 tty_ldisc_halt(tty); 939 tty_ldisc_halt(tty);
939 tty_ldisc_flush_works(tty); 940 if (o_tty)
940 if (o_tty) {
941 tty_ldisc_halt(o_tty); 941 tty_ldisc_halt(o_tty);
942
943 tty_ldisc_flush_works(tty);
944 if (o_tty)
942 tty_ldisc_flush_works(o_tty); 945 tty_ldisc_flush_works(o_tty);
943 }
944 946
947 tty_lock_pair(tty, o_tty);
945 /* This will need doing differently if we need to lock */ 948 /* This will need doing differently if we need to lock */
946 tty_ldisc_kill(tty); 949 tty_ldisc_kill(tty);
947
948 if (o_tty) 950 if (o_tty)
949 tty_ldisc_kill(o_tty); 951 tty_ldisc_kill(o_tty);
950 952