summaryrefslogtreecommitdiff
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-10 06:42:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-10 06:42:04 +0300
commit394e849b83463869e2267ea7acea002366e6fefc (patch)
tree917ec5c564964d781ffbda2917efdf7cde252c72 /drivers/tty/n_tty.c
parent98267d33e2da8cd386212856a22f4a64b32834ab (diff)
parent206c5f60a3d902bc4b56dab2de3e88de5eb06108 (diff)
downloadlinux-394e849b83463869e2267ea7acea002366e6fefc.tar.xz
Merge 3.18-rc4 into tty-next.
This resolves a merge issue with drivers/tty/serial/8250/8250_mtk.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 112eda7c56bc..8358daa865e5 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2406,12 +2406,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
poll_wait(file, &tty->read_wait, wait);
poll_wait(file, &tty->write_wait, wait);
+ if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
+ mask |= POLLHUP;
if (input_available_p(tty, 1))
mask |= POLLIN | POLLRDNORM;
+ else if (mask & POLLHUP) {
+ tty_flush_to_ldisc(tty);
+ if (input_available_p(tty, 1))
+ mask |= POLLIN | POLLRDNORM;
+ }
if (tty->packet && tty->link->ctrl_status)
mask |= POLLPRI | POLLIN | POLLRDNORM;
- if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
- mask |= POLLHUP;
if (tty_hung_up_p(file))
mask |= POLLHUP;
if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {