aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/host.c')
-rw-r--r--drivers/mmc/core/host.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index c8768726d925..0dc8e35c13ec 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -383,15 +383,30 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
int err;
struct mmc_host *host;
+ int id;
host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (!host)
return NULL;
+ /* If OF aliases exist, start dynamic assignment after highest */
+ id = of_alias_get_highest_id("mmc");
+ id = (id < 0) ? 0 : id + 1;
+
+ /* If this devices has OF node, maybe it has an alias */
+ if (dev->of_node) {
+ int of_id = of_alias_get_id(dev->of_node, "mmc");
+
+ if (of_id < 0)
+ dev_warn(dev, "/aliases ID not available\n");
+ else
+ id = of_id;
+ }
+
/* scanning will be enabled when we're ready */
host->rescan_disable = 1;
- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
+ err = ida_simple_get(&mmc_host_ida, id, 0, GFP_KERNEL);
if (err < 0) {
kfree(host);
return NULL;