In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Signed-off-by: Maxime Ripard <max...@cerno.tech>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 4adeb2bad03a..d0317651cd75 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1367,12 +1367,6 @@ static int anx7625_bridge_attach(struct drm_bridge 
*bridge,
                return -ENODEV;
        }
 
-       err = anx7625_attach_dsi(ctx);
-       if (err) {
-               DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err);
-               return err;
-       }
-
        if (ctx->pdata.panel_bridge) {
                err = drm_bridge_attach(bridge->encoder,
                                        ctx->pdata.panel_bridge,
@@ -1845,10 +1839,24 @@ static int anx7625_i2c_probe(struct i2c_client *client,
        platform->bridge.type = DRM_MODE_CONNECTOR_eDP;
        drm_bridge_add(&platform->bridge);
 
+       ret = anx7625_attach_dsi(platform);
+       if (ret) {
+               DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", ret);
+               goto unregister_bridge;
+       }
+
        DRM_DEV_DEBUG_DRIVER(dev, "probe done\n");
 
        return 0;
 
+unregister_bridge:
+       drm_bridge_remove(&platform->bridge);
+
+       if (!platform->pdata.low_power_mode)
+               pm_runtime_put_sync_suspend(&client->dev);
+
+       anx7625_unregister_i2c_dummy_clients(platform);
+
 free_wq:
        if (platform->workqueue)
                destroy_workqueue(platform->workqueue);
-- 
2.31.1

Reply via email to