Re: [PATCH] drm/bridge: add missing drm/drm_panel.h inclusions

From: Luca Ceresoli

Date: Tue Sep 29 2026 - 06:50:39 EST


Hello,

On Tue Sep 29, 2026 at 9:27 AM CEST, Luca Ceresoli wrote:
> Hello Arnd,
>
> On Mon Sep 28, 2026 at 6:04 PM CEST, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> The devm_drm_of_get_bridge() declaration moved to drm_panel.h, but
>> not all callers include this, which leads to build failures in
>> some configurations:
>>
>> drivers/gpu/drm/imx/lcdc/imx-lcdc.c: In function 'imx_lcdc_probe':
>> drivers/gpu/drm/imx/lcdc/imx-lcdc.c:404:18: error: implicit declaration of function 'devm_drm_of_get_bridge' [-Wimplicit-function-declaration]
>> 404 | bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
>> | ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/verisilicon/vs_bridge.c: In function 'vs_bridge_init':
>> drivers/gpu/drm/verisilicon/vs_bridge.c:306:16: error: implicit declaration of function 'devm_drm_of_get_bridge' [-Wimplicit-function-declaration]
>> 306 | next = devm_drm_of_get_bridge(drm_dev->dev, drm_dev->dev->of_node,
>> | ^~~~~~~~~~~~~~~~~~~~~~
>>
>> Include the new header in all files that need it.
>>
>> Fixes: aa8a8c7e4641 ("drm/bridge: panel: move all code to drm_panel.c")
>> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> Thanks for the very quick reaction to this regression! However I think we
> should fix it differently.
>
> I had definitely build-tested most if not all these drivers, and also
> runtime tested a few. Now I realized the build failure actually happens
> only in !OF defconfigs which I haven't build-tested (sorry about
> that!). Here's why:
>
> * the affected drivers (all or most of them) include drm_of.h
> * drm_of.h does:
> #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
> #include <linux/of.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_panel.h>
> #endif
> * DRM_PANEL_BRIDGE is always set when DRM is set, so not a problem
> * drivers which don't depend on OF and don't include drm_panel.h now fail
>
> Most of the drivers changed by this patch do 'depend on OF', so they are
> not affected. So the patch could be trimmed significantly. But still I'm
> not in favor of including drm_panel.h in the remaining drivers, because:
>
> * in the first place most/all of these drivers are now supposed to not use
> the drm_panel API anymore; thsy should just use the drm_bridge API
>
> * devm_drm_of_get_bridge() is now a deprecated [0], complicated way of
> calling of_drm_get_bridge_by_endpoint(), which is rightfully in
> drm_bridge.h
> * for this reason Documentation/drm/todo.rst says it must be removed [1]
> * removal is easy, so I plan to do it in a few weeks globally
> * after the removal all these #include <drm_panel.h> would have to
> be removed, but some might easily be forgotten
>
> So I see two option for a better fix:
>
> * Option 1 -- fix the really affected drivers by switching from the
> deprecated API to the one they recommended one. Based on quick analysis
> there are about 6.
>
> * Option 2 -- a quick surgical fix:
>
> In drm_of.h:
>
> #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
> #include <linux/of.h>
> #include <drm/drm_bridge.h>
> -#include <drm/drm_panel.h>
> #endif
> +#include <drm/drm_panel.h> /* Temporary for *_of_get_bridge() */
>
> This can easily be tracked and reverted once all
> devm_drm_of_get_bridge() users are converted to
> of_drm_get_bridge_by_endpoint().
>
> I'm working right now on option 1, hoping to get a series in a few hours
> from now. I can switch to option 2 in case of unexpected issues with option
> 1, or if a fix "really right now" is wanted.

Done [0]. I found only 3 drivers affected, but I fixed all the others that
build without OF.

[0] https://lore.kernel.org/r/20260929-drm-fix-of_get_bridge-build-regression-v1-0-ccb7e602daad@xxxxxxxxxxx

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com