summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorHaibo Chen <haibo.chen@nxp.com>2018-02-24 17:32:01 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitc86517425d4a561401fdf8fa72234f5d0f4f5b6e (patch)
tree75b6304b4d1d6c0c8298dda8003e85303d694536 /drivers/mmc/core
parent3da3fa783c77cbec52fe4c79c5d7a5ed2ec8d046 (diff)
MLK-17621-1 mmc: remove the feature of setting slot index via devicetree alias
This patch remove the commit 3d8a438c53f3 ("mmc: Allow setting slot index via devicetree alias"),which wrongly use the function ida_simple_get(), causing this function return unexpected result when the reserved alias index value is not 0. In the meantime, the 'devidx' in the mmc block layer code just impact the minor device number, no need to align the minor device number and the slot index. Here remove upper mentioned patch, and will reform the feature of setting slot index via devicetree alias in the next few patches. This patch also remove one other related patch: commit 82f323ade111 ("MLK-12617 mmc: Fix compile error when CONFIG_MMC=m"). Reported-by: Leonard Crestez <leonard.crestez@nxp.com> Acked-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/block.c14
-rw-r--r--drivers/mmc/core/core.c40
-rw-r--r--drivers/mmc/core/host.c25
3 files changed, 5 insertions, 74 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index db5c8d61e867..f42a2b639ba0 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2108,17 +2108,9 @@ again:
if (!ida_pre_get(&mmc_blk_ida, GFP_KERNEL))
return ERR_PTR(-ENOMEM);
- devidx = mmc_get_reserved_index(card->host);
- if (devidx >= 0)
- devidx = ida_simple_get(&mmc_blk_ida, devidx, devidx,
- GFP_NOWAIT);
- ret = 0;
- if (devidx < 0) {
- spin_lock(&mmc_blk_lock);
- ret = ida_get_new_above(&mmc_blk_ida,
- mmc_first_nonreserved_index(), &devidx);
- spin_unlock(&mmc_blk_lock);
- }
+ spin_lock(&mmc_blk_lock);
+ ret = ida_get_new(&mmc_blk_ida, &devidx);
+ spin_unlock(&mmc_blk_lock);
if (ret == -EAGAIN)
goto again;
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index adb938337192..4d322dbc19df 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -16,7 +16,6 @@
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/delay.h>
-#include <linux/of.h>
#include <linux/pagemap.h>
#include <linux/err.h>
#include <linux/leds.h>
@@ -3174,49 +3173,10 @@ void mmc_init_context_info(struct mmc_host *host)
init_waitqueue_head(&host->context_info.wait);
}
-static int __mmc_max_reserved_idx = -1;
-
-/**
- * mmc_first_nonreserved_index() - get the first index that is not reserved
- */
-int mmc_first_nonreserved_index(void)
-{
- return __mmc_max_reserved_idx + 1;
-}
-EXPORT_SYMBOL(mmc_first_nonreserved_index);
-
-/**
- * mmc_get_reserved_index() - get the index reserved for this host
- *
- * Return: The index reserved for this host or negative error value if
- * no index is reserved for this host
- */
-int mmc_get_reserved_index(struct mmc_host *host)
-{
- return of_alias_get_id(host->parent->of_node, "mmc");
-}
-EXPORT_SYMBOL(mmc_get_reserved_index);
-
-static void mmc_of_reserve_idx(void)
-{
- int max;
-
- max = of_alias_max_index("mmc");
- if (max < 0)
- return;
-
- __mmc_max_reserved_idx = max;
-
- pr_debug("MMC: reserving %d slots for of aliases\n",
- __mmc_max_reserved_idx + 1);
-}
-
static int __init mmc_init(void)
{
int ret;
- mmc_of_reserve_idx();
-
ret = mmc_register_bus();
if (ret)
return ret;
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 882844c17959..5aad8c3e376e 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -346,8 +346,6 @@ int mmc_of_parse(struct mmc_host *host)
EXPORT_SYMBOL(mmc_of_parse);
-int mmc_max_reserved_idx(void);
-
/**
* mmc_alloc_host - initialise the per-host structure.
* @extra: sizeof private data structure
@@ -359,7 +357,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
int err;
struct mmc_host *host;
- int alias_id, min_idx, max_idx;
host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (!host)
@@ -367,7 +364,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
/* scanning will be enabled when we're ready */
host->rescan_disable = 1;
- host->parent = dev;
again:
if (!ida_pre_get(&mmc_host_ida, GFP_KERNEL)) {
@@ -375,26 +371,8 @@ again:
return NULL;
}
- alias_id = mmc_get_reserved_index(host);
-
- if (alias_id >= 0) {
- min_idx = alias_id;
- max_idx = alias_id + 1;
- } else {
- min_idx = mmc_first_nonreserved_index();
- max_idx = 0;
- }
-
spin_lock(&mmc_host_lock);
-
- err = ida_get_new_above(&mmc_host_ida, min_idx, &host->index);
- if (!err) {
- if (host->index > max_idx) {
- ida_remove(&mmc_host_ida, host->index);
- err = -ENOSPC;
- }
- }
-
+ err = ida_get_new(&mmc_host_ida, &host->index);
spin_unlock(&mmc_host_lock);
if (err == -EAGAIN) {
@@ -406,6 +384,7 @@ again:
dev_set_name(&host->class_dev, "mmc%d", host->index);
+ host->parent = dev;
host->class_dev.parent = dev;
host->class_dev.class = &mmc_host_class;
device_initialize(&host->class_dev);