]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/bridge: lt8713sx: switch to of_drm_get_bridge_by_endpoint()
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Mon, 11 May 2026 16:40:13 +0000 (18:40 +0200)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 19 May 2026 08:57:26 +0000 (10:57 +0200)
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().

Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal. To achieve this, instead of
adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
pointer which is automatically put when the bridge is eventually freed.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260511-drm-bridge-alloc-getput-panel_or_bridge-v6-9-f61c9e498b3f@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/lontium-lt8713sx.c

index 18fac6a46db46b733624b659efcda8383d5b4bb8..cee485adf5e56117bbf1b49d19693d418dfe23a3 100644 (file)
@@ -32,7 +32,6 @@ DECLARE_CRC8_TABLE(lt8713sx_crc_table);
 struct lt8713sx {
        struct device *dev;
        struct drm_bridge bridge;
-       struct drm_bridge *next_bridge;
 
        struct regmap *regmap;
        /* Protects all accesses to registers by stopping the on-chip MCU */
@@ -458,7 +457,7 @@ static int lt8713sx_bridge_attach(struct drm_bridge *bridge,
        struct lt8713sx *lt8713sx = container_of(bridge, struct lt8713sx, bridge);
 
        return drm_bridge_attach(encoder,
-                               lt8713sx->next_bridge,
+                               lt8713sx->bridge.next_bridge,
                                bridge, flags);
 }
 
@@ -537,10 +536,9 @@ static int lt8713sx_probe(struct i2c_client *client)
        if (IS_ERR(lt8713sx->regmap))
                return dev_err_probe(dev, PTR_ERR(lt8713sx->regmap), "regmap i2c init failed\n");
 
-       ret = drm_of_find_panel_or_bridge(lt8713sx->dev->of_node, 1, -1, NULL,
-                                         &lt8713sx->next_bridge);
-       if (ret < 0)
-               return ret;
+       lt8713sx->bridge.next_bridge = of_drm_get_bridge_by_endpoint(lt8713sx->dev->of_node, 1, -1);
+       if (IS_ERR(lt8713sx->bridge.next_bridge))
+               return PTR_ERR(lt8713sx->bridge.next_bridge);
 
        ret = lt8713sx_gpio_init(lt8713sx);
        if (ret < 0)