dm: core: Allow adding ofnode subnodes

Add this feature to the ofnode interface, supporting both livetree and
flattree. If the node exists it is returned, along with a -EEXIST error.
Update the functions it calls to handle this too.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-09-06 20:27:02 -06:00
committed by Tom Rini
parent 5ecba3ba40
commit ffe9039249
5 changed files with 197 additions and 0 deletions

View File

@@ -1300,6 +1300,19 @@ static inline const char *ofnode_conf_read_str(const char *prop_name)
{
return NULL;
}
#endif /* CONFIG_DM */
/**
* of_add_subnode() - add a new subnode to a node
*
* @parent: parent node to add to
* @name: name of subnode
* @nodep: returns pointer to new subnode (valid if the function returns 0
* or -EEXIST)
* Returns 0 if OK, -EEXIST if already exists, -ENOMEM if out of memory, other
* -ve on other error
*/
int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep);
#endif