summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-10-14 15:20:21 -0700
committerKyle Yan <kyan@codeaurora.org>2016-06-15 16:11:05 -0700
commitf88fc3eaa627b9f8f39752c8c6a8f49655afccb6 (patch)
tree10a5df9e37649951048ad98457ba88174f6d82b2
parent7eac9a6d8569875f5dc2757a6873bb9bd6f496e8 (diff)
mmc: Fix pm_notifier obeying deferred resume
Do not resume if deferred resume is enabled. Only resume when a request is received. Change-Id: I1eae7dffec97d34b066bb5738c84a7e5a82f68d7 Git-commit: ac9ac6f26904c94e8aec47cab6936dd241c2eb66 Git-repo: git://git-android.quicinc.com/kernel/msm-3.10 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> [asutoshd@codeaurora.org: merge conflicts resolved] Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
-rw-r--r--drivers/mmc/core/bus.c2
-rw-r--r--drivers/mmc/core/core.c14
-rw-r--r--include/linux/mmc/host.h2
3 files changed, 17 insertions, 1 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 358edfd74056..8101b77c2acf 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -176,7 +176,7 @@ static int mmc_bus_resume(struct device *dev)
struct mmc_host *host = card->host;
int ret;
- if (host->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME) {
+ if (mmc_bus_manual_resume(host)) {
host->bus_resume_flags |= MMC_BUSRESUME_NEEDS_RESUME;
goto skip_full_resume;
}
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 28ed42eb7f6f..bf369af5511d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -3050,11 +3050,17 @@ static inline void mmc_bus_put(struct mmc_host *host)
int mmc_resume_bus(struct mmc_host *host)
{
+ unsigned long flags;
+
if (!mmc_bus_needs_resume(host))
return -EINVAL;
pr_debug("%s: Starting deferred resume\n", mmc_hostname(host));
+ spin_lock_irqsave(&host->lock, flags);
host->bus_resume_flags &= ~MMC_BUSRESUME_NEEDS_RESUME;
+ host->rescan_disable = 0;
+ spin_unlock_irqrestore(&host->lock, flags);
+
mmc_bus_get(host);
if (host->bus_ops && !host->bus_dead && host->card) {
mmc_power_up(host, host->card->ocr);
@@ -4249,6 +4255,10 @@ int mmc_pm_notify(struct notifier_block *notify_block,
case PM_SUSPEND_PREPARE:
case PM_RESTORE_PREPARE:
spin_lock_irqsave(&host->lock, flags);
+ if (mmc_bus_needs_resume(host)) {
+ spin_unlock_irqrestore(&host->lock, flags);
+ break;
+ }
host->rescan_disable = 1;
spin_unlock_irqrestore(&host->lock, flags);
cancel_delayed_work_sync(&host->detect);
@@ -4277,6 +4287,10 @@ 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)) {
+ spin_unlock_irqrestore(&host->lock, flags);
+ break;
+ }
spin_unlock_irqrestore(&host->lock, flags);
_mmc_detect_change(host, 0, false);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 4e81196c3903..5cfed430b8d4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -620,6 +620,8 @@ static inline void *mmc_cmdq_private(struct mmc_host *host)
#define mmc_hostname(x) (dev_name(&(x)->class_dev))
#define mmc_bus_needs_resume(host) ((host)->bus_resume_flags & \
MMC_BUSRESUME_NEEDS_RESUME)
+#define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & \
+ MMC_BUSRESUME_MANUAL_RESUME)
static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual)
{