drm/msm/dsi: Set msm_dsi->encoders before initializing bridge
authorArchit Taneja <architt@codeaurora.org>
Wed, 11 Jan 2017 06:29:56 +0000 (11:59 +0530)
committerRob Clark <robdclark@gmail.com>
Mon, 6 Feb 2017 16:28:43 +0000 (11:28 -0500)
The commit "drm: bridge: Link encoder and bridge in core code" updated
the drm_bridge_attach() API to also include the drm_encoder pointer
the bridge attaches to.

The func msm_dsi_manager_bridge_init() now relies on the drm_encoder
pointer stored in msm_dsi->encoders to pass the encoder to the bridge
API.

msm_dsi->encoders is unfortunately set after this function is called,
resulting in us passing a NULL pointer to drm_brigde_attach. This
results in an error and the DSI driver probe fails.

Move the initialization of msm_dsi->encoders[] a bit up. Also, don't
try to set the encoder's bridge. That's now managed by the bridge
API.

Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/dsi/dsi.c

index ec572f8389edb86dea1850984c84260e53c17a29..9593238ccc1b52917aee7c97d0784362a81941ff 100644 (file)
@@ -205,6 +205,9 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
                goto fail;
        }
 
+       for (i = 0; i < MSM_DSI_ENCODER_NUM; i++)
+               msm_dsi->encoders[i] = encoders[i];
+
        msm_dsi->bridge = msm_dsi_manager_bridge_init(msm_dsi->id);
        if (IS_ERR(msm_dsi->bridge)) {
                ret = PTR_ERR(msm_dsi->bridge);
@@ -213,11 +216,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
                goto fail;
        }
 
-       for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
-               encoders[i]->bridge = msm_dsi->bridge;
-               msm_dsi->encoders[i] = encoders[i];
-       }
-
        /*
         * check if the dsi encoder output is connected to a panel or an
         * external bridge. We create a connector only if we're connected to a