From a8167d8ee2305f688d970f7ea4c38d7ca9b205ca Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 27 Jan 2020 08:49:44 -0700 Subject: dm: core: Add ofnode_read_prop() Add a new function to read a property that supports reading the length as well. Reimplement ofnode_read_string() using it and fix its comment. Signed-off-by: Simon Glass --- include/dm/ofnode.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 9e76ae8407f..80074836809 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -256,10 +256,21 @@ int ofnode_read_u64(ofnode node, const char *propname, u64 *outp); */ u64 ofnode_read_u64_default(ofnode node, const char *propname, u64 def); +/** + * ofnode_read_prop() - Read a property from a node + * + * @node: valid node reference to read property from + * @propname: name of the property to read + * @sizep: if non-NULL, returns the size of the property, or an error code + if not found + * @return property value, or NULL if there is no such property + */ +const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep); + /** * ofnode_read_string() - Read a string from a property * - * @ref: valid node reference to read property from + * @node: valid node reference to read property from * @propname: name of the property to read * @return string from property value, or NULL if there is no such property */ -- cgit v1.2.3