lkml.org 
[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 6/6] serial: Consolidate BOTH_EMPTY use
On Thu, 23 Jun 2022, Jiri Slaby wrote:

> > --- a/arch/mips/ath79/early_printk.c
> > +++ b/arch/mips/ath79/early_printk.c
> > @@ -29,15 +30,15 @@ static inline void prom_putchar_wait(void __iomem *reg,
> > u32 mask, u32 val)
> > } while (1);
> > }
> > -#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> > -
> > static void prom_putchar_ar71xx(char ch)
> > {
> > void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
> > - prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
> > + prom_putchar_wait(base + UART_LSR * 4, UART_LSR_BOTH_EMPTY,
> > + UART_LSR_BOTH_EMPTY);
> > __raw_writel((unsigned char)ch, base + UART_TX * 4);
> > - prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
> > + prom_putchar_wait(base + UART_LSR * 4, UART_LSR_BOTH_EMPTY,
> > + UART_LSR_BOTH_EMPTY);
>
> Two observations apart from this patch:
> * prom_putchar_wait()'s last two parameters are always the same.
> One should be removed, i.e. all this simplified.

I noticed this myself but I'm also looking into generalizing wait for tx
empty somehow if possible (it might not help much here though as this
seems to be on "early" side of things).

--
i.


> * prom_putchar_wait() should be implemented using
> read_poll_timeout_atomic(), incl. failure/timeout handling.
>
> thanks,
>

\
 
 \ /
  Last update: 2022-06-24 23:10    [W:0.067 / U:3.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site