diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-09 23:36:04 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-13 08:38:18 +0200 |
commit | 6913850321aaa3464ab3dad7b05ff06d02462ec8 (patch) | |
tree | e4df2b195ae2e21c099234c60f904d23389299ea /drivers/of | |
parent | cc44a37924447f5e0cd2bf6900280a43ccbd7e50 (diff) | |
download | barebox-6913850321aaa3464ab3dad7b05ff06d02462ec8.tar.gz barebox-6913850321aaa3464ab3dad7b05ff06d02462ec8.tar.xz |
of_graph: add of_graph_port_is_available
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index b3718e71ea..8dd04ca3ce 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); |