From 96875e7d3b9900d0e63f0b591ff5693b31c4d9c3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 2 Apr 2012 13:18:41 +0000 Subject: fdt: Add function to locate an array in the device tree fdtdec_locate_array() locates an integer array but does not copy it. This saves the caller having to allocated wasted space. Access to array elements should be through the fdt32_to_cpu() macro. Signed-off-by: Simon Glass Signed-off-by: Tom Warren --- lib/fdtdec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/fdtdec.c b/lib/fdtdec.c index bdec1a0d96..4a5ab712b5 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -363,6 +363,17 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name, return err; } +const u32 *fdtdec_locate_array(const void *blob, int node, + const char *prop_name, int count) +{ + const u32 *cell; + int err; + + cell = get_prop_check_min_len(blob, node, prop_name, + sizeof(u32) * count, &err); + return err ? NULL : cell; +} + int fdtdec_get_bool(const void *blob, int node, const char *prop_name) { const s32 *cell; -- cgit v1.2.1