Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	linux-serial@vger.kernel.org,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"William Hubbs" <w.d.hubbs@gmail.com>,
	"Chris Brannon" <chris@the-brannons.com>,
	"Kirk Reiser" <kirk@reisers.ca>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	speakup@linux-speakup.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH v2 6/6] serial: Consolidate BOTH_EMPTY use
Date: Thu, 23 Jun 2022 09:41:24 +0200	[thread overview]
Message-ID: <03467516-3962-4ff2-23d2-2b3a1d647c5a@kernel.org> (raw)
In-Reply-To: <20220621124958.3342-7-ilpo.jarvinen@linux.intel.com>

On 21. 06. 22, 14:49, Ilpo Järvinen wrote:
> Per file BOTH_EMPTY defines are littering our source code here and
> there. Define once in serial.h and create helper for the check
> too.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> --- a/arch/mips/ath79/early_printk.c
> +++ b/arch/mips/ath79/early_printk.c
> @@ -8,6 +8,7 @@
>   
>   #include <linux/io.h>
>   #include <linux/errno.h>
> +#include <linux/serial.h>
>   #include <linux/serial_reg.h>
>   #include <asm/addrspace.h>
>   #include <asm/setup.h>
> @@ -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.
* prom_putchar_wait() should be implemented using
   read_poll_timeout_atomic(), incl. failure/timeout handling.

thanks,
-- 
js
suse labs

  reply	other threads:[~2022-06-23  7:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220621124958.3342-1-ilpo.jarvinen@linux.intel.com>
2022-06-21 12:49 ` [PATCH v2 6/6] serial: Consolidate BOTH_EMPTY use Ilpo Järvinen
2022-06-23  7:41   ` Jiri Slaby [this message]
     [not found]     ` <CAHp75VeKhY6dN7j_yXQXUMhOqRwqQ2yN_qF95U9wU6K4uKPdaQ@mail.gmail.com>
2022-06-23  8:24       ` Jiri Slaby
2022-06-23 10:15         ` Andy Shevchenko
2022-06-23 10:17           ` Andy Shevchenko
2022-07-04  6:59             ` Jiri Slaby
2022-06-24 21:09     ` Ilpo Järvinen

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=03467516-3962-4ff2-23d2-2b3a1d647c5a@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=chris@the-brannons.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=speakup@linux-speakup.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=w.d.hubbs@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