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>
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;
#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>
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;
EXPORT_SYMBOL(mmc_of_parse);
-int mmc_max_reserved_idx(void);
-
/**
* mmc_alloc_host - initialise the per-host structure.
* @extra: sizeof private data structure
{
int err;
struct mmc_host *host;
- int alias_id, min_idx, max_idx;
host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (!host)
/* 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)) {
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) {
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);
return max;
}
-EXPORT_SYMBOL_GPL(of_alias_max_index);
/**
* of_alias_scan - Scan all properties of the 'aliases' node
int mmc_hw_reset(struct mmc_host *host);
void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);
-int mmc_first_nonreserved_index(void);
-int mmc_get_reserved_index(struct mmc_host *host);
-
#endif /* LINUX_MMC_CORE_H */