9
0
Fork 0

of: base: implement of_get_next_child

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-11-09 11:06:43 +01:00
parent d0c482359f
commit d96f74f26f
2 changed files with 25 additions and 0 deletions

View File

@ -1569,6 +1569,23 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
}
EXPORT_SYMBOL(of_get_next_available_child);
/**
* of_get_next_child - Iterate a node childs
* @node: parent node
* @prev: previous child of the parent node, or NULL to get first
*
* Returns a node pointer with refcount incremented.
*/
struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev)
{
prev = list_prepare_entry(prev, &node->children, parent_list);
list_for_each_entry_continue(prev, &node->children, parent_list)
return prev;
return NULL;
}
EXPORT_SYMBOL(of_get_next_child);
/**
* of_get_child_count - Count child nodes of given parent node
* @parent: parent node

View File

@ -153,6 +153,8 @@ extern int of_device_is_available(const struct device_node *device);
extern struct device_node *of_get_parent(const struct device_node *node);
extern struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev);
struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
extern int of_get_child_count(const struct device_node *parent);
extern int of_get_available_child_count(const struct device_node *parent);
extern struct device_node *of_get_child_by_name(const struct device_node *node,
@ -308,6 +310,12 @@ static inline struct device_node *of_get_next_available_child(
return NULL;
}
static inline struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev)
{
return NULL;
}
static inline int of_get_child_count(const struct device_node *parent)
{
return -ENOSYS;