From: Ezequiel Garcia <ezequiel@collabora.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] mmc: Register only the first MMC device on MMC_TINY
Date: Sat, 25 May 2019 19:25:22 -0300 [thread overview]
Message-ID: <20190525222522.14105-2-ezequiel@collabora.com> (raw)
In-Reply-To: <20190525222522.14105-1-ezequiel@collabora.com>
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@collabora.com>
---
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
next prev parent reply other threads:[~2019-05-25 22:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-25 22:25 [U-Boot] [PATCH 1/2] spl: Move SPL_MMC_TINY option to appear under SPL menu Ezequiel Garcia
2019-05-25 22:25 ` Ezequiel Garcia [this message]
2019-06-05 20:30 ` [U-Boot] [PATCH 2/2] mmc: Register only the first MMC device on MMC_TINY Ezequiel Garcia
2019-07-14 13:07 ` Tom Rini
2019-07-14 13:07 ` [U-Boot] [PATCH 1/2] spl: Move SPL_MMC_TINY option to appear under SPL menu Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190525222522.14105-2-ezequiel@collabora.com \
--to=ezequiel@collabora.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.