aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/of_graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/of_graph.h')
-rw-r--r--include/linux/of_graph.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index befef42e015b..e43442efcbe5 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -26,6 +26,17 @@ struct of_endpoint {
const struct device_node *local_node;
};
+/**
+ * for_each_endpoint_of_node - iterate over every endpoint in a device node
+ * @parent: parent device node containing ports and endpoints
+ * @child: loop variable pointing to the current endpoint node
+ *
+ * When breaking out of the loop, of_node_put(child) has to be called manually.
+ */
+#define for_each_endpoint_of_node(parent, child) \
+ for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
+ child = of_graph_get_next_endpoint(parent, child))
+
#ifdef CONFIG_OF
int of_graph_parse_endpoint(const struct device_node *node,
struct of_endpoint *endpoint);