Re: [PATCH v5 20/25] drm/tilcdc: Use devm_drm_of_get_bridge() helper
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Date: 2026-01-30 19:31:30
Also in:
dri-devel, linux-devicetree, linux-omap, lkml
Hi Kory, On Fri Jan 23, 2026 at 5:12 PM CET, Kory Maincent (TI.com) wrote:
Replace drm_of_find_panel_or_bridge() with the newer devm_drm_of_get_bridge() helper which simplifies the code by: - Automatically handling both panel and bridge cases internally - Managing the panel-to-bridge conversion when needed - Using devres for resource management, eliminating manual cleanup This removes the need for explicit panel-to-bridge conversion via devm_drm_panel_bridge_add_typed() and the associated error handling path. Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
I'm OK with this patch, based on the v4 discussion. I have a question however, see below.
quoted hunk ↗ jump to hunk
--- a/drivers/gpu/drm/tilcdc/tilcdc_encoder.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_encoder.c@@ -55,15 +55,12 @@ int tilcdc_encoder_create(struct drm_device *ddev) struct tilcdc_drm_private *priv = ddev_to_tilcdc_priv(ddev); struct tilcdc_encoder *encoder; struct drm_bridge *bridge; - struct drm_panel *panel; - int ret; - ret = drm_of_find_panel_or_bridge(ddev->dev->of_node, 0, 0, - &panel, &bridge); - if (ret == -ENODEV) + bridge = devm_drm_of_get_bridge(ddev->dev, ddev->dev->of_node, 0, 0); + if (PTR_ERR(bridge) == -ENODEV) return 0; - else if (ret) - return ret; + else if (IS_ERR(bridge)) + return PTR_ERR(bridge); encoder = drmm_simple_encoder_alloc(ddev, struct tilcdc_encoder, base, DRM_MODE_ENCODER_NONE);@@ -73,12 +70,5 @@ int tilcdc_encoder_create(struct drm_device *ddev) } priv->encoder = encoder; - if (panel) { - bridge = devm_drm_panel_bridge_add_typed(ddev->dev, panel, - DRM_MODE_CONNECTOR_DPI);
You are introducing a subtle difference here: while you pass the connector type to devm_drm_panel_bridge_add_typed(), devm_drm_of_get_bridge() does not take it and expects it to ahve been set previously and errors out if it hasn't. Can you ensure the connector type is alway set before this devm_drm_of_get_bridge() call? All the changes to the driver in the previous patches of this series make it hard to find that out from here. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com