summaryrefslogtreecommitdiff
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:17 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 15:00:40 +0100
commit807fccf71939f10855a0256f0c999d665b80263f (patch)
tree2538a12f4130704df5601201bba6570277fed00b /drivers/tty/serial/serial_core.c
parenteff37b5ea3d92c9d33a7e543460a565d17909ae4 (diff)
serial: Use B0 instead of implicit zero assumption
Compare against B0 rather than assume B0 equals zero, which is true for all archs but explicit B0 makes the code more obvious. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230309080923.11778-3-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index ee2aabcc8943..296d2c33ea7a 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1662,10 +1662,10 @@ static void uart_set_termios(struct tty_struct *tty,
cflag = tty->termios.c_cflag;
/* Handle transition to B0 status */
- if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
+ if (((old_termios->c_cflag & CBAUD) != B0) && ((cflag & CBAUD) == B0))
uart_clear_mctrl(uport, TIOCM_RTS | TIOCM_DTR);
/* Handle transition away from B0 status */
- else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
+ else if (((old_termios->c_cflag & CBAUD) == B0) && ((cflag & CBAUD) != B0)) {
unsigned int mask = TIOCM_DTR;
if (!(cflag & CRTSCTS) || !tty_throttled(tty))