public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 04/10] tty: serial: extract lqasc_tx_ready() from lqasc_tx_chars()
Date: Tue, 20 Sep 2022 11:03:02 +0300 (EEST)	[thread overview]
Message-ID: <84e9274-7012-ef18-716c-b373221e7cb2@linux.intel.com> (raw)
In-Reply-To: <20220920052049.20507-5-jslaby@suse.cz>

On Tue, 20 Sep 2022, Jiri Slaby wrote:

> The condition in lqasc_tx_chars()'s loop is barely readable. Extract it
> to a separate function. This will make the cleanup in the next patches
> easier too.
> 
> (Put it before lqasc_start_tx(), so that we can use it there later.)
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> 
> Notes:
>     [v4] this is new in v4 -- extracted as a separate change
> 
>  drivers/tty/serial/lantiq.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c
> index 6637b3caa6b7..6da1b7496c6c 100644
> --- a/drivers/tty/serial/lantiq.c
> +++ b/drivers/tty/serial/lantiq.c
> @@ -139,6 +139,13 @@ lqasc_stop_tx(struct uart_port *port)
>  	return;
>  }
>  
> +static bool lqasc_tx_ready(struct uart_port *port)
> +{
> +	u32 fstat = __raw_readl(port->membase + LTQ_ASC_FSTAT);
> +
> +	return (fstat & ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF;

FIELD_GET(ASCFSTAT_TXFREEMASK, fstat)

> +}
> +
>  static void
>  lqasc_start_tx(struct uart_port *port)
>  {
> @@ -228,8 +235,7 @@ lqasc_tx_chars(struct uart_port *port)
>  		return;
>  	}
>  
> -	while (((__raw_readl(port->membase + LTQ_ASC_FSTAT) &
> -		ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF) != 0) {
> +	while (lqasc_tx_ready(port)) {
>  		if (port->x_char) {
>  			writeb(port->x_char, port->membase + LTQ_ASC_TBUF);
>  			port->icount.tx++;

There's similar construct in lqasc_console_putchar() that could take 
advantage of the same helper.

With FIELD_GET + the other place using the new helper, ASCFSTAT_TXFREEOFF 
can be dropped as well.


-- 
 i.


  reply	other threads:[~2022-09-20  8:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  5:20 [PATCH v4 00/10] tty: TX helpers Jiri Slaby
2022-09-20  5:20 ` [PATCH v4 01/10] tty: serial: move and cleanup vt8500_tx_empty() Jiri Slaby
2022-09-20  7:53   ` Ilpo Järvinen
2022-09-20  5:20 ` [PATCH v4 02/10] tty: serial: clean up stop-tx part in altera_uart_tx_chars() Jiri Slaby
2022-09-20  8:03   ` Ilpo Järvinen
2022-09-20 14:17   ` Tobias Klauser
2022-09-20  5:20 ` [PATCH v4 03/10] tty: serial: altera_uart_{r,t}x_chars() need only uart_port Jiri Slaby
2022-09-20  8:04   ` Ilpo Järvinen
2022-09-20 14:15   ` Tobias Klauser
2022-09-20  5:20 ` [PATCH v4 04/10] tty: serial: extract lqasc_tx_ready() from lqasc_tx_chars() Jiri Slaby
2022-09-20  8:03   ` Ilpo Järvinen [this message]
2022-09-20  5:20 ` [PATCH v4 05/10] tty: serial: extract tx_ready() from __serial_lpc32xx_tx() Jiri Slaby
2022-09-20  8:11   ` Ilpo Järvinen
2022-09-20  5:20 ` [PATCH v4 06/10] tty: serial: switch mpc52xx_uart_int_{r,t}x_chars() to bool Jiri Slaby
2022-09-20  8:37   ` Ilpo Järvinen
2022-09-20  5:20 ` [PATCH v4 07/10] tty: serial: extract serial_omap_put_char() from transmit_chars() Jiri Slaby
2022-09-20  8:37   ` Ilpo Järvinen
2022-09-20  5:20 ` [PATCH v4 08/10] tty: serial: introduce transmit helpers Jiri Slaby
2022-09-20  8:43   ` Ilpo Järvinen
2022-09-20  5:20 ` [PATCH v4 09/10] tty: serial: use uart_port_tx() helper Jiri Slaby
2022-09-20  8:54   ` Ilpo Järvinen
2022-09-20  8:56     ` Jiri Slaby
2022-09-20  7:58 ` [PATCH v4 10/10] tty: serial: use uart_port_tx_limited() Jiri Slaby
2022-09-20  9:19   ` Ilpo Järvinen
2022-09-20 10:58     ` Jiri Slaby
2022-09-22 14:15 ` [PATCH v4 00/10] tty: TX helpers Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84e9274-7012-ef18-716c-b373221e7cb2@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox