Skip to contentSkip to conversation

of: introduce of_get_available_child_count

PATCH In review Bryan Wu 3 participants 6 messages Sep 24, 2013 – Oct 25, 2013 5 messages not in the archive Device tree

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 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.

---
 include/linux/of.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/of.h +16 -0
index f95aee3..54c2560 100644
@@ -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)
 {
Signature · 6 lines
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1380045009-21149-1-git-send-email-cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by
#2 lore raw
Quoted 7 lines · Bryan Wu

Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs.

---

I assume you have some user and will take this dependency thru that tree?

Quoted 28 lines
 include/linux/of.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/of.h +11 -0
index f95aee3..54c2560 100644
@@ -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;

include/linux/of.h static inline int of_get_child_count(const struct device_node *np) · line 397

Quoted 10 lines
include/linux/of.h +5 -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)
 {

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 5 lines · Rob Herring
Quoted 4 lines · Bryan Wu

Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs.

Quoted 8 lines
Quoted 3 lines

---

I assume you have some user and will take this dependency thru that tree?

Exactly, a patch from Josh [1] inspired me to create this API.

Thanks,
-Bryan

[1]: https://lkml.org/lkml/2013/9/24/68

Quoted 29 lines
Quoted 29 lines
 include/linux/of.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/of.h +11 -0
index f95aee3..54c2560 100644
@@ -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;
 }
 
Quoted 10 lines

include/linux/of.h static inline int of_get_child_count(const struct device_node *np) · line 397

Quoted 9 lines
include/linux/of.h +5 -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)
 {

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAK5ve-LbgMrD1SFqpaW-L2cmEahaA9Ff+wjrrxwJiG=cVkQrrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#6 lore raw
Quoted 6 lines · Bryan Wu
Quoted 5 lines · Rob Herring
Quoted 4 lines · Bryan Wu

Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

---

Will this patch be merged through you guys or need I take care of it?

Thanks,
-Bryan

Quoted 50 lines
Quoted 2 lines

I assume you have some user and will take this dependency thru that tree?

Exactly, a patch from Josh [1] inspired me to create this API.

Thanks,
-Bryan

[1]: https://lkml.org/lkml/2013/9/24/68

Quoted 39 lines
Quoted 38 lines
 include/linux/of.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/of.h +16 -0
index f95aee3..54c2560 100644
@@ -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)
 {

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAK5ve-+8ySa3gi8smSo88Sq2RCNFRMuB-hSYLs0CYBtkiaG-bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw
Quoted 7 lines · Bryan Wu
Quoted 6 lines · Bryan Wu
Quoted 5 lines · Rob Herring
Quoted 4 lines · Bryan Wu

Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

---

Will this patch be merged through you guys or need I take care of it?

Merge it with the patch that needs it.

g.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131025000225.6E449C403B6-WNowdnHR2B42iJbIjFUEsiwD8/[email protected]

author
#10 lore raw
Quoted 12 lines · Grant Likely
Quoted 11 lines · Bryan Wu
Quoted 10 lines · Bryan Wu
Quoted 9 lines · Rob Herring
Quoted 7 lines · Bryan Wu

Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs.

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Will this patch be merged through you guys or need I take care of it?

Merge it with the patch that needs it.

OK, I will do that.
-Bryan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html