aboutsummaryrefslogtreecommitdiff
path: root/include/dm/of_access.h
diff options
context:
space:
mode:
authorSimon Glass2022-09-06 20:27:02 -0600
committerTom Rini2022-09-29 16:07:58 -0400
commitffe90392497898ccd8000e695901853e192a9007 (patch)
tree0331cda0c368be1cf676f0ea4e8c99e28125b8d0 /include/dm/of_access.h
parent5ecba3ba40cebd5e4340f6fd422683bde773689c (diff)
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>
Diffstat (limited to 'include/dm/of_access.h')
-rw-r--r--include/dm/of_access.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index d8c6d116433..dd70b44344d 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -565,4 +565,19 @@ struct device_node *of_get_stdout(void);
int of_write_prop(struct device_node *np, const char *propname, int len,
const void *value);
+/**
+ * of_add_subnode() - add a new subnode to a node
+ *
+ * @node: parent node to add to
+ * @name: name of subnode
+ * @len: length of name (so the caller does not need to nul-terminate a
+ * partial string), or -1 for strlen(@name)
+ * @subnodep: 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 of_add_subnode(struct device_node *node, const char *name, int len,
+ struct device_node **subnodep);
+
#endif