[PATCH] of: property: stop parsing remote-endpoint graph properties
From: Dmitry Baryshkov
Date: Thu Nov 25 2021 - 19:28:24 EST
When parsing remote-endpoint properties, two counter devlinks will be
created, resulting in the circular dependency, which is later broken. In
most of the cases, the order in which depency is broken does not matter
(or is correct). However lately I stumbled upon the following
configuration.
In this case for some reason devlink code decided to break the loop by
making panel depend on the bridge driver, enforcing that bridge is
probed before the panel.
However in such cases the bridge will lookup next bridge or panel using
drm_of_find_panel_or_bridge() in the probe callback. Thus we have a
deadlock: panel is waiting for the bridge because of the devlink
dependency and bridge probe() expects the panel to be available and thus
returns -EPROBE_DEFER.
To prevent such deadlocks, stop parsing the remote-endpoint property and
let drivers decide their probe order using standard -EPROBE_DEFER
returns.
DTS except follows:
/ {
panel0 {
compatible = "powertip,ph800480t013-idf02";
power-supply = <&vreg_l11c_3p3>;
backlight = <&lcd0_reg>;
port {
panel0_in: endpoint {
remote-endpoint = <&bridge0_out>;
};
};
};
};
&dsi0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
bridge@0 {
reg = <0>;
compatible = "toshiba,tc358762";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
bridge0_in: endpoint {
remote-endpoint = <&dsi0_out>;
};
};
port@1 {
reg = <1>;
bridge0_out: endpoint {
remote-endpoint = <&panel0_in>;
};
};
};
};
ports {
port@1 {
endpoint {
remote-endpoint = <&bridge0_in>;
data-lanes = <0 1 2 3>;
};
};
};
};
Fixes: f7514a663016 ("of: property: fw_devlink: Add support for remote-endpoint")
Cc: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
Cc: Stephen Boyd <swboyd@xxxxxxxxxxxx>
Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
---
drivers/of/property.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index f7229e4030e3..83548076ee63 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1249,7 +1249,6 @@ static struct device_node *parse_##fname(struct device_node *np, \
* @parse_prop.index: For properties holding a list of phandles, this is the
* index into the list
* @optional: Describes whether a supplier is mandatory or not
- * @node_not_dev: The consumer node containing the property is never a device.
*
* Returns:
* parse_prop() return values are
@@ -1261,7 +1260,6 @@ struct supplier_bindings {
struct device_node *(*parse_prop)(struct device_node *np,
const char *prop_name, int index);
bool optional;
- bool node_not_dev;
};
DEFINE_SIMPLE_PROP(interconnects, "interconnects", "#interconnect-cells")
@@ -1285,7 +1283,6 @@ DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL)
DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL)
DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL)
DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)
-DEFINE_SIMPLE_PROP(remote_endpoint, "remote-endpoint", NULL)
DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells")
DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells")
DEFINE_SIMPLE_PROP(leds, "leds", NULL)
@@ -1388,7 +1385,6 @@ static const struct supplier_bindings of_supplier_bindings[] = {
{ .parse_prop = parse_pinctrl6, },
{ .parse_prop = parse_pinctrl7, },
{ .parse_prop = parse_pinctrl8, },
- { .parse_prop = parse_remote_endpoint, .node_not_dev = true, },
{ .parse_prop = parse_pwms, },
{ .parse_prop = parse_resets, },
{ .parse_prop = parse_leds, },
@@ -1437,9 +1433,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
while ((phandle = s->parse_prop(con_np, prop_name, i))) {
struct device_node *con_dev_np;
- con_dev_np = s->node_not_dev
- ? of_get_compat_node(con_np)
- : of_node_get(con_np);
+ con_dev_np = of_node_get(con_np);
matched = true;
i++;
of_link_to_phandle(con_dev_np, phandle);
--
2.33.0