From: Bryan Wu Date: Tue, 24 Sep 2013 17:38:26 +0000 (-0700) Subject: of: introduce of_get_available_child_count X-Git-Tag: next-20131025~25^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=72976b65afee02d6dd06f74f6b6672c7f10c4a9a;p=karo-tx-linux.git 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 Signed-off-by: Bryan Wu --- diff --git a/include/linux/of.h b/include/linux/of.h index f95aee391e30..54c25606a997 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np) 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( struct device_node *from, const char *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; } +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, const char *name) {