The commit c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our
DSI device at probe") was intended to prevent probe ordering issues and
created the ti_sn_attach_host function.In practice, I found the following when using the nwl-dsi driver: - ti_sn_bridge_probe happens and it adds the i2c bridge. Then ti_sn_attach_host runs (in the ti_sn_bridge_probe function) and fails to find the dsi host which then returns to ti_sn_bridge_probe and removes the i2c bridge because of the failure. - The nwl_dsi_probe then runs and adds dsi host to the host list and then looks for the i2c bridge, which is now gone, so it fails. This loop continues for the entire boot sequence. Looking at the other drivers (like simple-bridge.c) they end the probe function after attaching the bridge with no option to remove the bridge in the probe. Moving the ti_sn_attach_host to the ti_sn_bridge_attach function follows the format of other drivers and ensures the i2c bridge won't be removed while probing is still occurring fixing the dependency loop. Signed-off-by: John Ripple <[email protected]> --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 75f9be347b41..58dfb0f39cea 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -815,6 +815,7 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, { struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); int ret; + struct auxiliary_device *adev = pdata->bridge_aux; pdata->aux.drm_dev = bridge->dev; ret = drm_dp_aux_register(&pdata->aux); @@ -823,6 +824,12 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, return ret; } + ret = ti_sn_attach_host(adev, pdata); + if (ret) { + dev_err_probe(&adev->dev, ret, "failed to attach dsi host\n"); + goto err_remove_bridge; + } + /* * Attach the next bridge. * We never want the next bridge to *also* create a connector. @@ -849,6 +856,9 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_initted_aux: drm_dp_aux_unregister(&pdata->aux); return ret; +err_remove_bridge: + drm_bridge_remove(&pdata->bridge); + return ret; } static void ti_sn_bridge_detach(struct drm_bridge *bridge) @@ -1574,17 +1584,7 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev, drm_bridge_add(&pdata->bridge); - ret = ti_sn_attach_host(adev, pdata); - if (ret) { - dev_err_probe(&adev->dev, ret, "failed to attach dsi host\n"); - goto err_remove_bridge; - } - return 0; - -err_remove_bridge: - drm_bridge_remove(&pdata->bridge); - return ret; } static void ti_sn_bridge_remove(struct auxiliary_device *adev)
