[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170125000641.25520-5-furquan@chromium.org>
Date: Tue, 24 Jan 2017 16:06:38 -0800
From: Furquan Shaikh <furquan@...omium.org>
To: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Tony Lindgren <tony@...mide.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Len Brown <lenb@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <hanjun.guo@...aro.org>,
Will Deacon <will.deacon@....com>,
Rob Herring <robh@...nel.org>,
Sathyanarayana Nujella <sathyanarayana.nujella@...el.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
linux-gpio@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
Dmitry Torokhov <dtor@...omium.org>,
Furquan Shaikh <furquan@...omium.org>
Subject: [PATCH 4/7] device property: introduce fwnode_get_named_child_node()
From: Dmitry Torokhov <dtor@...omium.org>
Generic code that works with ACPI, device tree, and pset properties may
want to fetch named child node of fwnode_handle.
Signed-off-by: Dmitry Torokhov <dtor@...omium.org>
Signed-off-by: Furquan Shaikh <furquan@...omium.org>
---
drivers/base/property.c | 45 +++++++++++++++++++++++++++++----------------
include/linux/fwnode.h | 3 +++
2 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index fbb05a4a7595..3556c9fbdbf7 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -889,23 +889,11 @@ struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *node,
EXPORT_SYMBOL_GPL(fwnode_get_next_child_node);
/**
- * device_get_next_child_node - Return the next child node handle for a device
- * @dev: Device to find the next child node for.
- * @child: Handle to one of the device's child nodes or a null handle.
- */
-struct fwnode_handle *device_get_next_child_node(struct device *dev,
- struct fwnode_handle *child)
-{
- return fwnode_get_next_child_node(dev_fwnode(dev), child);
-}
-EXPORT_SYMBOL_GPL(device_get_next_child_node);
-
-/**
- * device_get_named_child_node - Return first matching named child node handle
- * @dev: Device to find the named child node for.
+ * fwnode_get_named_child_node - Return first matching named child node handle
+ * @node: Node to find the named child node for.
* @childname: String to match child node name against.
*/
-struct fwnode_handle *device_get_named_child_node(struct device *dev,
+struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *node,
const char *childname)
{
struct fwnode_handle *child;
@@ -914,7 +902,7 @@ struct fwnode_handle *device_get_named_child_node(struct device *dev,
* Find first matching named child node of this device.
* For ACPI this will be a data only sub-node.
*/
- device_for_each_child_node(dev, child) {
+ fwnode_for_each_child_node(node, child) {
if (is_of_node(child)) {
if (!of_node_cmp(to_of_node(child)->name, childname))
return child;
@@ -926,6 +914,31 @@ struct fwnode_handle *device_get_named_child_node(struct device *dev,
return NULL;
}
+EXPORT_SYMBOL_GPL(fwnode_get_named_child_node);
+
+
+/**
+ * device_get_next_child_node - Return the next child node handle for a device
+ * @dev: Device to find the next child node for.
+ * @child: Handle to one of the device's child nodes or a null handle.
+ */
+struct fwnode_handle *device_get_next_child_node(struct device *dev,
+ struct fwnode_handle *child)
+{
+ return fwnode_get_next_child_node(dev_fwnode(dev), child);
+}
+EXPORT_SYMBOL_GPL(device_get_next_child_node);
+
+/**
+ * device_get_named_child_node - Return first matching named child node handle
+ * @dev: Device to find the named child node for.
+ * @childname: String to match child node name against.
+ */
+struct fwnode_handle *device_get_named_child_node(struct device *dev,
+ const char *childname)
+{
+ return fwnode_get_named_child_node(dev_fwnode(dev), childname);
+}
EXPORT_SYMBOL_GPL(device_get_named_child_node);
/**
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index b4efe2a088ae..d501e0b967bd 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -34,4 +34,7 @@ struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *node,
for (child = fwnode_get_next_child_node(node, NULL); child; \
child = fwnode_get_next_child_node(node, child))
+struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *node,
+ const char *childname);
+
#endif
--
2.11.0.483.g087da7b7c-goog
Powered by blists - more mailing lists