Skip to content
Snippets Groups Projects
Commit feeca3f5 authored by Kumar Gala's avatar Kumar Gala Committed by Gerald Van Baren
Browse files

libfdt: Add support for using aliases in fdt_path_offset()


If the path doesn't start with '/' check to see if it matches some alias
under "/aliases" and substitute the matching alias value in the path
and retry the lookup.

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Acked-by: default avatarGerald Van Baren <vanbaren@cideas.com>
parent 0219399a
No related branches found
No related tags found
No related merge requests found
......@@ -143,8 +143,25 @@ int fdt_path_offset(const void *fdt, const char *path)
FDT_CHECK_HEADER(fdt);
if (*path != '/')
return -FDT_ERR_BADPATH;
/* see if we have an alias */
if (*path != '/') {
const char *q;
int aliasoffset = fdt_path_offset(fdt, "/aliases");
if (aliasoffset < 0)
return -FDT_ERR_BADPATH;
q = strchr(path, '/');
if (!q)
q = end;
p = fdt_getprop_namelen(fdt, aliasoffset, path, q - p, NULL);
if (!p)
return -FDT_ERR_BADPATH;
offset = fdt_path_offset(fdt, p);
p = q;
}
while (*p) {
const char *q;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment