Re: [PATCH] drm/rcar-du: Convert to of_drm_find_and_get_bridge()
From: Luca Ceresoli
Date: Fri Mar 27 2026 - 03:58:11 EST
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