lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03467516-3962-4ff2-23d2-2b3a1d647c5a@kernel.org>
Date:   Thu, 23 Jun 2022 09:41:24 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        William Hubbs <w.d.hubbs@...il.com>,
        Chris Brannon <chris@...-brannons.com>,
        Kirk Reiser <kirk@...sers.ca>,
        Samuel Thibault <samuel.thibault@...-lyon.org>,
        "David S. Miller" <davem@...emloft.net>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        speakup@...ux-speakup.org, sparclinux@...r.kernel.org
Subject: Re: [PATCH v2 6/6] serial: Consolidate BOTH_EMPTY use

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@...ux.intel.com>

Reviewed-by: Jiri Slaby <jirislaby@...nel.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ