diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-10-25 22:03:28 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-27 08:26:40 +0100 |
commit | 21aea1d9ff07bbb9098d419118d9a4de0d5bfc60 (patch) | |
tree | da24d67c33e31ca012b95065aa615042fdc29598 /drivers/of/of_path.c | |
parent | 75b682795eafb2385556a9642f09e0af96a1264a (diff) | |
download | barebox-21aea1d9ff07bbb9098d419118d9a4de0d5bfc60.tar.gz barebox-21aea1d9ff07bbb9098d419118d9a4de0d5bfc60.tar.xz |
of_path: add of_find_path_by_node()
This patch adds the function of_find_path_by_node(), which is similar to
of_find_path(), but it translates a device tree node into a barebox device path
directly.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of/of_path.c')
-rw-r--r-- | drivers/of/of_path.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index ad64bee08a..6903905259 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -126,7 +126,7 @@ static int __of_find_path(struct device_node *node, const char *propname, char * i = 1; - while (1) { + while (propname) { ret = of_property_read_string_index(node, propname, i++, &str); if (ret) break; @@ -149,6 +149,21 @@ static int __of_find_path(struct device_node *node, const char *propname, char * } /** + * of_find_path_by_node - translate a node in the devicetree to a + * barebox device path + * + * @node: the node we're interested in + * @outpath: if this function returns 0 outpath will contain the path belonging + * to the input path description. Must be freed with free(). + * @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available + * + */ +int of_find_path_by_node(struct device_node *node, char **outpath, unsigned flags) +{ + return __of_find_path(node, NULL, outpath, flags); +} + +/** * of_find_path - translate a path description in the devicetree to a barebox * path * |