On Wed, 24 Aug 2022 at 04:25, Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx> wrote: > > > > On 6/20/2022 2:30 PM, Dmitry Baryshkov wrote: > > The rest of the code expects that master's device drvdata is the > > struct msm_drm_private instance. Do not override the mdp5's drvdata. > > > > Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > > Is this just for consistency across mdp5/dpu drivers? > > What issue was seen if mdp5's platform data is overwritten? I think there was a crash in mdp5_destroy, but I did not capture the log at the moment. As you can see, the mdp5_destroy() expects to get mdp5_kms pointer from the drvdata. However the msm_drv_probe sets the drvdata to msm_drm_private instance. Boom. > > > --- > > drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 19 +++++++++---------- > > 1 file changed, 9 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > index c668a4b27cc6..daf5b5ca7233 100644 > > --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > > @@ -203,7 +203,7 @@ static int mdp5_set_split_display(struct msm_kms *kms, > > slave_encoder); > > } > > > > -static void mdp5_destroy(struct platform_device *pdev); > > +static void mdp5_destroy(struct mdp5_kms *mdp5_kms); > > > > static void mdp5_kms_destroy(struct msm_kms *kms) > > { > > @@ -223,7 +223,7 @@ static void mdp5_kms_destroy(struct msm_kms *kms) > > } > > > > mdp_kms_destroy(&mdp5_kms->base); > > - mdp5_destroy(mdp5_kms->pdev); > > + mdp5_destroy(mdp5_kms); > > } > > > > #ifdef CONFIG_DEBUG_FS > > @@ -651,9 +651,8 @@ static int mdp5_kms_init(struct drm_device *dev) > > return ret; > > } > > > > -static void mdp5_destroy(struct platform_device *pdev) > > +static void mdp5_destroy(struct mdp5_kms *mdp5_kms) > > { > > - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); > > int i; > > > > if (mdp5_kms->ctlm) > > @@ -667,7 +666,7 @@ static void mdp5_destroy(struct platform_device *pdev) > > kfree(mdp5_kms->intfs[i]); > > > > if (mdp5_kms->rpm_enabled) > > - pm_runtime_disable(&pdev->dev); > > + pm_runtime_disable(&mdp5_kms->pdev->dev); > > > > drm_atomic_private_obj_fini(&mdp5_kms->glob_state); > > drm_modeset_lock_fini(&mdp5_kms->glob_state_lock); > > @@ -816,8 +815,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) > > goto fail; > > } > > > > - platform_set_drvdata(pdev, mdp5_kms); > > - > > spin_lock_init(&mdp5_kms->resource_lock); > > > > mdp5_kms->dev = dev; > > @@ -915,7 +912,7 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) > > return 0; > > fail: > > if (mdp5_kms) > > - mdp5_destroy(pdev); > > + mdp5_destroy(mdp5_kms); > > return ret; > > } > > > > @@ -975,7 +972,8 @@ static int mdp5_dev_remove(struct platform_device *pdev) > > static __maybe_unused int mdp5_runtime_suspend(struct device *dev) > > { > > struct platform_device *pdev = to_platform_device(dev); > > - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); > > + struct msm_drm_private *priv = platform_get_drvdata(pdev); > > + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); > > > > DBG(""); > > > > @@ -985,7 +983,8 @@ static __maybe_unused int mdp5_runtime_suspend(struct device *dev) > > static __maybe_unused int mdp5_runtime_resume(struct device *dev) > > { > > struct platform_device *pdev = to_platform_device(dev); > > - struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev); > > + struct msm_drm_private *priv = platform_get_drvdata(pdev); > > + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); > > > > DBG(""); > > -- With best wishes Dmitry