diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2017-01-16 16:11:48 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2017-01-16 17:26:04 +0000 |
commit | 29440c19861894af1b283b3dd0f2f1e66c67eca6 (patch) | |
tree | 03b31d9f6762f599443248482c7153f6448611a5 /lib/libfdt/fdt_wip.c | |
parent | a78676b105a90c286ad43e58fc02477512235114 (diff) | |
download | platform_external_arm-trusted-firmware-29440c19861894af1b283b3dd0f2f1e66c67eca6.tar.gz platform_external_arm-trusted-firmware-29440c19861894af1b283b3dd0f2f1e66c67eca6.tar.bz2 platform_external_arm-trusted-firmware-29440c19861894af1b283b3dd0f2f1e66c67eca6.zip |
libfdt: Replace v1.4.1 by v1.4.2
Delete old version of libfdt at lib/libfdt. Move new libfdt API
headers to include/lib/libfdt and all other files to lib/libfdt.
Change-Id: I32b7888f1f20d62205310e363accbef169ad7b1b
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'lib/libfdt/fdt_wip.c')
-rw-r--r-- | lib/libfdt/fdt_wip.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/libfdt/fdt_wip.c b/lib/libfdt/fdt_wip.c index c5bbb68d3..6aaab3999 100644 --- a/lib/libfdt/fdt_wip.c +++ b/lib/libfdt/fdt_wip.c @@ -55,21 +55,42 @@ #include "libfdt_internal.h" +int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, + const char *name, int namelen, + uint32_t idx, const void *val, + int len) +{ + void *propval; + int proplen; + + propval = fdt_getprop_namelen_w(fdt, nodeoffset, name, namelen, + &proplen); + if (!propval) + return proplen; + + if (proplen < (len + idx)) + return -FDT_ERR_NOSPACE; + + memcpy((char *)propval + idx, val, len); + return 0; +} + int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, const void *val, int len) { - void *propval; + const void *propval; int proplen; - propval = fdt_getprop_w(fdt, nodeoffset, name, &proplen); + propval = fdt_getprop(fdt, nodeoffset, name, &proplen); if (! propval) return proplen; if (proplen != len) return -FDT_ERR_NOSPACE; - memcpy(propval, val, len); - return 0; + return fdt_setprop_inplace_namelen_partial(fdt, nodeoffset, name, + strlen(name), 0, + val, len); } static void _fdt_nop_region(void *start, int len) |