summaryrefslogtreecommitdiffstats
path: root/include/of.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-08-13 16:48:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-08-14 10:03:28 +0200
commit6c9e799a00cbdb50fa9129b57a59766010c63ffa (patch)
treec85a8017b4e5951df8d5d0f9513ca8d40bec062b /include/of.h
parent55909550f8eed7d67117327ca7f6e5692988938d (diff)
downloadbarebox-6c9e799a00cbdb50fa9129b57a59766010c63ffa.tar.gz
barebox-6c9e799a00cbdb50fa9129b57a59766010c63ffa.tar.xz
of: introduce some new helpers
of_get_tree_max_phandle - get the maximum phandle of a tree. Needed for creating new phandles without conflicts. of_node_create_phandle - create a phandle for a node which doesn't have one. of_find_node_by_alias - find a node by alias name of_find_node_by_path_or_alias - find a node by full path or alias name of_find_root_node - find the root node for a given device node Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/of.h')
-rw-r--r--include/of.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index b99f0b2dae..2c77ee6bf3 100644
--- a/include/of.h
+++ b/include/of.h
@@ -689,4 +689,18 @@ int of_device_enable_path(const char *path);
int of_device_disable(struct device_node *node);
int of_device_disable_path(const char *path);
+phandle of_get_tree_max_phandle(struct device_node *root);
+phandle of_node_create_phandle(struct device_node *node);
+struct device_node *of_find_node_by_alias(struct device_node *root,
+ const char *alias);
+struct device_node *of_find_node_by_path_or_alias(struct device_node *root,
+ const char *str);
+
+static inline struct device_node *of_find_root_node(struct device_node *node)
+{
+ while (node->parent)
+ node = node->parent;
+
+ return node;
+}
#endif /* __OF_H */