On Saturday 23 April 2011, John Stultz wrote:
> @@ -482,7 +485,26 @@ int mmc_sd_setup_card(struct mmc_host *host, struct 
> mmc_card *card,
>               /*
>                * Fetch switch information from card.
>                */
> +#ifdef CONFIG_MMC_PARANOID_SD_INIT
> +             for (retries = 1; retries <= 3; retries++) {
> +                     err = mmc_read_switch(card);
> +                     if (!err) {
> +                             if (retries > 1) {
> +                                     printk(KERN_WARNING
> +                                            "%s: recovered\n",
> +                                            mmc_hostname(host));
> +                             }
> +                             break;
> +                     } else {
> +                             printk(KERN_WARNING
> +                                    "%s: read switch failed (attempt %d)\n",
> +                                    mmc_hostname(host), retries);
> +                     }
> +             }
> +#else
>               err = mmc_read_switch(card);
> +#endif
> +

I see no reason to have this as a compile time option. Having retries in here
might be useful, but a better place would be inside of mmc_read_switch()
or mmc_sd_switch() so it is only done if the error comes from the controller,
not for cases where we know it will fail (e.g. !(card->csd.cmdclass & 
CCC_SWITCH)).

I would also recommend being a bit less noisy, e.g. print a warning only
after either giving up or succeeding a retry.

        Arnd
--
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