linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Saravana Kannan <saravanak@google.com>
Subject: [PATCH] of: property: stop parsing remote-endpoint graph properties
Date: Fri, 26 Nov 2021 03:26:12 +0300	[thread overview]
Message-ID: <20211126002612.1030246-1-dmitry.baryshkov@linaro.org> (raw)

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@linaro.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 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


             reply	other threads:[~2021-11-26  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  0:26 Dmitry Baryshkov [this message]
2021-11-29 23:44 ` [PATCH] of: property: stop parsing remote-endpoint graph properties Saravana Kannan
2021-11-30  0:40   ` Dmitry Baryshkov
2022-01-10 21:03     ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211126002612.1030246-1-dmitry.baryshkov@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).