Re: [RFC PATCH V2 1/2] mmc: Update sdhci tune function to return errors

From: Adrian Hunter
Date: Fri Feb 14 2025 - 20:07:26 EST


On 6/02/25 23:08, Erick Shepherd wrote:
> Updates the sdhci_execute_tuning function to return the error code
> that was returned by the __sdhci_execute_tuning function.
> Previously this code was only stored in host->tuning_err and not
> actually returned.
>
> Signed-off-by: Erick Shepherd <erick.shepherd@xxxxxx>
> ---
> drivers/mmc/host/sdhci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index f4a7733a8ad2..b35b8917fa1e 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2967,7 +2967,8 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>
> sdhci_start_tuning(host);
>
> - host->tuning_err = __sdhci_execute_tuning(host, opcode);
> + err = __sdhci_execute_tuning(host, opcode);
> + host->tuning_err = err;

SDHCI uses fixed sampling clock if tuning fails.

It is up to drivers to decide what to do with tuning_err. A driver
can provide the tuning mmc host op, call sdhci_execute_tuning()
and return tuning_err it that is preferred.

>
> sdhci_end_tuning(host);
> out: