summaryrefslogtreecommitdiff
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorFrank Rowand <frowand.list@gmail.com>2023-02-13 12:57:02 -0600
committerRob Herring <robh@kernel.org>2023-02-20 15:37:19 -0600
commitd9194e009efef9613f48022f3c885191c48120f9 (patch)
tree12609eee961b9c7845c0d8173271db84422f4829 /include/linux/of.h
parentec0b7e24d566a843e3cfba21a6471170fdb0f810 (diff)
of: dynamic: add lifecycle docbook info to node creation functions
The existing docbook comments for the functions related to creating a devicetree node do not explain the reference count of a newly created node, how decrementing the reference count to zero will free the associated memory, and the caller's responsibility to call of_node_put() on the node. Explain what happens when the reference count is decremented to zero. Signed-off-by: Frank Rowand <frowand.list@gmail.com> Link: https://lore.kernel.org/r/20230213185702.395776-8-frowand.list@gmail.com Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 37afd04f36eb..1cb659e682f5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -100,6 +100,17 @@ struct of_reconfig_data {
struct property *old_prop;
};
+/**
+ * of_node_init - initialize a devicetree node
+ * @node: Pointer to device node that has been created by kzalloc()
+ * @phandle_name: Name of property holding a phandle value
+ *
+ * On return the device_node refcount is set to one. Use of_node_put()
+ * on @node when done to free the memory allocated for it. If the node
+ * is NOT a dynamic node the memory will not be freed. The decision of
+ * whether to free the memory will be done by node->release(), which is
+ * of_node_release().
+ */
/* initialize a node */
extern const struct kobj_type of_node_ktype;
extern const struct fwnode_operations of_fwnode_ops;