public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: claim host during mmc_power_off on suspend
@ 2012-01-11 14:51 Arik Nemtsov
  2012-01-16 19:17 ` Arik Nemtsov
  2012-01-17  7:18 ` Adrian Hunter
  0 siblings, 2 replies; 4+ messages in thread
From: Arik Nemtsov @ 2012-01-11 14:51 UTC (permalink / raw)
  To: linux-mmc; +Cc: Chris Ball, Arik Nemtsov

Make sure the host is claimed in all calls of mmc_power_off() during
suspend. In addition make sure mmc_power_off() isn't called twice in
some suspend flows.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
---
 drivers/mmc/core/core.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 950b97d..d830c5c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2305,6 +2305,7 @@ EXPORT_SYMBOL(mmc_cache_ctrl);
 int mmc_suspend_host(struct mmc_host *host)
 {
 	int err = 0;
+	bool powered_off = false;
 
 	if (host->caps & MMC_CAP_DISABLE)
 		cancel_delayed_work(&host->disable);
@@ -2348,6 +2349,7 @@ int mmc_suspend_host(struct mmc_host *host)
 				mmc_release_host(host);
 				host->pm_flags = 0;
 				err = 0;
+				powered_off = true;
 			}
 		} else {
 			err = -EBUSY;
@@ -2355,8 +2357,11 @@ int mmc_suspend_host(struct mmc_host *host)
 	}
 	mmc_bus_put(host);
 
-	if (!err && !mmc_card_keep_power(host))
+	if (!powered_off && !err && !mmc_card_keep_power(host)) {
+		mmc_claim_host(host);
 		mmc_power_off(host);
+		mmc_release_host(host);
+	}
 
 out:
 	return err;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-18 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 14:51 [PATCH] mmc: core: claim host during mmc_power_off on suspend Arik Nemtsov
2012-01-16 19:17 ` Arik Nemtsov
2012-01-17  7:18 ` Adrian Hunter
2012-01-18 13:22   ` Arik Nemtsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox