linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: serial: xr: fix CSIZE handling
@ 2021-03-30 14:37 Johan Hovold
  2021-03-30 18:12 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2021-03-30 14:37 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Mauro Carvalho Chehab, Manivannan Sadhasivam, linux-usb, linux-kernel

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")
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/xr_serial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c
index 0ca04906da4b..c59c8b47a120 100644
--- a/drivers/usb/serial/xr_serial.c
+++ b/drivers/usb/serial/xr_serial.c
@@ -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;
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] USB: serial: xr: fix CSIZE handling
  2021-03-30 14:37 [PATCH] USB: serial: xr: fix CSIZE handling Johan Hovold
@ 2021-03-30 18:12 ` Manivannan Sadhasivam
  0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-30 18:12 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Mauro Carvalho Chehab, linux-usb, linux-kernel

On Tue, Mar 30, 2021 at 04:37:16PM +0200, Johan Hovold wrote:
> 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")
> Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>

Thanks,
Mani

> ---
>  drivers/usb/serial/xr_serial.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c
> index 0ca04906da4b..c59c8b47a120 100644
> --- a/drivers/usb/serial/xr_serial.c
> +++ b/drivers/usb/serial/xr_serial.c
> @@ -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;
> -- 
> 2.26.3
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-30 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 14:37 [PATCH] USB: serial: xr: fix CSIZE handling Johan Hovold
2021-03-30 18:12 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).