serial: core: Do stop_rx in suspend path for console if console_suspend is disabled

For the case of console_suspend disabled, if back to back suspend/resume
test is executed, at the end of test, sometimes console would appear to
be frozen not responding to input. This would happen because, during
resume, rx transactions can come in before system is ready, malfunction
of rx happens in turn resulting in console appearing to be stuck.

Do a stop_rx in suspend sequence to prevent this.

Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Link: https://lore.kernel.org/r/1652692810-31148-1-git-send-email-quic_vnivarth@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Vijaya Krishna Nivarthi 2022-05-16 14:50:10 +05:30 committed by Greg Kroah-Hartman
parent c2194bc999
commit c9d2325cdb

View File

@ -2211,9 +2211,16 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
} }
put_device(tty_dev); put_device(tty_dev);
/* Nothing to do if the console is not suspending */ /*
if (!console_suspend_enabled && uart_console(uport)) * Nothing to do if the console is not suspending
* except stop_rx to prevent any asynchronous data
* over RX line. Re-start_rx, when required, is
* done by set_termios in resume sequence
*/
if (!console_suspend_enabled && uart_console(uport)) {
uport->ops->stop_rx(uport);
goto unlock; goto unlock;
}
uport->suspended = 1; uport->suspended = 1;