On Tue, Oct 30, 2012 at 04:12:47PM +0800, [email protected] wrote:
[..]
> If the card is present, 1 will return, if the card is absent, 0 will return.
> If the controller will not support this feature, -ENOSYS will return.
> 
> Signed-off-by: Jerry Huang <[email protected]>
> CC: Anton Vorontsov <[email protected]>
> CC: Chris Ball <[email protected]>
> ---
[...]
>  int _mmc_detect_card_removed(struct mmc_host *host)
>  {
> -     int ret;
> +     int ret = -ENOSYS;
>  
>       if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
>               return 0;
> @@ -2081,7 +2081,13 @@ int _mmc_detect_card_removed(struct mmc_host *host)
>       if (!host->card || mmc_card_removed(host->card))
>               return 1;
>  
> -     ret = host->bus_ops->alive(host);
> +     if (host->ops->get_cd) {
> +             ret = host->ops->get_cd(host);
> +             if (ret >= 0)
> +                     ret = !ret;

o_O

Oh, I see...

Reviewed-by: Anton Vorontsov <[email protected]>

(But I must confess I didn't follow the whole discussion about
get_cd()-via-gpio being unreliable. I'm assuming you fixed this?)

> +     }
> +     if (ret < 0)
> +             ret = host->bus_ops->alive(host);
>       if (ret) {
>               mmc_card_set_removed(host->card);
>               pr_debug("%s: card remove detected\n", mmc_hostname(host));
> -- 
> 1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to