diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2010-10-14 15:20:21 -0700 |
|---|---|---|
| committer | Colin Cross <ccross@android.com> | 2012-04-09 13:57:44 -0700 |
| commit | 0eb9a8f9d0c6ac5b4c29ba9f1c198b44c8ebb4c1 (patch) | |
| tree | d55b8533e803d91f41b9bdcb72e7cc43abc1f16c | |
| parent | 73ae60c90edb8973080b4ca5d82cc9a1ad1e17d4 (diff) | |
mmc: Fix pm_notifier obeying deferred resume
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
| -rw-r--r-- | drivers/mmc/core/core.c | 16 | ||||
| -rw-r--r-- | include/linux/mmc/host.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 4db6bc1a314..b848a1883d3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1290,11 +1290,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; printk("%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) { mmc_power_up(host); @@ -2377,7 +2383,7 @@ int mmc_resume_host(struct mmc_host *host) int err = 0; mmc_bus_get(host); - if (host->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME) { + if (mmc_bus_manual_resume(host)) { host->bus_resume_flags |= MMC_BUSRESUME_NEEDS_RESUME; mmc_bus_put(host); return 0; @@ -2433,6 +2439,10 @@ int mmc_pm_notify(struct notifier_block *notify_block, case PM_SUSPEND_PREPARE: spin_lock_irqsave(&host->lock, flags); + if (mmc_bus_needs_resume(host)) { + spin_unlock_irqrestore(&host->lock, flags); + break; + } host->rescan_disable = 1; host->power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(&host->lock, flags); @@ -2457,6 +2467,10 @@ int mmc_pm_notify(struct notifier_block *notify_block, case PM_POST_RESTORE: spin_lock_irqsave(&host->lock, flags); + if (mmc_bus_manual_resume(host)) { + spin_unlock_irqrestore(&host->lock, flags); + break; + } host->rescan_disable = 0; host->power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(&host->lock, flags); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 1e0cdf74fd0..b1f116f6fb8 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -359,6 +359,7 @@ static inline void *mmc_priv(struct mmc_host *host) #define mmc_classdev(x) (&(x)->class_dev) #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) { |
