diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-10-06 03:11:21 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-10-06 03:11:20 -0700 |
| commit | a28133826a0528b8748c8bb2762b902cb8fba859 (patch) | |
| tree | b75ced9d2b61264fddc2fbaf182faccb4d1f1243 | |
| parent | 0a7f7fc4b866cb2f23e107a4ae85d44a45670dfb (diff) | |
| parent | 28f9652f80e6000f5dbc341287aa9db935825271 (diff) | |
Merge "mmc: core: Ignore bus resume flags when card removal event is detected"
| -rw-r--r-- | drivers/mmc/core/core.c | 12 | ||||
| -rw-r--r-- | drivers/mmc/core/sd.c | 5 | ||||
| -rw-r--r-- | include/linux/mmc/host.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0a26a07e7aee..372f1fbbde4c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -3301,6 +3301,13 @@ static void _mmc_detect_change(struct mmc_host *host, unsigned long delay, pm_wakeup_event(mmc_dev(host), 5000); host->detect_change = 1; + /* + * Change in cd_gpio state, so make sure detection part is + * not overided because of manual resume. + */ + if (cd_irq && mmc_bus_manual_resume(host)) + host->ignore_bus_resume_flags = true; + mmc_schedule_delayed_work(&host->detect, delay); } @@ -4211,6 +4218,8 @@ void mmc_rescan(struct work_struct *work) host->bus_ops->detect(host); host->detect_change = 0; + if (host->ignore_bus_resume_flags) + host->ignore_bus_resume_flags = false; /* * Let mmc_bus_put() free the bus/bus_ops if we've found that @@ -4468,7 +4477,8 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(&host->lock, flags); host->rescan_disable = 0; - if (mmc_bus_manual_resume(host)) { + if (mmc_bus_manual_resume(host) && + !host->ignore_bus_resume_flags) { spin_unlock_irqrestore(&host->lock, flags); break; } diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 9bef77ba29fd..21836eac001e 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1237,7 +1237,10 @@ static int mmc_sd_suspend(struct mmc_host *host) if (!err) { pm_runtime_disable(&host->card->dev); pm_runtime_set_suspended(&host->card->dev); - } + /* if suspend fails, force mmc_detect_change during resume */ + } else if (mmc_bus_manual_resume(host)) + host->ignore_bus_resume_flags = true; + MMC_TRACE(host, "%s: Exit err: %d\n", __func__, err); return err; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index aea4c0f2ef5f..65a188eeeeb6 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -519,6 +519,7 @@ struct mmc_host { unsigned int bus_resume_flags; #define MMC_BUSRESUME_MANUAL_RESUME (1 << 0) #define MMC_BUSRESUME_NEEDS_RESUME (1 << 1) + bool ignore_bus_resume_flags; unsigned int sdio_irqs; struct task_struct *sdio_irq_thread; |
