]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/meson: encoder_cvbs: get/put the next bridge
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 16 Dec 2025 17:58:43 +0000 (18:58 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 30 Dec 2025 09:11:33 +0000 (10:11 +0100)
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to of_drm_find_and_get_bridge() for the bridge to be
refcounted and use bridge->next_bridge to put the reference on
deallocation.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-10-b5165fab8058@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/meson/meson_encoder_cvbs.c

index dc374bfc5951c0f13fc28f44325aa845ab590056..41071d6e05e5f51357d1c08f9f3a460af8c1b755 100644 (file)
@@ -33,7 +33,6 @@
 struct meson_encoder_cvbs {
        struct drm_encoder      encoder;
        struct drm_bridge       bridge;
-       struct drm_bridge       *next_bridge;
        struct meson_drm        *priv;
 };
 
@@ -89,7 +88,7 @@ static int meson_encoder_cvbs_attach(struct drm_bridge *bridge,
        struct meson_encoder_cvbs *meson_encoder_cvbs =
                                        bridge_to_meson_encoder_cvbs(bridge);
 
-       return drm_bridge_attach(encoder, meson_encoder_cvbs->next_bridge,
+       return drm_bridge_attach(encoder, meson_encoder_cvbs->bridge.next_bridge,
                                 &meson_encoder_cvbs->bridge, flags);
 }
 
@@ -241,9 +240,9 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv)
                return 0;
        }
 
-       meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote);
+       meson_encoder_cvbs->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
        of_node_put(remote);
-       if (!meson_encoder_cvbs->next_bridge)
+       if (!meson_encoder_cvbs->bridge.next_bridge)
                return dev_err_probe(priv->dev, -EPROBE_DEFER,
                                     "Failed to find CVBS Connector bridge\n");