* [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
@ 2026-03-26 20:10 Amin GATTOUT
2026-03-26 20:24 ` Laurent Pinchart
2026-03-27 7:57 ` Luca Ceresoli
0 siblings, 2 replies; 6+ messages in thread
From: Amin GATTOUT @ 2026-03-26 20:10 UTC (permalink / raw)
To: Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Maarten Lankhorst, Maxime Ripard, Luca Ceresoli,
Thomas Zimmermann, David Airlie, Simona Vetter,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, linux-kernel, Amin GATTOUT
of_drm_find_bridge() is deprecated.
Replace it with of_drm_find_and_get_bridge() which increments
the bridge refcount as required.
Signed-off-by: Amin GATTOUT <amin.gattout@gmail.com>
---
drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
index 7ecec7b04a8d..42253c1251b5 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
@@ -72,7 +72,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
if (IS_ERR(bridge))
return PTR_ERR(bridge);
} else {
- bridge = of_drm_find_bridge(enc_node);
+ bridge = of_drm_find_and_get_bridge(enc_node);
if (!bridge)
return -EPROBE_DEFER;
---
base-commit: d813f421930c5b01b9f61043932de02602dd6ae3
change-id: 20260326-bridge-43ecbef9d39f
Best regards,
--
Amin GATTOUT <amin.gattout@gmail.com>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
2026-03-26 20:10 [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge() Amin GATTOUT
@ 2026-03-26 20:24 ` Laurent Pinchart
2026-03-27 7:57 ` Luca Ceresoli
1 sibling, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2026-03-26 20:24 UTC (permalink / raw)
To: Amin GATTOUT
Cc: Tomi Valkeinen, Kieran Bingham, Maarten Lankhorst, Maxime Ripard,
Luca Ceresoli, Thomas Zimmermann, David Airlie, Simona Vetter,
Geert Uytterhoeven, Magnus Damm, dri-devel, linux-renesas-soc,
linux-kernel
Hello Amin,
On Thu, Mar 26, 2026 at 09:10:15PM +0100, Amin GATTOUT wrote:
> of_drm_find_bridge() is deprecated.
> Replace it with of_drm_find_and_get_bridge() which increments
> the bridge refcount as required.
>
> Signed-off-by: Amin GATTOUT <amin.gattout@gmail.com>
> ---
> drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> index 7ecec7b04a8d..42253c1251b5 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> @@ -72,7 +72,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
> if (IS_ERR(bridge))
> return PTR_ERR(bridge);
> } else {
> - bridge = of_drm_find_bridge(enc_node);
> + bridge = of_drm_find_and_get_bridge(enc_node);
How did you test this ?
> if (!bridge)
> return -EPROBE_DEFER;
>
>
> ---
> base-commit: d813f421930c5b01b9f61043932de02602dd6ae3
> change-id: 20260326-bridge-43ecbef9d39f
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
2026-03-26 20:10 [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge() Amin GATTOUT
2026-03-26 20:24 ` Laurent Pinchart
@ 2026-03-27 7:57 ` Luca Ceresoli
2026-03-27 8:34 ` Laurent Pinchart
1 sibling, 1 reply; 6+ messages in thread
From: Luca Ceresoli @ 2026-03-27 7:57 UTC (permalink / raw)
To: Amin GATTOUT, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, linux-kernel
Hello Amin,
On Thu Mar 26, 2026 at 9:10 PM CET, Amin GATTOUT wrote:
> of_drm_find_bridge() is deprecated.
> Replace it with of_drm_find_and_get_bridge() which increments
> the bridge refcount as required.
Thanks for taking care of the conversion to the new API!
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> @@ -72,7 +72,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
> if (IS_ERR(bridge))
> return PTR_ERR(bridge);
> } else {
> - bridge = of_drm_find_bridge(enc_node);
> + bridge = of_drm_find_and_get_bridge(enc_node);
This change alone is not correct I'm afraid. The difference between
of_drm_find_bridge() and of_drm_find_and_get_bridge() is the latter get a
reference to the bridge, so you have to put that reference when the bridge
pointer is no more accessible.
Have a look at previous commits doing the same API replacement, you can
find examples similar to this one, where:
* the bridge pointer is stored in a local variable (not saved in a struct)
* the bridge pointer could be set wither by of_drm_find_bridge() or
a function adding a panel bridge
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
2026-03-27 7:57 ` Luca Ceresoli
@ 2026-03-27 8:34 ` Laurent Pinchart
2026-03-27 8:54 ` Amin
0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2026-03-27 8:34 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Amin GATTOUT, Tomi Valkeinen, Kieran Bingham, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Geert Uytterhoeven, Magnus Damm, dri-devel, linux-renesas-soc,
linux-kernel
Hi Luca,
On Fri, Mar 27, 2026 at 08:57:45AM +0100, Luca Ceresoli wrote:
> On Thu Mar 26, 2026 at 9:10 PM CET, Amin GATTOUT wrote:
> > of_drm_find_bridge() is deprecated.
> > Replace it with of_drm_find_and_get_bridge() which increments
> > the bridge refcount as required.
>
> Thanks for taking care of the conversion to the new API!
I suspect you may be talking to a machine (possibly through a human
proxy).
> > --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> > +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c
> > @@ -72,7 +72,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
> > if (IS_ERR(bridge))
> > return PTR_ERR(bridge);
> > } else {
> > - bridge = of_drm_find_bridge(enc_node);
> > + bridge = of_drm_find_and_get_bridge(enc_node);
>
> This change alone is not correct I'm afraid. The difference between
> of_drm_find_bridge() and of_drm_find_and_get_bridge() is the latter get a
> reference to the bridge, so you have to put that reference when the bridge
> pointer is no more accessible.
>
> Have a look at previous commits doing the same API replacement, you can
> find examples similar to this one, where:
>
> * the bridge pointer is stored in a local variable (not saved in a struct)
> * the bridge pointer could be set wither by of_drm_find_bridge() or
> a function adding a panel bridge
>
> Luca
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
2026-03-27 8:34 ` Laurent Pinchart
@ 2026-03-27 8:54 ` Amin
2026-03-27 9:04 ` Laurent Pinchart
0 siblings, 1 reply; 6+ messages in thread
From: Amin @ 2026-03-27 8:54 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Luca Ceresoli, Tomi Valkeinen, Kieran Bingham, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Geert Uytterhoeven, Magnus Damm, dri-devel, linux-renesas-soc,
linux-kernel
Hi
Thanks for the feedback. I did reference commit 7282066e55347 (Luca's
earlier conversion) but I should have been more cautious since the
patch I submitted was a bit too simple/"dummy".
To answer Laurent's question: I did not test this on hardware.
I was working through the deprecated API TODO list and made the
mistake of treating this as a simple find-and-replace.
I'll send a v2.
Thanks for the patience...
Regards,
Amin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
2026-03-27 8:54 ` Amin
@ 2026-03-27 9:04 ` Laurent Pinchart
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2026-03-27 9:04 UTC (permalink / raw)
To: Amin
Cc: Luca Ceresoli, Tomi Valkeinen, Kieran Bingham, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Geert Uytterhoeven, Magnus Damm, dri-devel, linux-renesas-soc,
linux-kernel
On Fri, Mar 27, 2026 at 09:54:42AM +0100, Amin wrote:
> Hi
>
> Thanks for the feedback. I did reference commit 7282066e55347 (Luca's
> earlier conversion) but I should have been more cautious since the
> patch I submitted was a bit too simple/"dummy".
>
> To answer Laurent's question: I did not test this on hardware.
> I was working through the deprecated API TODO list and made the
> mistake of treating this as a simple find-and-replace.
>
> I'll send a v2.
Luca has already submitted a patch, see
https://lore.kernel.org/dri-devel/20260318-drm-bridge-alloc-getput-drm_of_find_bridge-4-v3-3-10f502520357@bootlin.com/
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-27 9:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 20:10 [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge() Amin GATTOUT
2026-03-26 20:24 ` Laurent Pinchart
2026-03-27 7:57 ` Luca Ceresoli
2026-03-27 8:34 ` Laurent Pinchart
2026-03-27 8:54 ` Amin
2026-03-27 9:04 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox