[PATCH v3 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop

Gabriel Somlo posted 14 patches 3 years, 5 months ago
There is a newer version of this series
[PATCH v3 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop
Posted by Gabriel Somlo 3 years, 5 months ago
Calling tty_flip_buffer_push() for each individual received character
is overkill. Move it out of the rx loop, and only call it once per
set of characters received together.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
---
 drivers/tty/serial/liteuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index 047d5ad32e13..ff3486860989 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -86,10 +86,10 @@ static void liteuart_timer(struct timer_list *t)
 		/* no overflow bits in status */
 		if (!(uart_handle_sysrq_char(port, ch)))
 			uart_insert_char(port, status, 0, ch, flg);
-
-		tty_flip_buffer_push(&port->state->port);
 	}
 
+	tty_flip_buffer_push(&port->state->port);
+
 	mod_timer(&uart->timer, jiffies + uart_poll_timeout(port));
 }
 
-- 
2.37.3
Re: [PATCH v3 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop
Posted by Ilpo Järvinen 3 years, 4 months ago
On Sat, 12 Nov 2022, Gabriel Somlo wrote:

> Calling tty_flip_buffer_push() for each individual received character
> is overkill. Move it out of the rx loop, and only call it once per
> set of characters received together.
> 
> Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
> ---
>  drivers/tty/serial/liteuart.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index 047d5ad32e13..ff3486860989 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -86,10 +86,10 @@ static void liteuart_timer(struct timer_list *t)
>  		/* no overflow bits in status */
>  		if (!(uart_handle_sysrq_char(port, ch)))
>  			uart_insert_char(port, status, 0, ch, flg);
> -
> -		tty_flip_buffer_push(&port->state->port);
>  	}
>  
> +	tty_flip_buffer_push(&port->state->port);
> +
>  	mod_timer(&uart->timer, jiffies + uart_poll_timeout(port));
>  }

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

-- 
 i.