diff options
author | Serge Semin <fancer.lancer@gmail.com> | 2019-05-08 13:44:41 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-18 09:52:26 +0200 |
commit | 13b18d35909707571af9539f7731389fbf0feb31 (patch) | |
tree | 23584fe83457705e3155f5890179ead204cea31e /drivers/rtc/rtc-rs5c348.c | |
parent | 42912081481c6303d880f315223f725ee813c8f1 (diff) | |
download | linux-13b18d35909707571af9539f7731389fbf0feb31.tar.gz linux-13b18d35909707571af9539f7731389fbf0feb31.tar.bz2 linux-13b18d35909707571af9539f7731389fbf0feb31.zip |
tty: serial_core: Set port active bit in uart_port_activate
A bug was introduced by commit b3b576461864 ("tty: serial_core: convert
uart_open to use tty_port_open"). It caused a constant warning printed
into the system log regarding the tty and port counter mismatch:
[ 21.644197] ttyS ttySx: tty_port_close_start: tty->count = 1 port count = 2
in case if session hangup was detected so the warning is printed starting
from the second open-close iteration.
Particularly the problem was discovered in situation when there is a
serial tty device without hardware back-end being setup. It is considered
by the tty-serial subsystems as a hardware problem with session hang up.
In this case uart_startup() will return a positive value with TTY_IO_ERROR
flag set in corresponding tty_struct instance. The same value will get
passed to be returned from the activate() callback and then being returned
from tty_port_open(). But since in this case tty_port_block_til_ready()
isn't called the TTY_PORT_ACTIVE flag isn't set (while the method had been
called before tty_port_open conversion was introduced and the rest of the
subsystem code expected the bit being set in this case), which prevents the
uart_hangup() method to perform any cleanups including the tty port
counter setting to zero. So the next attempt to open/close the tty device
will discover the counters mismatch.
In order to fix the problem we need to manually set the TTY_PORT_ACTIVE
flag in case if uart_startup() returned a positive value. In this case
the hang up procedure will perform a full set of cleanup actions including
the port ref-counter resetting.
Fixes: b3b576461864 "tty: serial_core: convert uart_open to use tty_port_open"
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/rtc/rtc-rs5c348.c')
0 files changed, 0 insertions, 0 deletions