mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
ee67016fcc
commit
9c19761a7e
2 changed files with 25 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue