lkml.org 
[lkml]   [2019]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RESEND] mmc: core: try to use an id from the devicetree
Date
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
\
 
 \ /
  Last update: 2019-06-20 17:25    [W:0.043 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site