of: introduce of_get_available_child_count
Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs. Cc: Josh Wu <josh.wu@atmel.com> Signed-off-by: Bryan Wu <cooloney@gmail.com> Acked-by: Rob Herring <rob.herring@calxeda.com>
This commit is contained in:
@@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np)
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int of_get_available_child_count(const struct device_node *np)
|
||||||
|
{
|
||||||
|
struct device_node *child;
|
||||||
|
int num = 0;
|
||||||
|
|
||||||
|
for_each_available_child_of_node(np, child)
|
||||||
|
num++;
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
extern struct device_node *of_find_node_with_property(
|
extern struct device_node *of_find_node_with_property(
|
||||||
struct device_node *from, const char *prop_name);
|
struct device_node *from, const char *prop_name);
|
||||||
#define for_each_node_with_property(dn, prop_name) \
|
#define for_each_node_with_property(dn, prop_name) \
|
||||||
@@ -376,6 +387,11 @@ static inline int of_get_child_count(const struct device_node *np)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int of_get_available_child_count(const struct device_node *np)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int of_device_is_compatible(const struct device_node *device,
|
static inline int of_device_is_compatible(const struct device_node *device,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user