dm: core: Rename ofnode_get_chosen_prop()

This function is actually intended to read a string rather than a
property. All of its current callers use it that way. Also there is no way
to return the length of the property from this function.

Rename it to better indicate its purpose, using ofnode_read as the prefix
since this matches most other functions.

Also add some tests which are missing for these functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-01-27 08:49:43 -07:00
parent 74d594a20e
commit 14ca9f7f5a
6 changed files with 32 additions and 8 deletions

View File

@@ -510,14 +510,15 @@ int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
ofnode ofnode_path(const char *path);
/**
* ofnode_get_chosen_prop() - get the value of a chosen property
* ofnode_read_chosen_string() - get the string value of a chosen property
*
* This looks for a property within the /chosen node and returns its value
* This looks for a property within the /chosen node and returns its value,
* checking that it is a valid nul-terminated string
*
* @propname: Property name to look for
* @return property value if found, else NULL
* @return string value if found, else NULL
*/
const char *ofnode_get_chosen_prop(const char *propname);
const char *ofnode_read_chosen_string(const char *propname);
/**
* ofnode_get_chosen_node() - get a referenced node from the chosen node