Re: [PATCH v2 10/22] mmc: tmio: support IP-builtin card detection logic

From: Wolfram Sang
Date: Mon Dec 04 2017 - 10:13:45 EST


> +static int tmio_mmc_get_cd(struct mmc_host *mmc)
> +{
> + struct tmio_mmc_host *host = mmc_priv(mmc);
> + int ret;
> +
> + ret = mmc_gpio_get_cd(mmc);
> + if (ret >= 0)
> + return ret;
> +
> + return !!(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) &
> + TMIO_STAT_SIGSTATE);
> +}

I wonder if we shouldn't do something like:

if (mmc_can_gpio_cd())
return mmc_gpio_get_cd()
else
return !!(sd_ctrl_read16_and_16_as_32...)

If we have a GPIO CD defined, I think we want the value of
mmc_gpio_get_cd() in all cases. It makes clearer that this is an
'either-or' case and not a fallback mechanism.

Attachment: signature.asc
Description: PGP signature