From: moinejf@free.fr (Jean-Francois Moine)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: core: Assign a fixed number to MMC devices
Date: Thu, 1 Sep 2016 11:40:31 +0200 [thread overview]
Message-ID: <mailman.43.1472734189.1636.linux-arm-kernel@lists.infradead.org> (raw)
This patch prevents MMC device numbering to change at each reboot
by using DT labels.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
drivers/mmc/core/host.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 98f25ff..38b94ce 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -346,6 +346,14 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
int err;
struct mmc_host *host;
+ int id = 0;
+
+ /* use DT label as mmc index */
+ if (dev->of_node) {
+ id = of_alias_get_id(dev->of_node, "mmc");
+ if (id < 0)
+ id = 0;
+ }
host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (!host)
@@ -361,7 +369,7 @@ again:
}
spin_lock(&mmc_host_lock);
- err = ida_get_new(&mmc_host_ida, &host->index);
+ err = ida_get_new_above(&mmc_host_ida, id, &host->index);
spin_unlock(&mmc_host_lock);
if (err == -EAGAIN) {
--
2.9.3
reply other threads:[~2016-09-01 9:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=mailman.43.1472734189.1636.linux-arm-kernel@lists.infradead.org \
--to=moinejf@free.fr \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).