* [PATCH] mmc: core: Assign a fixed number to MMC devices
@ 2016-09-01 9:40 Jean-Francois Moine
0 siblings, 0 replies; 2+ messages in thread
From: Jean-Francois Moine @ 2016-09-01 9:40 UTC (permalink / raw)
To: Ulf Hansson, linux-mmc; +Cc: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] mmc: core: Assign a fixed number to MMC devices
@ 2016-09-01 9:40 Jean-Francois Moine
0 siblings, 0 replies; 2+ messages in thread
From: Jean-Francois Moine @ 2016-09-01 9:40 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-01 9:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 9:40 [PATCH] mmc: core: Assign a fixed number to MMC devices Jean-Francois Moine
-- strict thread matches above, loose matches on Subject: below --
2016-09-01 9:40 Jean-Francois Moine
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.