aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-10-17 19:41:14 -0600
committerMichal Simek <michal.simek@xilinx.com>2015-11-04 14:49:51 +0100
commit3bc37a50e0db9978c6fbb1b2b6c3a351cebe631e (patch)
treef8a7b3409e4da684b0f394eaac2b89d49c444d33 /lib
parent44303dfa792b0a4f81d6f6a719467db9a20063b5 (diff)
downloadu-boot-3bc37a50e0db9978c6fbb1b2b6c3a351cebe631e.zip
u-boot-3bc37a50e0db9978c6fbb1b2b6c3a351cebe631e.tar.gz
u-boot-3bc37a50e0db9978c6fbb1b2b6c3a351cebe631e.tar.bz2
fdt: Add a function to look up a /chosen property
It is sometimes useful to find a property in the chosen node. Add a function for this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9db033a..e1df144 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -601,16 +601,21 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
return -ENOENT;
}
-int fdtdec_get_chosen_node(const void *blob, const char *name)
+const char *fdtdec_get_chosen_prop(const void *blob, const char *name)
{
- const char *prop;
int chosen_node;
- int len;
if (!blob)
- return -FDT_ERR_NOTFOUND;
+ return NULL;
chosen_node = fdt_path_offset(blob, "/chosen");
- prop = fdt_getprop(blob, chosen_node, name, &len);
+ return fdt_getprop(blob, chosen_node, name, NULL);
+}
+
+int fdtdec_get_chosen_node(const void *blob, const char *name)
+{
+ const char *prop;
+
+ prop = fdtdec_get_chosen_prop(blob, name);
if (!prop)
return -FDT_ERR_NOTFOUND;
return fdt_path_offset(blob, prop);