linux-serial.vger.kernel.org archive mirror
 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>,
	"Tobias Klauser" <tklauser@distanz.ch>,
	"Richard Genoud" <richard.genoud@gmail.com>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Claudiu Beznea" <claudiu.beznea@microchip.com>,
	"Vladimir Zapolskiy" <vz@mleia.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Manivannan Sadhasivam" <mani@kernel.org>
Subject: Re: [PATCH v4 09/10] tty: serial: use uart_port_tx() helper
Date: Tue, 20 Sep 2022 11:54:12 +0300 (EEST)	[thread overview]
Message-ID: <87251b8a-d955-e6dd-94df-c7621e72bac@linux.intel.com> (raw)
In-Reply-To: <20220920052049.20507-10-jslaby@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 2271 bytes --]

On Tue, 20 Sep 2022, Jiri Slaby wrote:

> uart_port_tx() is a new helper to send characters to the device. Use it
> in these drivers.
> 
> Cc: Tobias Klauser <tklauser@distanz.ch>
> Cc: Richard Genoud <richard.genoud@gmail.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
> Cc: Vladimir Zapolskiy <vz@mleia.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <mani@kernel.org>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---

> diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
> index b1cd9a76dd93..53b642ea46ba 100644
> --- a/drivers/tty/serial/mcf.c
> +++ b/drivers/tty/serial/mcf.c
> @@ -327,29 +327,13 @@ static void mcf_rx_chars(struct mcf_uart *pp)
>  static void mcf_tx_chars(struct mcf_uart *pp)
>  {
>  	struct uart_port *port = &pp->port;
> -	struct circ_buf *xmit = &port->state->xmit;
> -
> -	if (port->x_char) {
> -		/* Send special char - probably flow control */
> -		writeb(port->x_char, port->membase + MCFUART_UTB);
> -		port->x_char = 0;
> -		port->icount.tx++;
> -		return;
> -	}
> -
> -	while (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) {
> -		if (uart_circ_empty(xmit))
> -			break;
> -		writeb(xmit->buf[xmit->tail], port->membase + MCFUART_UTB);
> -		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE -1);
> -		port->icount.tx++;
> -	}
> -
> -	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
> -		uart_write_wakeup(port);
> +	unsigned int pending;
> +	u8 ch;
>  
> -	if (uart_circ_empty(xmit)) {
> -		mcf_stop_tx(port);
> +	pending = uart_port_tx(port, ch,
> +		readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY,
> +		writeb(ch, port->membase + MCFUART_UTB));
> +	if (!pending) {

Why unsigned int pending here and bool pending in the other cases?

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


-- 
 i.

  reply	other threads:[~2022-09-20  8:54 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
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 [this message]
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=87251b8a-d955-e6dd-94df-c7621e72bac@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=afaerber@suse.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mani@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=richard.genoud@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=tklauser@distanz.ch \
    --cc=vz@mleia.com \
    /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;
as well as URLs for NNTP newsgroup(s).