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: <397ab91c-c05c-4dad-db94-866f500458fb@linux.intel.com>
Date: Wed, 11 Jun 2025 14:53:30 +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 13/33] serial: 8250: extract
 serial8250_startup_special()

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

> Let the serial8250_do_startup() code handle the special ports (16C950,
> DA830, RSA) startup in a separate function:
> serial8250_startup_special().
> 
> And instead of multiple if-else-if, use switch-case. So that it can be
> easily checked for PORT_RSA now too.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@...nel.org>

Another very nice cleanup for old cruft.

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

-- 
 i.

> ---
>  drivers/tty/serial/8250/8250_port.c | 53 +++++++++++++++++------------
>  1 file changed, 32 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 476f5fc50237..21ff56a31b56 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2111,27 +2111,13 @@ static void serial8250_put_poll_char(struct uart_port *port,
>  
>  #endif /* CONFIG_CONSOLE_POLL */
>  
> -int serial8250_do_startup(struct uart_port *port)
> +static void serial8250_startup_special(struct uart_port *port)
>  {
>  	struct uart_8250_port *up = up_to_u8250p(port);
>  	unsigned long flags;
> -	unsigned char iir;
> -	int retval;
> -	u16 lsr;
> -
> -	if (!port->fifosize)
> -		port->fifosize = uart_config[port->type].fifo_size;
> -	if (!up->tx_loadsz)
> -		up->tx_loadsz = uart_config[port->type].tx_loadsz;
> -	if (!up->capabilities)
> -		up->capabilities = uart_config[port->type].flags;
> -	up->mcr = 0;
> -
> -	if (port->iotype != up->cur_iotype)
> -		set_io_from_upio(port);
>  
> -	serial8250_rpm_get(up);
> -	if (port->type == PORT_16C950) {
> +	switch (port->type) {
> +	case PORT_16C950:
>  		/*
>  		 * Wake up and initialize UART
>  		 *
> @@ -2148,9 +2134,8 @@ int serial8250_do_startup(struct uart_port *port)
>  		serial_port_out(port, UART_EFR, UART_EFR_ECB);
>  		serial_port_out(port, UART_LCR, 0);
>  		uart_port_unlock_irqrestore(port, flags);
> -	}
> -
> -	if (port->type == PORT_DA830) {
> +		break;
> +	case PORT_DA830:
>  		/*
>  		 * Reset the port
>  		 *
> @@ -2167,9 +2152,35 @@ int serial8250_do_startup(struct uart_port *port)
>  				UART_DA830_PWREMU_MGMT_UTRST |
>  				UART_DA830_PWREMU_MGMT_URRST |
>  				UART_DA830_PWREMU_MGMT_FREE);
> +		break;
> +	case PORT_RSA:
> +		rsa_enable(up);
> +		break;
>  	}
> +}
> +
> +int serial8250_do_startup(struct uart_port *port)
> +{
> +	struct uart_8250_port *up = up_to_u8250p(port);
> +	unsigned long flags;
> +	unsigned char iir;
> +	int retval;
> +	u16 lsr;
> +
> +	if (!port->fifosize)
> +		port->fifosize = uart_config[port->type].fifo_size;
> +	if (!up->tx_loadsz)
> +		up->tx_loadsz = uart_config[port->type].tx_loadsz;
> +	if (!up->capabilities)
> +		up->capabilities = uart_config[port->type].flags;
> +	up->mcr = 0;
> +
> +	if (port->iotype != up->cur_iotype)
> +		set_io_from_upio(port);
> +
> +	serial8250_rpm_get(up);
>  
> -	rsa_enable(up);
> +	serial8250_startup_special(port);
>  
>  	/*
>  	 * Clear the FIFO buffers and disable them.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ