summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-03-09 10:09:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 15:00:40 +0100
commit1690ca513da18b1f7de89c39faf78278d302b867 (patch)
tree9c1f3377fe771d6b25f361a94ebfa491f1673b41 /drivers/tty/serial/serial_core.c
parentb5def43a7b3e7e68d6b49a23166f8b886a26bb54 (diff)
downloadlinux-stable-1690ca513da18b1f7de89c39faf78278d302b867.tar.gz
linux-stable-1690ca513da18b1f7de89c39faf78278d302b867.tar.bz2
linux-stable-1690ca513da18b1f7de89c39faf78278d302b867.zip
serial: Rename hw_stopped to old_hw_stopped & improve logic
hw_stopped in uart_change_line_settings() stores old hw_stopped, thus rename it appropriately. Alter logic to check first if the hw_stopped was changed, and then pick which function to call if it was because the logic is more obvious that way. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230309080923.11778-8-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 31b69e61e71d..c494cb39394b 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -182,7 +182,7 @@ static void uart_change_line_settings(struct tty_struct *tty, struct uart_state
{
struct uart_port *uport = uart_port_check(state);
struct ktermios *termios;
- bool hw_stopped;
+ bool old_hw_stopped;
/*
* If we have no tty, termios, or the port does not exist,
@@ -209,14 +209,13 @@ static void uart_change_line_settings(struct tty_struct *tty, struct uart_state
uport->status |= UPSTAT_DCD_ENABLE;
/* reset sw-assisted CTS flow control based on (possibly) new mode */
- hw_stopped = uport->hw_stopped;
+ old_hw_stopped = uport->hw_stopped;
uport->hw_stopped = uart_softcts_mode(uport) &&
!(uport->ops->get_mctrl(uport) & TIOCM_CTS);
- if (uport->hw_stopped) {
- if (!hw_stopped)
+ if (uport->hw_stopped != old_hw_stopped) {
+ if (!old_hw_stopped)
uport->ops->stop_tx(uport);
- } else {
- if (hw_stopped)
+ else
__uart_start(tty);
}
spin_unlock_irq(&uport->lock);