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: <YJbMsJ/pkcLuN0tI@lunn.ch>
Date:   Sat, 8 May 2021 19:38:56 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Ansuel Smith <ansuelsmth@...il.com>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH net-next v4 05/28] net: dsa: qca8k: use iopoll macro
 for qca8k_busy_wait

On Sat, May 08, 2021 at 02:28:55AM +0200, Ansuel Smith wrote:
> Use iopoll macro instead of while loop.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
> ---
>  drivers/net/dsa/qca8k.c | 23 +++++++++++------------
>  drivers/net/dsa/qca8k.h |  2 ++
>  2 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> index 0b295da6c356..0bfb7ae4c128 100644
> --- a/drivers/net/dsa/qca8k.c
> +++ b/drivers/net/dsa/qca8k.c
> @@ -262,21 +262,20 @@ static struct regmap_config qca8k_regmap_config = {
>  static int
>  qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask)
>  {
> -	unsigned long timeout;
> -
> -	timeout = jiffies + msecs_to_jiffies(20);
> +	u32 val;
> +	int ret;
>  
> -	/* loop until the busy flag has cleared */
> -	do {
> -		u32 val = qca8k_read(priv, reg);
> -		int busy = val & mask;
> +	ret = read_poll_timeout(qca8k_read, val, !(val & mask),
> +				0, QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false,
> +				priv, reg);
>  
> -		if (!busy)
> -			break;
> -		cond_resched();
> -	} while (!time_after_eq(jiffies, timeout));
> +	/* Check if qca8k_read has failed for a different reason
> +	 * before returnting -ETIMEDOUT

returning

With that fixed

Reviewed-by: Andrew Lunn <andrew@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ