Skip to contentSkip to conversation

USB: serial: xr: fix CSIZE handling

PATCH In review Johan Hovold 2 participants 2 messages Mar 30, 2021

Subsystems (2)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

PATCH 1/1 USB: serial: xr: fix CSIZE handling

The XR21V141X does not have a 5- or 6-bit mode, but the current implementation failed to properly restore the old setting when CS5 or CS6 was requested. Instead an invalid request would be sent to the device.

Fixes c2d405aa86b4 ("USB: serial: add MaxLinear/Exar USB to Serial driver")
---
 drivers/usb/serial/xr_serial.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/serial/xr_serial.c +5 -0
index 0ca04906da4b..c59c8b47a120 100644
@@ -467,6 +467,11 @@ static void xr_set_termios(struct tty_struct *tty,
 		termios->c_cflag &= ~CSIZE;
 		if (old_termios)
 			termios->c_cflag |= old_termios->c_cflag & CSIZE;
+		else
+			termios->c_cflag |= CS8;
+
+		if (C_CSIZE(tty) == CS7)
+			bits |= XR21V141X_UART_DATA_7;
 		else
 			bits |= XR21V141X_UART_DATA_8;
 		break;
Signature · 1 line
2.26.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Johan Hovold

The XR21V141X does not have a 5- or 6-bit mode, but the current implementation failed to properly restore the old setting when CS5 or CS6 was requested. Instead an invalid request would be sent to the device.

Fixes c2d405aa86b4 ("USB: serial: add MaxLinear/Exar USB to Serial driver")

Thanks,
Mani

Quoted 23 lines
---
 drivers/usb/serial/xr_serial.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/serial/xr_serial.c +5 -0
index 0ca04906da4b..c59c8b47a120 100644
@@ -467,6 +467,11 @@ static void xr_set_termios(struct tty_struct *tty,
 		termios->c_cflag &= ~CSIZE;
 		if (old_termios)
 			termios->c_cflag |= old_termios->c_cflag & CSIZE;
+		else
+			termios->c_cflag |= CS8;
+
+		if (C_CSIZE(tty) == CS7)
+			bits |= XR21V141X_UART_DATA_7;
 		else
 			bits |= XR21V141X_UART_DATA_8;
 		break;
Signature · 1 line
2.26.3