From: Debjeet Banerjee <debjeetbanerjee48@gmail.com>
To: gregkh@linuxfoundation.org
Cc: debjeetbanerjee48@gmail.com, dtwlin@gmail.com, elder@kernel.org,
greybus-dev@lists.linaro.org, johan@kernel.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH v2] staging: greybus: uart: clear unsupported c_cflag bits in set_termios
Date: Mon, 27 Apr 2026 10:24:46 +0530 [thread overview]
Message-ID: <20260427045446.16430-1-debjeetbanerjee48@gmail.com> (raw)
In-Reply-To: <2026042618-whole-cassette-b15e@gregkh>
gb_tty_set_termios() derives UART line configuration from a subset of
termios->c_cflag bits (CSIZE, CSTOPB, PARENB, PARODD, CMSPAR, CRTSCTS,
CLOCAL and CBAUD). Other bits are not interpreted by the driver and are
not represented in the Greybus UART protocol.
Mask unsupported c_cflag bits so that userspace-visible termios
reflects the supported bits implemented by the driver.
This addresses the existing FIXME.
Signed-off-by: Debjeet Banerjee <debjeetbanerjee48@gmail.com>
---
v2:
- Clear unsupported c_cflag bits as suggested
- Update comment to mention the change
---
drivers/staging/greybus/uart.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 7d060b4cd33d..9c10e6baa7e0 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -495,7 +495,24 @@ static void gb_tty_set_termios(struct tty_struct *tty,
newline.data_bits = tty_get_char_size(termios->c_cflag);
- /* FIXME: needs to clear unsupported bits in the termios */
+ /*
+ * The Greybus UART driver only interprets a subset of termios
+ * c_cflag bits when configuring line settings:
+ *
+ * - CSIZE via tty_get_char_size() for data bits
+ * - CSTOPB for stop-bit format
+ * - PARENB, PARODD, CMSPAR for parity encoding
+ * - CRTSCTS for hardware flow control
+ * - CLOCAL for modem control handling
+ * - CBAUD via C_BAUD() for baud rate and B0 semantics
+ *
+ * Mask unsupported c_cflag bits.
+ */
+ termios->c_cflag &= (CSIZE | CSTOPB |
+ PARENB | PARODD | CMSPAR |
+ CLOCAL | CRTSCTS |
+ CBAUD);
+
gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0);
if (C_BAUD(tty) == B0) {
--
2.53.0
prev parent reply other threads:[~2026-04-27 4:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 3:26 [PATCH] staging: greybus: uart: document c_cflag handling in set_termios Debjeet Banerjee
2026-04-26 19:16 ` Greg KH
2026-04-27 4:15 ` Debjeet Banerjee
2026-04-27 4:54 ` Debjeet Banerjee [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260427045446.16430-1-debjeetbanerjee48@gmail.com \
--to=debjeetbanerjee48@gmail.com \
--cc=dtwlin@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox