• Jiri Slaby's avatar
    TTY: pdc_cons, fix regression in close · 49a5f3cf
    Jiri Slaby authored
    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: default avatarJiri Slaby <jslaby@suse.cz>
    Reported-and-tested-by: default avatarMikulas 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: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    49a5f3cf
pdc_cons.c 7.66 KB