[PATCH v2 4/4] drm/msm: stop using device's match data pointer

Stephen Boyd swboyd at chromium.org
Thu Mar 3 23:04:31 UTC 2022


Quoting Dmitry Baryshkov (2022-01-19 14:40:05)
> diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
> index 759076357e0e..f83dca99f03d 100644
> --- a/drivers/gpu/drm/msm/msm_mdss.c
> +++ b/drivers/gpu/drm/msm/msm_mdss.c
> @@ -314,11 +314,11 @@ static const struct dev_pm_ops mdss_pm_ops = {
>         .complete = msm_pm_complete,
>  };
>
> -static int get_mdp_ver(struct platform_device *pdev)
> +static bool get_is_mdp5(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>
> -       return (int) (unsigned long) of_device_get_match_data(dev);
> +       return (bool) (unsigned long) of_device_get_match_data(dev);
>  }
>
>  static int find_mdp_node(struct device *dev, void *data)
> @@ -331,21 +331,18 @@ static int mdss_probe(struct platform_device *pdev)
>  {
>         struct msm_mdss *mdss;
>         struct msm_drm_private *priv;
> -       int mdp_ver = get_mdp_ver(pdev);
> +       bool is_mdp5 = get_is_mdp5(pdev);

	is_mdp5 = of_device_is_compatible(pdev->dev.of_node, "qcom,mdss");

>         struct device *mdp_dev;
>         struct device *dev = &pdev->dev;
>         int ret;
>
> -       if (mdp_ver != KMS_MDP5 && mdp_ver != KMS_DPU)
> -               return -EINVAL;
> -
>         priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>         if (!priv)
>                 return -ENOMEM;
>
>         platform_set_drvdata(pdev, priv);
>
> -       mdss = msm_mdss_init(pdev, mdp_ver == KMS_MDP5);
> +       mdss = msm_mdss_init(pdev, is_mdp5);
>         if (IS_ERR(mdss)) {
>                 ret = PTR_ERR(mdss);
>                 platform_set_drvdata(pdev, NULL);
> @@ -409,12 +406,12 @@ static int mdss_remove(struct platform_device *pdev)
>  }
>
>  static const struct of_device_id mdss_dt_match[] = {
> -       { .compatible = "qcom,mdss", .data = (void *)KMS_MDP5 },
> -       { .compatible = "qcom,sdm845-mdss", .data = (void *)KMS_DPU },
> -       { .compatible = "qcom,sc7180-mdss", .data = (void *)KMS_DPU },
> -       { .compatible = "qcom,sc7280-mdss", .data = (void *)KMS_DPU },
> -       { .compatible = "qcom,sm8150-mdss", .data = (void *)KMS_DPU },
> -       { .compatible = "qcom,sm8250-mdss", .data = (void *)KMS_DPU },
> +       { .compatible = "qcom,mdss", .data = (void *)true },
> +       { .compatible = "qcom,sdm845-mdss", .data = (void *)false },
> +       { .compatible = "qcom,sc7180-mdss", .data = (void *)false },
> +       { .compatible = "qcom,sc7280-mdss", .data = (void *)false },
> +       { .compatible = "qcom,sm8150-mdss", .data = (void *)false },
> +       { .compatible = "qcom,sm8250-mdss", .data = (void *)false },

And then no data needed?


More information about the dri-devel mailing list