diff options
Diffstat (limited to 'recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch')
-rw-r--r-- | recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch new file mode 100644 index 0000000..4a8ba85 --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-mainline-4.14/0016-Revert-mmc-core-simplify-ida-handling.patch @@ -0,0 +1,64 @@ +From 50a063a5271868aaf17ee86741e6452a6c405a50 Mon Sep 17 00:00:00 2001 +Message-Id: <50a063a5271868aaf17ee86741e6452a6c405a50.1529072479.git.marcel.ziswiler@toradex.com> +In-Reply-To: <fb4764e8eb658d35e8fc62ae79c77e1f6e2b0ef3.1529072479.git.marcel.ziswiler@toradex.com> +References: <fb4764e8eb658d35e8fc62ae79c77e1f6e2b0ef3.1529072479.git.marcel.ziswiler@toradex.com> +From: Marcel Ziswiler <marcel.ziswiler@toradex.com> +Date: Thu, 19 Apr 2018 13:49:30 +0200 +Subject: [PATCH 16/27] Revert "mmc: core: simplify ida handling" + +This reverts commit 7413d1f509eb0ee605973c1a6da9911700c80012. + +Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> +--- + drivers/mmc/core/host.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c +index 3740fb0052a4..841b9ce01a8e 100644 +--- a/drivers/mmc/core/host.c ++++ b/drivers/mmc/core/host.c +@@ -35,11 +35,14 @@ + #define cls_dev_to_mmc_host(d) container_of(d, struct mmc_host, class_dev) + + static DEFINE_IDA(mmc_host_ida); ++static DEFINE_SPINLOCK(mmc_host_lock); + + static void mmc_host_classdev_release(struct device *dev) + { + struct mmc_host *host = cls_dev_to_mmc_host(dev); +- ida_simple_remove(&mmc_host_ida, host->index); ++ spin_lock(&mmc_host_lock); ++ ida_remove(&mmc_host_ida, host->index); ++ spin_unlock(&mmc_host_lock); + kfree(host); + } + +@@ -358,13 +361,22 @@ 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); +- if (err < 0) { ++again: ++ if (!ida_pre_get(&mmc_host_ida, GFP_KERNEL)) { + kfree(host); + return NULL; + } + +- host->index = err; ++ spin_lock(&mmc_host_lock); ++ err = ida_get_new(&mmc_host_ida, &host->index); ++ spin_unlock(&mmc_host_lock); ++ ++ if (err == -EAGAIN) { ++ goto again; ++ } else if (err) { ++ kfree(host); ++ return NULL; ++ } + + dev_set_name(&host->class_dev, "mmc%d", host->index); + +-- +2.14.4 + |