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 <[email protected]>
---
 drivers/gpu/drm/bridge/ite-it66121.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c 
b/drivers/gpu/drm/bridge/ite-it66121.c
index 0185f61e6e59..9246e9c15a6e 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -298,7 +298,6 @@ struct it66121_chip_info {
 struct it66121_ctx {
        struct regmap *regmap;
        struct drm_bridge bridge;
-       struct drm_bridge *next_bridge;
        struct drm_connector *connector;
        struct device *dev;
        struct gpio_desc *gpio_reset;
@@ -596,7 +595,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
        if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
                return -EINVAL;
 
-       ret = drm_bridge_attach(encoder, ctx->next_bridge, bridge, flags);
+       ret = drm_bridge_attach(encoder, ctx->bridge.next_bridge, bridge, 
flags);
        if (ret)
                return ret;
 
@@ -1543,9 +1542,9 @@ static int it66121_probe(struct i2c_client *client)
                return -EINVAL;
        }
 
-       ctx->next_bridge = of_drm_find_bridge(ep);
+       ctx->bridge.next_bridge = of_drm_find_and_get_bridge(ep);
        of_node_put(ep);
-       if (!ctx->next_bridge) {
+       if (!ctx->bridge.next_bridge) {
                dev_dbg(ctx->dev, "Next bridge not found, deferring probe\n");
                return -EPROBE_DEFER;
        }

-- 
2.52.0

Reply via email to