linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Esben Haabendal <esben@geanix.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Sergey Organov <sorganov@gmail.com>,
	 Jiri Slaby <jirislaby@kernel.org>,
	 Shawn Guo <shawnguo@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>,
	 linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	 imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3] serial: imx: Introduce timeout when waiting on transmitter empty
Date: Thu, 02 May 2024 11:14:26 +0200	[thread overview]
Message-ID: <87sez060el.fsf@geanix.com> (raw)
In-Reply-To: <919647898c337a46604edcabaf13d42d80c0915d.1712837613.git.esben@geanix.com> (Esben Haabendal's message of "Thu, 11 Apr 2024 14:19:23 +0200")

Esben Haabendal <esben@geanix.com> writes:

> By waiting at most 1 second for USR2_TXDC to be set, we avoid a potential
> deadlock.
>
> In case of the timeout, there is not much we can do, so we simply ignore
> the transmitter state and optimistically try to continue.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>
> v2:
> - Fixed commit message typo
> - Remove reference to patch series it originated from. This is a
>   stand-alone patch
>
> v3:
> - Moved this version information into the correct patch section

Anything more needed in order to get this merged?

/Esben

>
>  drivers/tty/serial/imx.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index e14813250616..09c1678ddfd4 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -26,6 +26,7 @@
>  #include <linux/slab.h>
>  #include <linux/of.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/dma-mapping.h>
>  
>  #include <asm/irq.h>
> @@ -2010,7 +2011,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
>  	struct imx_port *sport = imx_uart_ports[co->index];
>  	struct imx_port_ucrs old_ucr;
>  	unsigned long flags;
> -	unsigned int ucr1;
> +	unsigned int ucr1, usr2;
>  	int locked = 1;
>  
>  	if (sport->port.sysrq)
> @@ -2041,8 +2042,8 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count)
>  	 *	Finally, wait for transmitter to become empty
>  	 *	and restore UCR1/2/3
>  	 */
> -	while (!(imx_uart_readl(sport, USR2) & USR2_TXDC));
> -
> +	read_poll_timeout_atomic(imx_uart_readl, usr2, usr2 & USR2_TXDC,
> +				 0, USEC_PER_SEC, false, sport, USR2);
>  	imx_uart_ucrs_restore(sport, &old_ucr);
>  
>  	if (locked)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-02  9:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  9:25 [PATCH 1/2] serial: imx: Introduce timeout when waiting on transmitter empty Esben Haabendal
2024-04-05  9:49 ` Marc Kleine-Budde
2024-04-05 17:22   ` Esben Haabendal
2024-04-05 17:33     ` Marc Kleine-Budde
2024-04-08  8:57       ` Esben Haabendal
2024-04-05 17:38 ` Fabio Estevam
2024-04-05 19:05   ` Sergey Organov
2024-04-08  8:56   ` Esben Haabendal
2024-04-10  7:18 ` [PATCH v2] " Esben Haabendal
2024-04-11 12:06   ` Greg Kroah-Hartman
2024-04-11 12:18     ` Esben Haabendal
2024-04-11 12:19   ` [PATCH v3] " Esben Haabendal
2024-05-02  9:14     ` Esben Haabendal [this message]
2024-05-04 16:03       ` Greg Kroah-Hartman

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=87sez060el.fsf@geanix.com \
    --to=esben@geanix.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sorganov@gmail.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).