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: <4acd99f5-86eb-e0c8-a9ca-a4f5c7e07393@linux.intel.com>
Date:   Tue, 15 Nov 2022 17:48:01 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     Gabriel Somlo <gsomlo@...il.com>
cc:     LKML <linux-kernel@...r.kernel.org>,
        linux-serial <linux-serial@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>, kgugala@...micro.com,
        mholenko@...micro.com, joel@....id.au,
        david.abdurachmanov@...il.com, florent@...oy-digital.fr,
        geert@...ux-m68k.org
Subject: Re: [PATCH v3 11/14] serial: liteuart: move function definitions

On Sat, 12 Nov 2022, Gabriel Somlo wrote:

> Move definitions for liteuart_[stop|start]_tx(), liteuart_stop_rx(),
> and liteuart_putchar() to a more convenient location in preparation
> for adding IRQ support. This patch contains no functional changes.
> 
> Signed-off-by: Gabriel Somlo <gsomlo@...il.com>
> ---
>  drivers/tty/serial/liteuart.c | 98 +++++++++++++++++------------------
>  1 file changed, 49 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index 172ac190ba2f..cf1ce597b45e 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -67,36 +67,6 @@ static struct uart_driver liteuart_driver = {
>  #endif
>  };
>  
> -static void liteuart_rx_chars(struct uart_port *port)
> -{
> -	unsigned char __iomem *membase = port->membase;
> -	unsigned int status, ch;
> -
> -	while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) {
> -		ch = litex_read8(membase + OFF_RXTX);
> -		port->icount.rx++;
> -
> -		/* necessary for RXEMPTY to refresh its value */
> -		litex_write8(membase + OFF_EV_PENDING, EV_RX);
> -
> -		/* no overflow bits in status */
> -		if (!(uart_handle_sysrq_char(port, ch)))
> -			uart_insert_char(port, status, 0, ch, TTY_NORMAL);
> -	}
> -
> -	tty_flip_buffer_push(&port->state->port);
> -}
> -
> -static void liteuart_timer(struct timer_list *t)
> -{
> -	struct liteuart_port *uart = from_timer(uart, t, timer);
> -	struct uart_port *port = &uart->port;
> -
> -	liteuart_rx_chars(port);
> -
> -	mod_timer(&uart->timer, jiffies + uart_poll_timeout(port));
> -}
> -
>  static void liteuart_putchar(struct uart_port *port, unsigned char ch)
>  {
>  	while (litex_read8(port->membase + OFF_TXFULL))
> @@ -105,25 +75,6 @@ static void liteuart_putchar(struct uart_port *port, unsigned char ch)
>  	litex_write8(port->membase + OFF_RXTX, ch);
>  }
>  
> -static unsigned int liteuart_tx_empty(struct uart_port *port)
> -{
> -	/* not really tx empty, just checking if tx is not full */
> -	if (!litex_read8(port->membase + OFF_TXFULL))
> -		return TIOCSER_TEMT;
> -
> -	return 0;
> -}
> -
> -static void liteuart_set_mctrl(struct uart_port *port, unsigned int mctrl)
> -{
> -	/* modem control register is not present in LiteUART */
> -}
> -
> -static unsigned int liteuart_get_mctrl(struct uart_port *port)
> -{
> -	return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
> -}
> -
>  static void liteuart_stop_tx(struct uart_port *port)
>  {
>  	/* not used in LiteUART, but called unconditionally from serial_core */
> @@ -159,6 +110,55 @@ static void liteuart_stop_rx(struct uart_port *port)
>  	del_timer(&uart->timer);
>  }
>  
> +static void liteuart_rx_chars(struct uart_port *port)
> +{
> +	unsigned char __iomem *membase = port->membase;
> +	unsigned int status, ch;
> +
> +	while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) {
> +		ch = litex_read8(membase + OFF_RXTX);
> +		port->icount.rx++;
> +
> +		/* necessary for RXEMPTY to refresh its value */
> +		litex_write8(membase + OFF_EV_PENDING, EV_RX);
> +
> +		/* no overflow bits in status */
> +		if (!(uart_handle_sysrq_char(port, ch)))
> +			uart_insert_char(port, status, 0, ch, TTY_NORMAL);
> +	}
> +
> +	tty_flip_buffer_push(&port->state->port);
> +}
> +
> +static void liteuart_timer(struct timer_list *t)
> +{
> +	struct liteuart_port *uart = from_timer(uart, t, timer);
> +	struct uart_port *port = &uart->port;
> +
> +	liteuart_rx_chars(port);
> +
> +	mod_timer(&uart->timer, jiffies + uart_poll_timeout(port));
> +}
> +
> +static unsigned int liteuart_tx_empty(struct uart_port *port)
> +{
> +	/* not really tx empty, just checking if tx is not full */
> +	if (!litex_read8(port->membase + OFF_TXFULL))
> +		return TIOCSER_TEMT;
> +
> +	return 0;
> +}
> +
> +static void liteuart_set_mctrl(struct uart_port *port, unsigned int mctrl)
> +{
> +	/* modem control register is not present in LiteUART */
> +}
> +
> +static unsigned int liteuart_get_mctrl(struct uart_port *port)
> +{
> +	return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
> +}
> +
>  static int liteuart_startup(struct uart_port *port)
>  {
>  	struct liteuart_port *uart = to_liteuart_port(port);
> 

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