diff options
author | Teresa Gámez <t.gamez@phytec.de> | 2014-09-30 13:15:28 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-10-01 08:13:02 +0200 |
commit | d1d7876499405493688a7f79a49651dbbe099c52 (patch) | |
tree | 1108793465f472278d7ed445b9a9e8bb740f617a /drivers | |
parent | 55475204cd0939f9c426c648706bf63486029657 (diff) | |
download | barebox-d1d7876499405493688a7f79a49651dbbe099c52.tar.gz barebox-d1d7876499405493688a7f79a49651dbbe099c52.tar.xz |
of: base: Add of_parse_phandle_from
Added of_parse_phandle_from() to be able to use external root nodes.
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/base.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 061fc79e60..f363cc1224 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1130,16 +1130,19 @@ int of_property_write_u64_array(struct device_node *np, } /** - * of_parse_phandle - Resolve a phandle property to a device_node pointer + * of_parse_phandle_from - Resolve a phandle property to a device_node pointer from + * a given root node * @np: Pointer to device node holding phandle property + * @root: root node of the tree to search in. If NULL use the internal tree. * @phandle_name: Name of property holding a phandle value * @index: For properties holding a table of phandles, this is the index into * the table * * Returns the device_node pointer found or NULL. */ -struct device_node *of_parse_phandle(const struct device_node *np, - const char *phandle_name, int index) +struct device_node *of_parse_phandle_from(const struct device_node *np, + struct device_node *root, + const char *phandle_name, int index) { const __be32 *phandle; int size; @@ -1148,7 +1151,24 @@ struct device_node *of_parse_phandle(const struct device_node *np, if ((!phandle) || (size < sizeof(*phandle) * (index + 1))) return NULL; - return of_find_node_by_phandle(be32_to_cpup(phandle + index)); + return of_find_node_by_phandle_from(be32_to_cpup(phandle + index), + root); +} +EXPORT_SYMBOL(of_parse_phandle_from); + +/** + * of_parse_phandle - Resolve a phandle property to a device_node pointer + * @np: Pointer to device node holding phandle property + * @phandle_name: Name of property holding a phandle value + * @index: For properties holding a table of phandles, this is the index into + * the table + * + * Returns the device_node pointer found or NULL. + */ +struct device_node *of_parse_phandle(const struct device_node *np, + const char *phandle_name, int index) +{ + return of_parse_phandle_from(np, root_node, phandle_name, index); } EXPORT_SYMBOL(of_parse_phandle); |