diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2023-03-09 11:28:32 +0100 |
---|---|---|
committer | Pierre-Clément Tosi <ptosi@google.com> | 2023-10-11 18:35:43 +0100 |
commit | 19db536250d6357c47a75f0d06f691fd025a25c8 (patch) | |
tree | 49044de44607a7133fd5fb7913c62547c08a705a | |
parent | f20cff01e7e83ef976787bab1571568d64c0b11d (diff) | |
download | dtc-19db536250d6357c47a75f0d06f691fd025a25c8.tar.gz |
FROMGIT: 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>
(cherry-picked from commit df093279282ca0cff4d20ceb3bb5857117ed4cc4 git://git.kernel.org/pub/scm/utils/dtc/dtc.git main)
Test: N/A
Change-Id: If9a102a622dfa726b7cb10f58c38f1b52d233be6
-rw-r--r-- | libfdt/fdt_ro.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index e61df25..31f78e2 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -525,6 +525,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) { |