[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DFNN251V4JL9.2ECEDGOKN8I4F@bootlin.com>
Date: Tue, 13 Jan 2026 18:30:58 +0100
From: "Luca Ceresoli" <luca.ceresoli@...tlin.com>
To: "Martin Blumenstingl" <martin.blumenstingl@...glemail.com>
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>, "Maxime Ripard"
<mripard@...nel.org>, "Thomas Zimmermann" <tzimmermann@...e.de>, "David
Airlie" <airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>, "Kevin
Hilman" <khilman@...libre.com>, "Jerome Brunet" <jbrunet@...libre.com>,
"Philipp Zabel" <p.zabel@...gutronix.de>, "Shawn Guo"
<shawnguo@...nel.org>, "Sascha Hauer" <s.hauer@...gutronix.de>,
"Pengutronix Kernel Team" <kernel@...gutronix.de>, "Fabio Estevam"
<festevam@...il.com>, "Chun-Kuang Hu" <chunkuang.hu@...nel.org>, "Matthias
Brugger" <matthias.bgg@...il.com>, "AngeloGioacchino Del Regno"
<angelogioacchino.delregno@...labora.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>, "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>, "Marek
Szyprowski" <m.szyprowski@...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-amlogic@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>, <imx@...ts.linux.dev>,
<linux-mediatek@...ts.infradead.org>, <linux-samsung-soc@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH v2 2/6] drm/meson/dw-hdmi: convert to
of_drm_find_and_get_bridge()
Hello Martin,
On Mon Jan 12, 2026 at 11:21 PM CET, Martin Blumenstingl wrote:
> Hi Luca,
>
> On Fri, Jan 9, 2026 at 11:03 AM Luca Ceresoli <luca.ceresoli@...tlin.com> wrote:
>>
>> of_drm_find_bridge() is deprecated. Move to its replacement
>> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
>> is put when done.
>>
>> dw_hdmi->bridge is used only in dw_hdmi_top_thread_irq(), so in order to
>> avoid potential use-after-free ensure the irq is freed before putting the
>> dw_hdmi->bridge reference.
>>
>> Acked-by: Maxime Ripard <mripard@...nel.org>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
>
> [...]
>> @@ -789,8 +789,12 @@ static void meson_dw_hdmi_unbind(struct device *dev, struct device *master,
>> void *data)
>> {
>> struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
>> + struct platform_device *pdev = to_platform_device(dev);
>> + int irq = platform_get_irq(pdev, 0);
>>
>> + devm_free_irq(dev, irq, meson_dw_hdmi);
> I have one question (so I can understand things better):
> is there a particular reason why you went with free'ing the IRQ
> instead of "just" masking it (so the hardware won't fire anymore of
> those IRQs)?
One reason is symmetry: _bind requests the irq, so _unbind does the
reverse.
Another is I don't have the hardware, so I wanted my changes to be as small
and clear as possible.
In principle one could request/free the irq in probe/remove and then
enable/disable it in bind/unbind. Whether it would be a good or bad idea I
don't know, but surely it would be more complex and I wouldn't want to do
it without any chance to test it on hardware.
Also, that would only optimize the case of multiple bind/unbind cycles,
which are not quite realistic without bridge hotplug. And brigde hotplug
does not exist yet in mainline, and when it will arrive it will be used
only for a few use cases.
I hope this answers your question.
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists