summaryrefslogtreecommitdiff
path: root/lib/libfdt/fdt_rw.c
diff options
context:
space:
mode:
authorGerald Van Baren <gvb@unssw.com>2012-10-22 20:42:09 -0400
committerGerald Van Baren <gvb@unssw.com>2012-10-22 20:42:09 -0400
commitcae4a8a2a81ca6cd16d5de1b55d47e315cbff05a (patch)
tree3dd515f19084bb1e4ae2afc8d51888edc294d752 /lib/libfdt/fdt_rw.c
parentbcf28c23f2195a91e0713337934f630a9c7bc5a9 (diff)
parentc71b64f3617b5a4362c6e4e0aefdd66d6ac6affd (diff)
downloadu-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.zip
u-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.tar.gz
u-boot-imx-cae4a8a2a81ca6cd16d5de1b55d47e315cbff05a.tar.bz2
Merge branch 'next'
Diffstat (limited to 'lib/libfdt/fdt_rw.c')
-rw-r--r--lib/libfdt/fdt_rw.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c
index 5c27a67..5ed23d6 100644
--- a/lib/libfdt/fdt_rw.c
+++ b/lib/libfdt/fdt_rw.c
@@ -293,6 +293,33 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,
return 0;
}
+int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
+ const void *val, int len)
+{
+ struct fdt_property *prop;
+ int err, oldlen, newlen;
+
+ FDT_RW_CHECK_HEADER(fdt);
+
+ prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
+ if (prop) {
+ newlen = len + oldlen;
+ err = _fdt_splice_struct(fdt, prop->data,
+ FDT_TAGALIGN(oldlen),
+ FDT_TAGALIGN(newlen));
+ if (err)
+ return err;
+ prop->len = cpu_to_fdt32(newlen);
+ memcpy(prop->data + oldlen, val, len);
+ } else {
+ err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+ if (err)
+ return err;
+ memcpy(prop->data, val, len);
+ }
+ return 0;
+}
+
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
{
struct fdt_property *prop;