aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mayer <markus.mayer@linaro.org>2014-03-19 16:45:34 -0700
committerMarkus Mayer <markus.mayer@linaro.org>2014-03-31 14:03:04 -0700
commitf74d80f8302c07ad4315760a4347d178cd622208 (patch)
treecf069536d2c7b100530c92f4d29501a33b82159d
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
mmc: Delay the card_event callback into the mmc_rescan workerreview/mmc-card-event
This change removes the callback from atomic context which it doesn't need to be in, and puts it in line with the debounced rescan. This code is based on these e-mail threads with Christian Daudt: https://lkml.org/lkml/2013/8/19/539 https://lkml.org/lkml/2014/3/19/79 Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
-rw-r--r--drivers/mmc/core/core.c5
-rw-r--r--drivers/mmc/core/slot-gpio.c4
-rw-r--r--include/linux/mmc/host.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 098374b1ab2..ff7fd2e0f95 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2421,6 +2421,11 @@ void mmc_rescan(struct work_struct *work)
container_of(work, struct mmc_host, detect.work);
int i;
+ if (host->trigger_card_event && host->ops->card_event) {
+ host->ops->card_event(host);
+ host->trigger_card_event = false;
+ }
+
if (host->rescan_disable)
return;
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 46596b71a32..4029c857136 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -29,9 +29,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id)
/* Schedule a card detection after a debounce timeout */
struct mmc_host *host = dev_id;
- if (host->ops->card_event)
- host->ops->card_event(host);
-
+ host->trigger_card_event = true;
mmc_detect_change(host, msecs_to_jiffies(200));
return IRQ_HANDLED;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 99f5709ac34..63b983bac08 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -322,6 +322,8 @@ struct mmc_host {
int rescan_disable; /* disable card detection */
int rescan_entered; /* used with nonremovable devices */
+ bool trigger_card_event; /* card_event necessary */
+
struct mmc_card *card; /* device attached to this host */
wait_queue_head_t wq;