public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Esben Haabendal <esben@geanix.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-rt-users@vger.kernel.org,  John Ogness <john.ogness@linutronix.de>
Subject: Re: [RFC PATCH v2 1/2] serial: imx: Introduce timeout when waiting on transmitter empty
Date: Fri, 05 Apr 2024 10:32:17 +0200	[thread overview]
Message-ID: <87a5m85hwu.fsf@geanix.com> (raw)
In-Reply-To: <20240405-lapdog-poison-a8b812f9d588-mkl@pengutronix.de> (Marc Kleine-Budde's message of "Fri, 5 Apr 2024 10:06:05 +0200")

Marc Kleine-Budde <mkl@pengutronix.de> writes:

> On 05.04.2024 09:56:37, Esben Haabendal wrote:
>> By waiting at most 1 second for USR2_TXDC to be set, we avoid a potentital
>> 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>
>
> For the next round you should consult "scripts/get_maintainer.pl
> drivers/tty/serial/imx.c" and add these people/lists on Cc.

Yes. The idea was to do the RFC here on linux-rt, with focus on the 2nd
patch in the series. When that is in good shape, I will send the first
patch separately to all the proper maintainers and lists.

>> ---
>>  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 54b760d845c0..f7e4f38f08f3 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>
>> @@ -1995,7 +1996,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)
>> @@ -2026,8 +2027,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, 1000000, false, sport, USR2);
>
> You can make use of USEC_PER_SEC here.
>
> After fixing this, feel free to add my:
>
> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>

Thanks.

/Esben

  reply	other threads:[~2024-04-05  8:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  7:56 [RFC PATCH v2 0/2] serial: imx: Switch to nbcon console Esben Haabendal
2024-04-05  7:56 ` [RFC PATCH v2 1/2] serial: imx: Introduce timeout when waiting on transmitter empty Esben Haabendal
2024-04-05  8:06   ` Marc Kleine-Budde
2024-04-05  8:32     ` Esben Haabendal [this message]
2024-04-05  7:56 ` [RFC PATCH v2 2/2] serial: imx: Switch to nbcon console Esben Haabendal
2024-04-15 10:28   ` John Ogness
2024-09-13  6:54     ` Esben Haabendal
2024-09-13  7:59       ` John Ogness
2024-09-13  8:29         ` Esben Haabendal
2024-04-05  8:43 ` [RFC PATCH v2 0/2] " Marc Kleine-Budde

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=87a5m85hwu.fsf@geanix.com \
    --to=esben@geanix.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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