aboutsummaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorSimon Glass2023-09-26 08:14:41 -0600
committerTom Rini2023-10-06 14:38:12 -0400
commitc15862ffdd5f7797338808cf7645786109bcddc3 (patch)
tree5a398e2216bb1aefba447303b087b75939d5e656 /include/dm
parente0c3c21d8ba1a0abbb7effee6c5a952f3e65a03d (diff)
dm: core: Add a way to copy a node
Add a function to copy a node to another place under a new name. This is useful at least for testing, since copying a test node with existing properties is easier than writing the code to generate it all afresh. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/ofnode.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0b96ab34ede..7eb04accd62 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1620,4 +1620,19 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep);
*/
int ofnode_copy_props(ofnode dst, ofnode src);
+/**
+ * ofnode_copy_node() - Copy a node to another place
+ *
+ * If a node with this name already exists in dst_parent, this returns an
+ * .error
+ *
+ * @dst_parent: Parent of the newly copied node
+ * @name: Name to give the new node
+ * @src: Source node to copy
+ * @nodep: Returns the new node, or the existing node if there is one
+ * Return: 0 if OK, -EEXIST if dst_parent already has a node with this parent
+ */
+int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src,
+ ofnode *nodep);
+
#endif