mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
libfdt: Add fdt_setprop_namelen_string()
Macro using fdt_setprop_namelen() internally similar to `fdt_setprop_string()`. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Ayush Singh <ayush@beagleboard.org> Message-ID: <20241205-setprop-namelen-v2-4-0d85a3d2e7b1@beagleboard.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
bdca861200
commit
755db11535
1 changed files with 32 additions and 0 deletions
|
@ -1919,6 +1919,38 @@ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
|
||||||
#define fdt_setprop_string(fdt, nodeoffset, name, str) \
|
#define fdt_setprop_string(fdt, nodeoffset, name, str) \
|
||||||
fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
|
fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fdt_setprop_namelen_string - set a property to a string value
|
||||||
|
* @fdt: pointer to the device tree blob
|
||||||
|
* @nodeoffset: offset of the node whose property to change
|
||||||
|
* @name: name of the property to change
|
||||||
|
* @namelen: number of characters of name to consider
|
||||||
|
* @str: string value for the property
|
||||||
|
*
|
||||||
|
* fdt_setprop_namelen_string() sets the value of the named property in the
|
||||||
|
* given node to the given string value (using the length of the
|
||||||
|
* string to determine the new length of the property), or creates a
|
||||||
|
* new property with that value if it does not already exist.
|
||||||
|
*
|
||||||
|
* This function may insert or delete data from the blob, and will
|
||||||
|
* therefore change the offsets of some existing nodes.
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* 0, on success
|
||||||
|
* -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
|
||||||
|
* contain the new property value
|
||||||
|
* -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
|
||||||
|
* -FDT_ERR_BADLAYOUT,
|
||||||
|
* -FDT_ERR_BADMAGIC,
|
||||||
|
* -FDT_ERR_BADVERSION,
|
||||||
|
* -FDT_ERR_BADSTATE,
|
||||||
|
* -FDT_ERR_BADSTRUCTURE,
|
||||||
|
* -FDT_ERR_BADLAYOUT,
|
||||||
|
* -FDT_ERR_TRUNCATED, standard meanings
|
||||||
|
*/
|
||||||
|
#define fdt_setprop_namelen_string(fdt, nodeoffset, name, namelen, str) \
|
||||||
|
fdt_setprop_namelen((fdt), (nodeoffset), (name), (namelen), (str), \
|
||||||
|
strlen(str) + 1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fdt_setprop_empty - set a property to an empty value
|
* fdt_setprop_empty - set a property to an empty value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue