aboutsummaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorSimon Glass2023-09-26 08:14:42 -0600
committerTom Rini2023-10-06 14:38:13 -0400
commit67fb2159fb3438359fa0fc3f8cb491ffe8d57c0f (patch)
tree6a61f1cb1fe3ecc763fac9bdb6b1ac17e67490e6 /include/dm
parentc15862ffdd5f7797338808cf7645786109bcddc3 (diff)
dm: core: Add a way to delete a node
Add a function to delete a node in an existing tree. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/of_access.h18
-rw-r--r--include/dm/ofnode.h13
2 files changed, 31 insertions, 0 deletions
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index 9361d0a87bf..de740d44674 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -597,4 +597,22 @@ int of_write_prop(struct device_node *np, const char *propname, int len,
int of_add_subnode(struct device_node *node, const char *name, int len,
struct device_node **subnodep);
+/**
+ * of_remove_property() - Remove a property from a node
+ *
+ * @np: Node to remove from
+ * @prop: Pointer to property to remove
+ * Return 0 if OK, -ENODEV if the property could not be found in the node
+ */
+int of_remove_property(struct device_node *np, struct property *prop);
+
+/**
+ * of_remove_node() - Remove a node from the tree
+ *
+ * @to_remove: Node to remove
+ * Return: 0 if OK, -EPERM if it is the root node (wWhich cannot be removed),
+ * -ENOENT if the tree is broken (to_remove is not a child of its parent)
+ */
+int of_remove_node(struct device_node *to_remove);
+
#endif
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 7eb04accd62..f1ee02cd837 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -1635,4 +1635,17 @@ int ofnode_copy_props(ofnode dst, ofnode src);
int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src,
ofnode *nodep);
+/**
+ * ofnode_delete() - Delete a node
+ *
+ * Delete a node from the tree
+ *
+ * @nodep: Pointer to node to delete (set to ofnode_null() on success)
+ * Return: 0 if OK, -ENOENT if the node does not exist, -EPERM if it is the root
+ * node (wWhich cannot be removed), -EFAULT if the tree is broken (to_remove is
+ * not a child of its parent),
+ *
+ */
+int ofnode_delete(ofnode *nodep);
+
#endif