[PATCH v2 2/6] drm/meson/dw-hdmi: convert to of_drm_find_and_get_bridge()
Luca Ceresoli
luca.ceresoli at bootlin.com
Tue Jan 13 09:30:58 PST 2026
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 at bootlin.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 at kernel.org>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl at googlemail.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
More information about the linux-arm-kernel
mailing list