diff mbox

[v2,3/3] mmc: changes to enable runtime PM of mmc core layer

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

Commit Message

Gao, Yunpeng Dec. 6, 2010, 12:24 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 6286898..2905dac 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -22,6 +22,7 @@ 
 #include <linux/scatterlist.h>
 #include <linux/log2.h>
 #include <linux/regulator/consumer.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
@@ -1503,6 +1504,7 @@  void mmc_rescan(struct work_struct *work)
 
 	spin_unlock_irqrestore(&host->lock, flags);
 
+	pm_runtime_get_sync(host->parent);
 
 	mmc_bus_get(host);
 
@@ -1598,6 +1600,8 @@  out_fail:
 		mmc_power_off(host);
 	}
 out:
+	pm_runtime_put_sync(host->parent);
+
 	if (host->caps & MMC_CAP_NEEDS_POLL)
 		mmc_schedule_delayed_work(&host->detect, HZ);
 }
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 92e3370..caa9e85 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -19,6 +19,7 @@ 
 #include <linux/leds.h>
 #include <linux/slab.h>
 #include <linux/suspend.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
@@ -303,6 +304,8 @@  struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
 	host->max_blk_size = 512;
 	host->max_blk_count = PAGE_CACHE_SIZE / 512;
 
+	pm_runtime_no_callbacks(&host->class_dev);
+
 	return host;
 
 free: