lkml.org 
[lkml]   [2023]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/8] serial: Use B0 instead of implicit zero assumption
Date
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>
---
drivers/tty/serial/serial_core.c | 4 ++--
1 file 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))
--
2.30.2
\
 
 \ /
  Last update: 2023-03-27 00:51    [W:0.040 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site