summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorBryan Wu <cooloney@gmail.com>2013-09-24 10:38:26 -0700
committerBryan Wu <cooloney@gmail.com>2013-10-25 10:12:31 -0700
commit954e04b9491adea99e4590bc73937fdd8774ab3c (patch)
treeff4b2d6f961b9243e1a678f0c054a555c652e67e /include/linux/of.h
parentbb6febdc90efe7f664328075c204eed8e9af7ec9 (diff)
downloadblackbird-op-linux-954e04b9491adea99e4590bc73937fdd8774ab3c.tar.gz
blackbird-op-linux-954e04b9491adea99e4590bc73937fdd8774ab3c.zip
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>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h16
1 files changed, 16 insertions, 0 deletions
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)
{
OpenPOWER on IntegriCloud