Re: [PATCH 03/11] drm: of: drm_of_find_panel_or_bridge: prioritize the bridge, not the panel

From: Maxime Ripard

Date: Mon Aug 17 2026 - 04:27:56 EST


Hi,

On Fri, Aug 14, 2026 at 04:05:51PM +0200, Luca Ceresoli wrote:
> By the documentation drm_of_find_panel_or_bridge() returns a "drm_panel or
> drm_bridge", without specifying which one is returned in case both exist.
>
> Definitely it never returns both. If both exist (and @bridge is != NULL),
> the current implementation prioritizes the drm_panel pointer and returns
> that. In most cases (including devm_drm_of_get_bridge() and
> drmm_of_get_bridge()) this is used to implement the following logic
> (simplified):
>
> drm_of_find_panel_or_bridge(..., &panel, &bridge);
> if (panel)
> bridge = [devm_]drm_panel_bridge_add[_typed](panel);
>
> Work is in progress to make every drm_panel automatically create a
> panel_bridge, so a panel_bridge will always be present for every
> drm_panel. This means the above logic would create a panel_bridge that
> already exists. Avoid it by returning the drm_bridge when both are present,
> instead of the drm_panel.
>
> For the case where @bridge == NULL, this commit does not change anything:
> the 'if (bridge)' body is never executed and the drm_panel (if found) is
> always returned.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>

I'm always a bit concerned about that kind of change, because you
basically change some part of the API we don't really know if a driver
relies on.

That being said, if we do create a panel_bridge for every panel, why do
we still need drm_of_find_panel_or_bridge()? We'll only really need
of_drm_find_bridge(), no?

Maxime

Attachment: signature.asc
Description: PGP signature