]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm: rcar-du: lvds: convert to of_drm_find_and_get_bridge()
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Fri, 9 Jan 2026 10:02:55 +0000 (11:02 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Wed, 21 Jan 2026 12:59:56 +0000 (13:59 +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 .atomic_enable, 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-3-v2-6-8d7a3dbacdf4@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c

index 001b3543924a873066d3ac554f3ebc0b1c5bfee8..227818e37390ffa6dae12156b3faf8c42fd9e106 100644 (file)
@@ -633,6 +633,13 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge,
        return true;
 }
 
+static void rcar_lvds_destroy(struct drm_bridge *bridge)
+{
+       struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
+
+       drm_bridge_put(lvds->companion);
+}
+
 static int rcar_lvds_attach(struct drm_bridge *bridge,
                            struct drm_encoder *encoder,
                            enum drm_bridge_attach_flags flags)
@@ -648,6 +655,7 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
        .attach = rcar_lvds_attach,
+       .destroy = rcar_lvds_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,
@@ -740,7 +748,7 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds)
                goto done;
        }
 
-       lvds->companion = of_drm_find_bridge(companion);
+       lvds->companion = of_drm_find_and_get_bridge(companion);
        if (!lvds->companion) {
                ret = -EPROBE_DEFER;
                goto done;