提交 49a5f3cf 编写于 作者: J Jiri Slaby 提交者: Linus Torvalds

TTY: pdc_cons, fix regression in close

The test in pdc_console_tty_close '!tty->count' was always wrong
because tty->count is decremented after tty->ops->close is called and
thus can never be zero. Hence the 'then' branch was never executed and
the timer never deleted.

This did not matter until commit 5dd5bc40 ("TTY: pdc_cons, use
tty_port").  There we needed to set TTY in tty_port to NULL, but this
never happened due to the bug above.

So change the test to really trigger at the last close by changing the
condition to 'tty->count == 1'.

Well, the driver should not touch tty->count at all.  It should use
tty_port->count and count open count there itself.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Reported-and-tested-by: NMikulas Patocka <mpatocka@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 1c2f9548
...@@ -104,7 +104,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -104,7 +104,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
{ {
if (!tty->count) { if (tty->count == 1) {
del_timer_sync(&pdc_console_timer); del_timer_sync(&pdc_console_timer);
tty_port_tty_set(&tty_port, NULL); tty_port_tty_set(&tty_port, NULL);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册