drivers: of: add for_each_available_child_of_node() macro
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 7 May 2014 14:38:43 +0000 (16:38 +0200)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:47:47 +0000 (11:47 +0900)
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I7713121fa18e780df480c5a5c6ebfa0972424f6f

include/linux/of.h

index 5e9d352..ff860fc 100644 (file)
@@ -290,6 +290,11 @@ extern int of_add_property(struct device_node *np, struct property *prop);
 extern int of_remove_property(struct device_node *np, struct property *prop);
 extern int of_update_property(struct device_node *np, struct property *newprop);
 
+#define for_each_available_child_of_node(parent, child) \
+       for (child = of_get_next_available_child(parent, NULL); child != NULL; \
+            child = of_get_next_available_child(parent, child))
+
+
 /* For updating the device tree at runtime */
 #define OF_RECONFIG_ATTACH_NODE                0x0001
 #define OF_RECONFIG_DETACH_NODE                0x0002