From f8a2d7a4162d2c8ca6adbb1fe0ef7d2a9765c923 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 22 Feb 2016 22:55:39 -0700 Subject: libfdt: Add a function to write a property placeholder The existing function to add a new property to a tree being built requires that the entire contents of the new property be passed in. For some applications it is more convenient to be able to add the property contents later, perhaps by reading from a file. This avoids double-buffering of the contents. Add a new function to support this and adust the existing fdt_property() to use it. Signed-off-by: Simon Glass --- include/libfdt.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/libfdt.h b/include/libfdt.h index e48c21a..74b1d14 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1181,6 +1181,22 @@ static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) { return fdt_property_u32(fdt, name, val); } + +/** + * fdt_property_placeholder - add a new property and return a ptr to its value + * + * @fdt: pointer to the device tree blob + * @name: name of property to add + * @len: length of property value in bytes + * @valp: returns a pointer to where where the value should be placed + * + * returns: + * 0, on success + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_NOSPACE, standard meanings + */ +int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp); + #define fdt_property_string(fdt, name, str) \ fdt_property(fdt, name, str, strlen(str)+1) int fdt_end_node(void *fdt); -- cgit v1.1