[PATCH v3 12/22] drm/meson: encoder_hdmi: get/put the next bridge

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

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_hdmi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
index 8205ee56a691..dc4e23590a6e 100644
--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
@@ -38,7 +38,6 @@
struct meson_encoder_hdmi {
struct drm_encoder encoder;
struct drm_bridge bridge;
- struct drm_bridge *next_bridge;
struct drm_connector *connector;
struct meson_drm *priv;
unsigned long output_bus_fmt;
@@ -54,7 +53,7 @@ static int meson_encoder_hdmi_attach(struct drm_bridge *bridge,
{
struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);

- return drm_bridge_attach(encoder, encoder_hdmi->next_bridge,
+ return drm_bridge_attach(encoder, encoder_hdmi->bridge.next_bridge,
&encoder_hdmi->bridge, flags);
}

@@ -334,7 +333,7 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge,
const struct drm_edid *drm_edid;
const struct edid *edid;

- drm_edid = drm_bridge_edid_read(encoder_hdmi->next_bridge,
+ drm_edid = drm_bridge_edid_read(encoder_hdmi->bridge.next_bridge,
encoder_hdmi->connector);
if (!drm_edid)
return;
@@ -390,8 +389,8 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
return 0;
}

- meson_encoder_hdmi->next_bridge = of_drm_find_bridge(remote);
- if (!meson_encoder_hdmi->next_bridge) {
+ meson_encoder_hdmi->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
+ if (!meson_encoder_hdmi->bridge.next_bridge) {
ret = dev_err_probe(priv->dev, -EPROBE_DEFER,
"Failed to find HDMI transceiver bridge\n");
goto err_put_node;

--
2.52.0