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

Maxime Ripard <[email protected]>
Newsgroups gmane.linux.kernel,gmane.comp.video.dri.devel
Message-ID <20260817-wonderful-helpful-falcon-db81c9@houat>
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 <[email protected]>

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
signature.asc (application/pgp-signature, 273 B)
-----BEGIN PGP SIGNATURE-----

iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCaoLFvwAKCRAnX84Zoj2+
dukxAX9Wzw0vUAsnDfnLRDWYZgHtwUIJEwLuUq2f501vIQPdF3NEE583hT/w5oNx
+YqiRukBf0MeTKbqcK8HATX1hDNH/3HiuJ0B3gjU1SRCV+A5Urh4qYnmIw1fct/Z
c/AD8nO35Q==
=jzve
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.