lkml.org 
[lkml]   [2015]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/2] PM / Runtime: Add pm_runtime_enable_recursive
Date
This function makes less cumbersome to enable runtime PM in a device and
its descendants.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.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


\
 
 \ /
  Last update: 2015-05-19 16:41    [W:0.084 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site