diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-03 09:44:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-03 09:44:08 -0700 |
commit | a54dfb1a845c38a97686268d8c4086a63d9493aa (patch) | |
tree | 3b31c81672fa89102aae929cc6c1e48e6e9382f4 /scripts/dtc/libfdt/fdt_rw.c | |
parent | eb0ad9c06d51edb5d18a7007fd4d77a8805b2ba7 (diff) | |
parent | 36165f55055781a0e4bf32d775241796414504b0 (diff) |
Merge tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux
Pull devicetree updates from Rob Herring:
- Import of latest upstream device tree compiler (dtc)
- New function of_get_child_by_name
- Support for #size-cells of 0 and #addr-cells of >2
- Couple of DT binding documentation updates
Fix up trivial conflicts due to of_get_child_by_name() having been added
next to the new of_get_next_available_child().
* tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux:
MAINTAINERS: add scripts/dtc under Devicetree maintainers
dtc: import latest upstream dtc
dt: Document general interrupt controller bindings
dt/s3c64xx/spi: Use of_get_child_by_name to get a named child
dt: introduce of_get_child_by_name to get child node by name
of: i2c: add support for wakeup-source property
of/address: Handle #address-cells > 2 specially
DT: export of_irq_to_resource_table()
devicetree: serial: Add documentation for imx serial
devicetree: pwm: mxs-pwm.txt: Fix reg field annotation
of: Allow busses with #size-cells=0
Diffstat (limited to 'scripts/dtc/libfdt/fdt_rw.c')
-rw-r--r-- | scripts/dtc/libfdt/fdt_rw.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c index 8e7ec4cb7bc..24437dfc32b 100644 --- a/scripts/dtc/libfdt/fdt_rw.c +++ b/scripts/dtc/libfdt/fdt_rw.c @@ -289,6 +289,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; @@ -406,6 +433,8 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize) struct_size = 0; while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) ; + if (struct_size < 0) + return struct_size; } if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) { |