[PATCH 01/11] of: make of_alias_get work on all types of DT paths

Lucas Stach dev at lynxeye.de
Tue Mar 3 11:46:13 PST 2015


of_alias_get assumed that a DT path is always the full node path,
whic is not necessarily the case, as there are other valid path
descriptions. All of them are handled by of_find_node_by_path.

As there is already a preparsed list with all DT aliases that handles
this case properly we can simply reuse that one.

Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 drivers/of/base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index af10fd1..b77d879 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -227,11 +227,11 @@ EXPORT_SYMBOL_GPL(of_alias_get_id);
 
 const char *of_alias_get(struct device_node *np)
 {
-	struct property *pp;
+	struct alias_prop *app;
 
-	list_for_each_entry(pp, &of_aliases->properties, list) {
-		if (!of_node_cmp(np->full_name, pp->value))
-			return pp->name;
+	list_for_each_entry(app, &aliases_lookup, link) {
+		if (np == app->np)
+			return app->alias;
 	}
 
 	return NULL;
-- 
2.1.0




More information about the barebox mailing list