drivers/staging/greybus/uart.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
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
On Mon, Apr 27, 2026 at 10:24:46AM +0530, Debjeet Banerjee wrote: > 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 Has this been tested? If not, I'd prefer to leave this as-is until it can be. thanks, greg k-h
On Mon, 4 May 2026 16:15:32 +0200 Greg KH wrote: > Has this been tested? If not, I'd prefer to leave this as-is until it > can be. Hi Greg, I don't have the hardware to test this. The change follows the same pattern used by other uart drivers in the kernel that clear unsupported c_cflag bits in set_termios, so the logic should be correct, but I understand your concern. If you'd prefer to wait for someone with hardware to verify it, that's fine with me. Regards, Debjeet
© 2016 - 2026 Red Hat, Inc.