Commit fa372a51 authored by Markus Mayer's avatar Markus Mayer Committed by Chris Ball

mmc: Delay the card_event callback into the mmc_rescan worker

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/79Signed-off-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent bb8175a8
...@@ -2403,6 +2403,11 @@ void mmc_rescan(struct work_struct *work) ...@@ -2403,6 +2403,11 @@ void mmc_rescan(struct work_struct *work)
container_of(work, struct mmc_host, detect.work); container_of(work, struct mmc_host, detect.work);
int i; 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) if (host->rescan_disable)
return; return;
......
...@@ -32,9 +32,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) ...@@ -32,9 +32,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id)
/* Schedule a card detection after a debounce timeout */ /* Schedule a card detection after a debounce timeout */
struct mmc_host *host = dev_id; struct mmc_host *host = dev_id;
if (host->ops->card_event) host->trigger_card_event = true;
host->ops->card_event(host);
mmc_detect_change(host, msecs_to_jiffies(200)); mmc_detect_change(host, msecs_to_jiffies(200));
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -319,6 +319,8 @@ struct mmc_host { ...@@ -319,6 +319,8 @@ struct mmc_host {
int rescan_disable; /* disable card detection */ int rescan_disable; /* disable card detection */
int rescan_entered; /* used with nonremovable devices */ int rescan_entered; /* used with nonremovable devices */
bool trigger_card_event; /* card_event necessary */
struct mmc_card *card; /* device attached to this host */ struct mmc_card *card; /* device attached to this host */
wait_queue_head_t wq; wait_queue_head_t wq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment