Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329207
b: refs/heads/master
c: 9c19761
h: refs/heads/master
i:
  329205: 50e036f
  329203: 252e64f
  329199: 5e9f83e
v: v3
  • Loading branch information
Srinivas Kandagatla authored and Rob Herring committed Oct 1, 2012
1 parent 31619e5 commit 297b284
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee67016fcc58998c44a9c99b0721568b3d2edc6e
refs/heads/master: 9c19761a7ecdc86abb2fba0feb81e8952eccc1f1
23 changes: 23 additions & 0 deletions trunk/drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,29 @@ struct device_node *of_get_next_child(const struct device_node *node,
}
EXPORT_SYMBOL(of_get_next_child);

/**
* of_get_child_by_name - Find the child node by name for a given parent
* @node: parent node
* @name: child name to look for.
*
* This function looks for child node for given matching name
*
* Returns a node pointer if found, with refcount incremented, use
* of_node_put() on it when done.
* Returns NULL if node is not found.
*/
struct device_node *of_get_child_by_name(const struct device_node *node,
const char *name)
{
struct device_node *child;

for_each_child_of_node(node, child)
if (child->name && (of_node_cmp(child->name, name) == 0))
break;
return child;
}
EXPORT_SYMBOL(of_get_child_by_name);

/**
* of_find_node_by_path - Find a node matching a full OF path
* @path: The full path to match
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 297b284

Please sign in to comment.