summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2023-03-09 11:28:32 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2023-05-03 23:50:55 +1000
commitdf093279282ca0cff4d20ceb3bb5857117ed4cc4 (patch)
treea028d1349f4d640e944e7ccbf0abd18bf93d7895
parent129bb4b78bc6c56ee517a044ba5c9dfc220f899c (diff)
downloaddevice-tree-compiler-df093279282ca0cff4d20ceb3bb5857117ed4cc4.tar.gz
add fdt_path_getprop_namelen() helper
Add a wrapper for fdt_getprop_namelen() allowing one to specify the node by path instead of offset. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--libfdt/fdt_ro.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index 9f6c551..cc2fd88 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -522,6 +522,18 @@ uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
return fdt32_ld_(php);
}
+static const void *fdt_path_getprop_namelen(const void *fdt, const char *path,
+ const char *propname, int propnamelen,
+ int *lenp)
+{
+ int offset = fdt_path_offset(fdt, path);
+
+ if (offset < 0)
+ return NULL;
+
+ return fdt_getprop_namelen(fdt, offset, propname, propnamelen, lenp);
+}
+
const char *fdt_get_alias_namelen(const void *fdt,
const char *name, int namelen)
{