diff mbox

[2/2] mmc: core: Use autosuspend when applicable at runtime idle

Message ID 1381399307-21534-3-git-send-email-ulf.hansson@linaro.org
State New
Headers show

Commit Message

Ulf Hansson Oct. 10, 2013, 10:01 a.m. UTC
Typically the runtime idle function is triggered after resume and
probe. Instead of immediately requesting the device to go into
in-active state we make use of the autosuspend, if we have enabled
it earlier.

Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/bus.c |    6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index cdca8a7..7f0e900 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -205,6 +205,12 @@  static int mmc_runtime_resume(struct device *dev)
 
 static int mmc_runtime_idle(struct device *dev)
 {
+	if (pm_runtime_autosuspend_used(dev)) {
+		pm_runtime_mark_last_busy(dev);
+		pm_runtime_autosuspend(dev);
+		return -EBUSY;
+	}
+
 	return 0;
 }