diff mbox

[v1,3/3] mmc: not clock gate host when host is in runtime suspended state

Message ID 20110114082324.GD27523@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chuanxiao.Dong Jan. 14, 2011, 8:23 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e296c5a..d2121fa 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -670,6 +670,17 @@  void mmc_gate_clock(struct mmc_host *host)
 	host->ios.clock = 0;
 	host->clk_gated = true;
 	spin_unlock_irqrestore(&host->clk_lock, flags);
+#ifdef CONFIG_PM_RUNTIME
+	/*
+	 * mmc clock gating is done in a work queue which
+	 * does not synchronized with host controller runtime
+	 * power management. So when mmc gate clock, host may
+	 * have already in runtime suspend state. In that case,
+	 * driver cannot touch host controller registers
+	 */
+	if (host->class_dev.power.runtime_status != RPM_ACTIVE)
+		return;
+#endif
 	mmc_set_ios(host);
 }