[PATCH 8/9] of: property: implement the count_references() fwnode operation
From: Bartosz Golaszewski
Date: Wed Nov 04 2026 - 09:11:18 EST
Implement the property_count_references() fwnode operation for OF nodes
by wrapping the existing of_count_phandle_with_args().
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
drivers/of/property.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 16c9c307633bdc7c9343782b1cd3bdb845552c6a..ae2561479e2382b241fd87dcddf52dc7f52a950e 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1231,6 +1231,12 @@ of_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
return 0;
}
+static int of_fwnode_count_references(const struct fwnode_handle *fwnode,
+ const char *prop, const char *nargs_prop)
+{
+ return of_count_phandle_with_args(to_of_node(fwnode), prop, nargs_prop);
+}
+
static struct fwnode_handle *
of_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle *prev)
@@ -1747,6 +1753,7 @@ const struct fwnode_operations of_fwnode_ops = {
.get_parent = of_fwnode_get_parent,
.get_next_child_node = of_fwnode_get_next_child_node,
.get_named_child_node = of_fwnode_get_named_child_node,
+ .count_references = of_fwnode_count_references,
.get_reference_args = of_fwnode_get_reference_args,
.graph_get_next_endpoint = of_fwnode_graph_get_next_endpoint,
.graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint,
--
2.47.3