Re: [PATCH v2 07/10] drm/bridge: dw-hdmi: move next_bridge lookup to attach time
From: Liu Ying
Date: Wed Apr 01 2026 - 23:58:12 EST
On Mon, Mar 30, 2026 at 09:25:48PM +0200, Luca Ceresoli wrote:
> This driver looks up the next_bridge at probe time and stores it in
> hdmi->bridge.next_bridge, but only uses the stored value when attaching,
> and only in the DRM_BRIDGE_ATTACH_NO_CONNECTOR case.
>
> This will be problematic with an upcoming change, adding an hdmi-connector
> using a device tree overlay when not present. That change is in turn
> necessary to migrate the i.MX LCDIF driver to the bridge-connector.
>
> The problem is that, adding the hdmi-connector via an overlay, devlink
> considers hdmi-connector a consumer of the dw-hdmi device, generating a
> chicken-egg problem:
>
> * hdmi-connector probe won't be tried until dw-hdmi is probed (devlink)
> * dw-hdmi probe will defer until it finds the next_bridge (the
> hdmi-connector wrapper bridge)
>
> In preparation for those changes, move the next_bridge lookup from probe to
> attach, when it is actually used. This allows dw-hdmi to probe, so that the
> hdmi-connector can probe as well.
>
> Also avoid storing the pointer in hdmi->bridge.next_bridge: the value is
> computed when needed, thus a local variable is enough.
>
> Finally, this also allows to slightly improve the code by not doing any DT
> lookup in the !DRM_BRIDGE_ATTACH_NO_CONNECTOR case.
>
> Tested-by: Martyn Welch <martyn.welch@xxxxxxxxxxxxx>
> Tested-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx> # TQMa8MPxL/MBa8MPxL
> Signed-off-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>
>
> ---
>
> Changes in v2:
> - Fix returned error codes
> - Added missing cleanup.h include
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 +++++++++++--------------------
> 1 file changed, 16 insertions(+), 29 deletions(-)
Acked-by: Liu Ying <victor.liu@xxxxxxx>