[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DEH2R1Q0XJJG.1NMESYMX9GMFL@bootlin.com>
Date: Mon, 24 Nov 2025 17:44:09 +0100
From: "Luca Ceresoli" <luca.ceresoli@...tlin.com>
To: "Maxime Ripard" <mripard@...nel.org>
Cc: "Andrzej Hajda" <andrzej.hajda@...el.com>, "Neil Armstrong"
<neil.armstrong@...aro.org>, "Robert Foss" <rfoss@...nel.org>, "Laurent
Pinchart" <Laurent.pinchart@...asonboard.com>, "Jonas Karlman"
<jonas@...boo.se>, "Jernej Skrabec" <jernej.skrabec@...il.com>, "Maarten
Lankhorst" <maarten.lankhorst@...ux.intel.com>, "Thomas Zimmermann"
<tzimmermann@...e.de>, "David Airlie" <airlied@...il.com>, "Simona Vetter"
<simona@...ll.ch>, "Jonathan Corbet" <corbet@....net>, "Alexey Brodkin"
<abrodkin@...opsys.com>, "Phong LE" <ple@...libre.com>, "Liu Ying"
<victor.liu@....com>, "Shawn Guo" <shawnguo@...nel.org>, "Sascha Hauer"
<s.hauer@...gutronix.de>, "Pengutronix Kernel Team"
<kernel@...gutronix.de>, "Fabio Estevam" <festevam@...il.com>, "Adrien
Grassein" <adrien.grassein@...il.com>, "Laurent Pinchart"
<laurent.pinchart+renesas@...asonboard.com>, "Tomi Valkeinen"
<tomi.valkeinen+renesas@...asonboard.com>, "Kieran Bingham"
<kieran.bingham+renesas@...asonboard.com>, "Geert Uytterhoeven"
<geert+renesas@...der.be>, "Magnus Damm" <magnus.damm@...il.com>, "Kevin
Hilman" <khilman@...libre.com>, "Jerome Brunet" <jbrunet@...libre.com>,
"Martin Blumenstingl" <martin.blumenstingl@...glemail.com>, "Chun-Kuang Hu"
<chunkuang.hu@...nel.org>, "Philipp Zabel" <p.zabel@...gutronix.de>,
"Matthias Brugger" <matthias.bgg@...il.com>, "AngeloGioacchino Del Regno"
<angelogioacchino.delregno@...labora.com>, "Anitha Chrisanthus"
<anitha.chrisanthus@...el.com>, "Edmund Dea" <edmund.j.dea@...el.com>,
"Inki Dae" <inki.dae@...sung.com>, "Seung-Woo Kim"
<sw0312.kim@...sung.com>, "Kyungmin Park" <kyungmin.park@...sung.com>,
"Krzysztof Kozlowski" <krzk@...nel.org>, "Alim Akhtar"
<alim.akhtar@...sung.com>, "Hui Pu" <Hui.Pu@...ealthcare.com>, "Thomas
Petazzoni" <thomas.petazzoni@...tlin.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<linux-doc@...r.kernel.org>, <imx@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-renesas-soc@...r.kernel.org>, <linux-amlogic@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <linux-samsung-soc@...r.kernel.org>,
"Anusha Srivatsa" <asrivats@...hat.com>
Subject: Re: [PATCH 04/26] drm/bridge: make of_drm_find_bridge() a wrapper
of drm_of_find_bridge()
Hi,
+Cc Anusha
On Mon Nov 24, 2025 at 11:22 AM CET, Maxime Ripard wrote:
> Hi,
>
> On Wed, Nov 19, 2025 at 02:05:35PM +0100, Luca Ceresoli wrote:
>> of_drm_find_bridge() is identical to drm_of_find_bridge() except it does
>> not increment the refcount. Rewrite it as a wrapper and put the bridge
>> being returned so the behaviour is still the same.
>>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
>
> Kind of the same comment than on the TODO. Is it worth doing that patch
> when we could just remove it at the end of the series?
This series is not converting all users I'm afraid.
There are still some drivers to convert, but not a big deal.
The main user to be converted is drm_of_find_panel_or_bridge(), which is
very tricky, and in turn it is used by devm_drm_of_get_bridge(). We
discussed this in the past and the conclusion was a rework of the drm_panel
lifetime was needed to be able to properly replace
drm_of_find_panel_or_bridge().
A drm_panel rework had started very well with devm_drm_panel_alloc() that
got upstreamed by Anusha, but I'm not sure if it has made further progress
after that. So AFAICT the plan is still "People will gradually switch to
the new API over time", and the deprecated of_drm_find_bridge() will be
removed after that.
Does it still make sense to you?
Maxime, Anusha, are you aware of any steps forward about dynamic panel
lifetime, after devm_drm_panel_alloc()?
>> @@ -1460,19 +1460,11 @@ EXPORT_SYMBOL(drm_of_find_bridge);
>> */
>> struct drm_bridge *of_drm_find_bridge(struct device_node *np)
>> {
>> - struct drm_bridge *bridge;
>> -
>> - mutex_lock(&bridge_lock);
>> + struct drm_bridge *bridge = drm_of_find_bridge(np);
>>
>> - list_for_each_entry(bridge, &bridge_list, list) {
>> - if (bridge->of_node == np) {
>> - mutex_unlock(&bridge_lock);
>> - return bridge;
>> - }
>> - }
>> + drm_bridge_put(bridge);
>
> And if it does make sense to keep that patch, we should add a comment
> here to document why we are doing this.
OK, what about:
/**
* We need to emulate the original semantice of of_drm_find_bridge(), which
* was not getting any bridge reference. Being now based on
* drm_of_find_bridge() which gets a reference, put it before returning.
*/
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists