[PATCH v3 10/22] drm/meson: encoder_cvbs: get/put the next bridge

Luca Ceresoli
2025-12-16T18:00:23Z

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.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/meson/meson_encoder_cvbs.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
index dc374bfc5951..41071d6e05e5 100644
--- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c
+++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
@@ -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");

--
2.52.0