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]
Date:   Fri, 24 Sep 2021 14:34:42 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Claudiu Beznea <claudiu.beznea@...rochip.com>,
        eugen.hristev@...rochip.com, ulf.hansson@...aro.org,
        nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
        ludovic.desroches@...rochip.com
Cc:     linux-mmc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] mmc: sdhci-of-at91: replace while loop with
 read_poll_timeout

On 24/09/21 11:28 am, Claudiu Beznea wrote:
> Replace while loop with read_poll_timeout().
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@...rochip.com>

Acked-by: Adrian Hunter <adrian.hunter@...el.com>

> ---
>  drivers/mmc/host/sdhci-of-at91.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 134ba01d3063..d1a1c548c515 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -62,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
>  static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  {
>  	u16 clk;
> -	unsigned long timeout;
>  
>  	host->mmc->actual_clock = 0;
>  
> @@ -87,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
>  	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
>  
>  	/* Wait max 20 ms */
> -	timeout = 20;
> -	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> -		& SDHCI_CLOCK_INT_STABLE)) {
> -		if (timeout == 0) {
> -			pr_err("%s: Internal clock never stabilised.\n",
> -			       mmc_hostname(host->mmc));
> -			return;
> -		}
> -		timeout--;
> -		mdelay(1);
> +	if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE),
> +			      1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) {
> +		pr_err("%s: Internal clock never stabilised.\n",
> +		       mmc_hostname(host->mmc));
> +		return;
>  	}
>  
>  	clk |= SDHCI_CLOCK_CARD_EN;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ