Thread (8 messages) flat view 8 messages, 1 author, 2012-09-18
STALE5096d REVIEWED: 1 (0M)

1 review trailer.

[PATCH 1/7] PM / Domains: add generic function 'pm_genpd_of_add_device_by_name'

From: sjg@chromium.org (Simon Glass)
Date: 2012-09-18 18:26:13
Also in: lkml
Subsystem: generic pm domains, power management core, the rest · Maintainers: Ulf Hansson, "Rafael J. Wysocki", Linus Torvalds

From: Prathyush K <redacted>

A new function pm_genpd_of_add_device_by_name is added to the pm_domain
file. This function takes three parameters - target device to be added to
genpd, a device node and the name of the property. This function reads
the "propname" property from the device node and finds the corresponding
genpd device node. The target device is then added to this genpd by
calling __pm_genpd_of_add_device.

of_property_read_u32(dev_node, propname, &val);
genpd_node = of_find_node_by_phandle(val);
__pm_genpd_of_add_device(genpd_node, dev, NULL);

Signed-off-by: Prathyush K <redacted>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Prathyush Kalashwaram <redacted>
---
 include/linux/pm_domain.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 30f794e..c733ece 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -137,6 +137,18 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
 	return __pm_genpd_add_device(genpd, dev, NULL);
 }
 
+static inline int pm_genpd_of_add_device_by_name(
+					struct device_node *dev_node,
+					struct device *dev,
+					char *propname)
+{
+	u32 val;
+	struct device_node *genpd_node;
+	of_property_read_u32(dev_node, propname, &val);
+	genpd_node = of_find_node_by_phandle(val);
+	return __pm_genpd_of_add_device(genpd_node, dev, NULL);
+}
+
 static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
 					 struct device *dev)
 {
@@ -184,6 +196,13 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
 {
 	return -ENOSYS;
 }
+static inline int pm_genpd_of_add_device_by_name(
+					struct device_node *dev_node,
+					struct device *dev,
+					char *propname)
+{
+	return -ENOSYS;
+}
 static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
 					 struct device *dev)
 {
-- 
1.7.7.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help