[PATCH 03/13] of_graph: add of_graph_port_is_available
Sascha Hauer
s.hauer at pengutronix.de
Thu Jul 9 00:24:07 PDT 2015
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/of/base.c | 22 ++++++++++++++++++++++
include/of_graph.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b2c4b23..334b8a2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2210,3 +2210,25 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node)
return np->parent;
}
EXPORT_SYMBOL(of_graph_get_remote_port);
+
+int of_graph_port_is_available(struct device_node *node)
+{
+ struct device_node *endpoint;
+ int available = 0;
+
+ for_each_child_of_node(node, endpoint) {
+ struct device_node *remote_parent;
+
+ remote_parent = of_graph_get_remote_port_parent(endpoint);
+ if (!remote_parent)
+ continue;
+
+ if (!of_device_is_available(remote_parent))
+ continue;
+
+ available = 1;
+ }
+
+ return available;
+}
+EXPORT_SYMBOL(of_graph_port_is_available);
diff --git a/include/of_graph.h b/include/of_graph.h
index fa037db..254dd2c 100644
--- a/include/of_graph.h
+++ b/include/of_graph.h
@@ -45,5 +45,6 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
struct device_node *of_graph_get_remote_port_parent(
const struct device_node *node);
struct device_node *of_graph_get_remote_port(const struct device_node *node);
+int of_graph_port_is_available(struct device_node *node);
#endif /* __LINUX_OF_GRAPH_H */
--
2.1.4
More information about the barebox
mailing list