lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bf84598f-0a20-31bf-4967-d01db6fae700@linux.intel.com>
Date: Wed, 11 Jun 2025 15:29:21 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
    linux-serial <linux-serial@...r.kernel.org>, 
    LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 18/33] serial: 8250: extract serial8250_set_mini()

On Wed, 11 Jun 2025, Jiri Slaby (SUSE) wrote:

> serial8250_do_set_termios() consists of many registers and up flags
> settings. Extract all these into separate functions. This time, setting
> of CSIZE for UART_CAP_MINI ports.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@...nel.org>
> ---
>  drivers/tty/serial/8250/8250_port.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index a73f4db22feb..edfbaa6b7a1b 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2670,6 +2670,22 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk)
>  }
>  EXPORT_SYMBOL_GPL(serial8250_update_uartclk);
>  
> +static void serial8250_set_mini(struct uart_port *port, struct ktermios *termios)
> +{
> +	struct uart_8250_port *up = up_to_u8250p(port);
> +
> +	if (!(up->capabilities & UART_CAP_MINI))
> +		return;
> +
> +	termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR);
> +
> +	tcflag_t csize = termios->c_cflag & CSIZE;
> +	if (csize == CS5 || csize == CS6) {
> +		termios->c_cflag &= ~CSIZE;
> +		termios->c_cflag |= CS7;
> +	}
> +}
> +
>  void
>  serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
>  		          const struct ktermios *old)
> @@ -2679,14 +2695,8 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
>  	unsigned long flags;
>  	unsigned int baud, quot, frac = 0;
>  
> -	if (up->capabilities & UART_CAP_MINI) {
> -		termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR);
> -		if ((termios->c_cflag & CSIZE) == CS5 ||
> -		    (termios->c_cflag & CSIZE) == CS6)
> -			termios->c_cflag = (termios->c_cflag & ~CSIZE) | CS7;
> -	}
> +	serial8250_set_mini(port, termios);
>  	cval = serial8250_compute_lcr(up, termios->c_cflag);
> -
>  	baud = serial8250_get_baud_rate(port, termios, old);
>  	quot = serial8250_get_divisor(port, baud, &frac);
>  
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ