Skip to content

Commit 782bfd0

Browse files
Saravana Kannanrobherring
authored andcommitted
of: property: Improve finding the supplier of a remote-endpoint property
After commit 4a03282 ("of: property: Simplify of_link_to_phandle()"), remote-endpoint properties created a fwnode link from the consumer device to the supplier endpoint. This is a tiny bit inefficient (not buggy) when trying to create device links or detecting cycles. So, improve this the same way we improved finding the consumer of a remote-endpoint property. Fixes: 4a03282 ("of: property: Simplify of_link_to_phandle()") Signed-off-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20240207011803.2637531-3-saravanak@google.com Signed-off-by: Rob Herring <robh@kernel.org>
1 parent f4653ec commit 782bfd0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/of/property.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,6 @@ DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL)
12321232
DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL)
12331233
DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL)
12341234
DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)
1235-
DEFINE_SIMPLE_PROP(remote_endpoint, "remote-endpoint", NULL)
12361235
DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells")
12371236
DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells")
12381237
DEFINE_SIMPLE_PROP(leds, "leds", NULL)
@@ -1298,6 +1297,17 @@ static struct device_node *parse_interrupts(struct device_node *np,
12981297
return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np;
12991298
}
13001299

1300+
static struct device_node *parse_remote_endpoint(struct device_node *np,
1301+
const char *prop_name,
1302+
int index)
1303+
{
1304+
/* Return NULL for index > 0 to signify end of remote-endpoints. */
1305+
if (!index || strcmp(prop_name, "remote-endpoint"))
1306+
return NULL;
1307+
1308+
return of_graph_get_remote_port_parent(np);
1309+
}
1310+
13011311
static const struct supplier_bindings of_supplier_bindings[] = {
13021312
{ .parse_prop = parse_clocks, },
13031313
{ .parse_prop = parse_interconnects, },

0 commit comments

Comments
 (0)