[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432044679-10256-3-git-send-email-tomeu.vizoso@collabora.com>
Date: Tue, 19 May 2015 16:11:16 +0200
From: Tomeu Vizoso <tomeu.vizoso@...labora.com>
To: linux-pm@...r.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Alan Stern <stern@...land.harvard.edu>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Kevin Hilman <khilman@...aro.org>,
Russell King <rmk+kernel@....linux.org.uk>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/2] PM / Runtime: Add pm_runtime_enable_recursive
This function makes less cumbersome to enable runtime PM in a device and
its descendants.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@...labora.com>
---
drivers/base/power/runtime.c | 15 +++++++++++++++
include/linux/pm_runtime.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 5070c4f..2c96f3f 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1189,6 +1189,21 @@ void pm_runtime_enable(struct device *dev)
}
EXPORT_SYMBOL_GPL(pm_runtime_enable);
+static int __pm_runtime_enable_recursive(struct device *dev, void *data)
+{
+ pm_runtime_enable(dev);
+
+ device_for_each_child(dev, NULL, __pm_runtime_enable_recursive);
+
+ return 0;
+}
+
+void pm_runtime_enable_recursive(struct device *dev)
+{
+ __pm_runtime_enable_recursive(dev, NULL);
+}
+EXPORT_SYMBOL_GPL(pm_runtime_enable_recursive);
+
/**
* pm_runtime_forbid - Block runtime PM of a device.
* @dev: Device to handle.
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 30e84d4..d393ac3 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -43,6 +43,7 @@ extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
extern int pm_runtime_barrier(struct device *dev);
extern void pm_runtime_enable(struct device *dev);
+extern void pm_runtime_enable_recursive(struct device *dev);
extern void __pm_runtime_disable(struct device *dev, bool check_resume);
extern void pm_runtime_allow(struct device *dev);
extern void pm_runtime_forbid(struct device *dev);
--
2.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists