[U-Boot] [PATCH 2/2] mmc: Register only the first MMC device on MMC_TINY

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Wed Jun 5 20:30:38 UTC 2019


On Sat, 25 May 2019 at 19:26, Ezequiel Garcia <ezequiel at collabora.com> wrote:
>
> When MMC_TINY is enabled, support for only one MMC device
> is provided. Boards that register more than one device,
> will just write over mmc_static keeping only the last one
> registered.
>
> This commit prevents this, keeping only the first MMC
> device created. A debug warning message is added, if nothing
> else, as a hint/documentation for developers.
>
> Signed-off-by: Ezequiel Garcia <ezequiel at collabora.com>

Not sure if it's too early for an gently ping here.

I just want to make sure these two will get some eyes.

Thanks,
Eze

> ---
>  drivers/mmc/mmc_legacy.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c
> index 66a7cda440cd..b0f5cf58a2b3 100644
> --- a/drivers/mmc/mmc_legacy.c
> +++ b/drivers/mmc/mmc_legacy.c
> @@ -150,6 +150,15 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
>  {
>         struct mmc *mmc = &mmc_static;
>
> +       /* First MMC device registered, fail to register a new one.
> +        * Given users are not expecting this to fail, instead
> +        * of failing let's just return the only MMC device
> +        */
> +       if (mmc->cfg) {
> +               debug("Warning: MMC_TINY doesn't support multiple MMC devices\n");
> +               return mmc;
> +       }
> +
>         mmc->cfg = cfg;
>         mmc->priv = priv;
>
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list