[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9192f8c-a8a6-86aa-62eb-91826163bb43@pensando.io>
Date: Thu, 29 Aug 2019 14:26:35 -0700
From: Shannon Nelson <snelson@...sando.io>
To: Thomas Bogendoerfer <tbogendoerfer@...e.de>,
Ralf Baechle <ralf@...ux-mips.org>,
Paul Burton <paul.burton@...s.com>,
James Hogan <jhogan@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 02/15] MIPS: SGI-IP27: restructure ioc3
register access
On 8/29/19 8:50 AM, Thomas Bogendoerfer wrote:
> Break up the big ioc3 register struct into functional pieces to
> make use in sub-function drivers more straightforward. And while
> doing that get rid of all volatile access by using readX/writeX.
>
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@...e.de>
> ---
> diff --git a/arch/mips/sgi-ip27/ip27-console.c b/arch/mips/sgi-ip27/ip27-console.c
> index 6bdb48d41276..5886bee89d06 100644
> --- a/arch/mips/sgi-ip27/ip27-console.c
> +++ b/arch/mips/sgi-ip27/ip27-console.c
> @@ -35,6 +35,7 @@ void prom_putchar(char c)
> {
> struct ioc3_uartregs *uart = console_uart();
>
> - while ((uart->iu_lsr & 0x20) == 0);
> - uart->iu_thr = c;
> + while ((readb(&uart->iu_lsr) & 0x20) == 0)
> + ;
> + writeb(c, &uart->iu_thr);
> }
Is it ever possible to never see your bit get set?
Instead of a tight forever spin, you might add a short delay and a retry
limit.
I see this in several other times in the following code as well. It
might be interesting to see how many times through and perhaps how many
usecs are normally spent in these loops.
Not a binding request, just a thought...
sln
Powered by blists - more mailing lists