drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Fri, 9 Jan 2026 07:31:40 +0000 (08:31 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 20 Jan 2026 13:53:46 +0000 (14:53 +0100)
of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

Since the companion bridge pointer is used by many bridge funcs, putting
its reference in the remove function would be dangerous. Use .destroy to
put it on final deallocation.

Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20260109-drm-bridge-alloc-getput-drm_of_find_bridge-2-v2-9-8bad3ef90b9f@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c

index 1225029..675995c 100644 (file)
@@ -62,6 +62,15 @@ static inline struct imx8qxp_ldb *base_to_imx8qxp_ldb(struct ldb *base)
        return container_of(base, struct imx8qxp_ldb, base);
 }
 
+static void imx8qxp_ldb_bridge_destroy(struct drm_bridge *bridge)
+{
+       struct ldb_channel *ldb_ch = bridge->driver_private;
+       struct ldb *ldb = ldb_ch->ldb;
+       struct imx8qxp_ldb *imx8qxp_ldb = base_to_imx8qxp_ldb(ldb);
+
+       drm_bridge_put(imx8qxp_ldb->companion);
+}
+
 static void imx8qxp_ldb_set_phy_cfg(struct imx8qxp_ldb *imx8qxp_ldb,
                                    unsigned long di_clk, bool is_split,
                                    struct phy_configure_opts_lvds *phy_cfg)
@@ -391,6 +400,7 @@ imx8qxp_ldb_bridge_mode_valid(struct drm_bridge *bridge,
 }
 
 static const struct drm_bridge_funcs imx8qxp_ldb_bridge_funcs = {
+       .destroy                = imx8qxp_ldb_bridge_destroy,
        .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        .atomic_destroy_state   = drm_atomic_helper_bridge_destroy_state,
        .atomic_reset           = drm_atomic_helper_bridge_reset,
@@ -552,7 +562,7 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
                goto out;
        }
 
-       imx8qxp_ldb->companion = of_drm_find_bridge(companion_port);
+       imx8qxp_ldb->companion = of_drm_find_and_get_bridge(companion_port);
        if (!imx8qxp_ldb->companion) {
                ret = -EPROBE_DEFER;
                DRM_DEV_DEBUG_DRIVER(dev,