summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@st.com>2012-09-18 08:10:28 +0100
committerRob Herring <rob.herring@calxeda.com>2012-10-01 10:42:21 -0500
commit9c19761a7ecdc86abb2fba0feb81e8952eccc1f1 (patch)
tree7da34de41c8b77b9cccf446d53a3943be33b6c3c /include/linux/of.h
parentee67016fcc58998c44a9c99b0721568b3d2edc6e (diff)
dt: introduce of_get_child_by_name to get child node by name
This patch introduces of_get_child_by_name function to get a child node by its name in a given parent node. Without this patch each driver code has to iterate the parent and do a string compare, However having of_get_child_by_name libary function would avoid code duplication, errors and is more convenient. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 5919ee33f2b..fabb524d3d7 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -190,6 +190,8 @@ extern struct device_node *of_get_parent(const struct device_node *node);
extern struct device_node *of_get_next_parent(struct device_node *node);
extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
+extern struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name);
#define for_each_child_of_node(parent, child) \
for (child = of_get_next_child(parent, NULL); child != NULL; \
child = of_get_next_child(parent, child))