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:   Wed, 15 Jan 2020 14:04:05 +0200
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Faiz Abbas <faiz_abbas@...com>, linux-omap@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-mmc@...r.kernel.org
Cc:     kishon@...com, mark.rutland@....com, robh+dt@...nel.org,
        ulf.hansson@...aro.org, tony@...mide.com
Subject: Re: [PATCH v4 06/11] mmc: sdhci: Refactor sdhci_set_timeout()

On 6/01/20 1:01 pm, Faiz Abbas wrote:
> Refactor sdhci_set_timeout() such that platform drivers can do some
> functionality in a set_timeout() callback and then call
> __sdhci_set_timeout() to complete the operation.
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@...com>

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

> ---
>  drivers/mmc/host/sdhci.c | 36 +++++++++++++++++++-----------------
>  drivers/mmc/host/sdhci.h |  1 +
>  2 files changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 56f46bd7cdad..adb3e8ccefb8 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1004,27 +1004,29 @@ void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable)
>  }
>  EXPORT_SYMBOL_GPL(sdhci_set_data_timeout_irq);
>  
> -static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
> +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
>  {
> -	u8 count;
> +	bool too_big = false;
> +	u8 count = sdhci_calc_timeout(host, cmd, &too_big);
>  
> -	if (host->ops->set_timeout) {
> -		host->ops->set_timeout(host, cmd);
> -	} else {
> -		bool too_big = false;
> -
> -		count = sdhci_calc_timeout(host, cmd, &too_big);
> +	if (too_big &&
> +	    host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) {
> +		sdhci_calc_sw_timeout(host, cmd);
> +		sdhci_set_data_timeout_irq(host, false);
> +	} else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) {
> +		sdhci_set_data_timeout_irq(host, true);
> +	}
>  
> -		if (too_big &&
> -		    host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) {
> -			sdhci_calc_sw_timeout(host, cmd);
> -			sdhci_set_data_timeout_irq(host, false);
> -		} else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) {
> -			sdhci_set_data_timeout_irq(host, true);
> -		}
> +	sdhci_writeb(host, count, SDHCI_TIMEOUT_CONTROL);
> +}
> +EXPORT_SYMBOL_GPL(__sdhci_set_timeout);
>  
> -		sdhci_writeb(host, count, SDHCI_TIMEOUT_CONTROL);
> -	}
> +static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
> +{
> +	if (host->ops->set_timeout)
> +		host->ops->set_timeout(host, cmd);
> +	else
> +		__sdhci_set_timeout(host, cmd);
>  }
>  
>  static void sdhci_initialize_data(struct sdhci_host *host,
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 928c6f35fcad..1fe230c2ed84 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -804,5 +804,6 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode);
>  void sdhci_abort_tuning(struct sdhci_host *host, u32 opcode);
>  void sdhci_switch_external_dma(struct sdhci_host *host, bool en);
>  void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable);
> +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd);
>  
>  #endif /* __SDHCI_HW_H */
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ