From: Lubomir Rintel <lkundrak@v3.sk>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH RESEND] mmc: core: try to use an id from the devicetree
Date: Thu, 20 Jun 2019 17:24:32 +0200 [thread overview]
Message-ID: <20190620152432.1408278-1-lkundrak@v3.sk> (raw)
If there's a mmc* alias in the device tree, take the device number from
it, so that we end up with a device name that matches the alias.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/mmc/core/host.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 6a51f7a06ce7..4733ddb894da 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -411,7 +411,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
/* scanning will be enabled when we're ready */
host->rescan_disable = 1;
- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
+ /* prefer an alias */
+ err = of_alias_get_id(dev->of_node, "mmc");
+ if (err < 0)
+ err = 0;
+
+ err = ida_simple_get(&mmc_host_ida, err, 0, GFP_KERNEL);
if (err < 0) {
kfree(host);
return NULL;
--
2.21.0
next reply other threads:[~2019-06-20 15:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 15:24 Lubomir Rintel [this message]
2019-06-20 15:37 ` [PATCH RESEND] mmc: core: try to use an id from the devicetree Ulf Hansson
2019-06-20 21:16 ` Doug Anderson
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=20190620152432.1408278-1-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.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).