dm: core: Add a function to create an empty tree

Provide a function to create a new, empty tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-09-26 08:14:40 -06:00
committed by Tom Rini
parent 9bf78a5add
commit e0c3c21d8b
5 changed files with 104 additions and 4 deletions

View File

@@ -127,6 +127,15 @@ static inline ofnode noffset_to_ofnode(ofnode other_node, int of_offset)
#endif /* OFNODE_MULTI_TREE */
/**
* oftree_new() - Create a new, empty tree
*
* @treep: Returns a pointer to the tree, on success
* Returns: 0 on success, -ENOMEM if out of memory, -E2BIG if !OF_LIVE and
* there are too many (flattrees) already
*/
int oftree_new(oftree *treep);
/**
* ofnode_to_np() - convert an ofnode to a live DT node pointer
*

View File

@@ -46,4 +46,12 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes);
*/
void of_live_free(struct device_node *root);
/**
* of_live_create_empty() - Create a new, empty tree
*
* @rootp: Returns the root node of the created tree
* Return: 0 if OK, -ENOMEM if out of memory
*/
int of_live_create_empty(struct device_node **rootp);
#endif