Re: [Freedreno] [PATCH 3/6] drm/msm/dpu: support binding to the mdp5 devices

2023-09-06 Thread Dmitry Baryshkov
On Thu, 7 Sept 2023 at 01:17, Stephen Boyd  wrote:
>
> Quoting Dmitry Baryshkov (2023-09-05 10:43:50)
> > diff --git a/drivers/gpu/drm/msm/msm_io_utils.c 
> > b/drivers/gpu/drm/msm/msm_io_utils.c
> > index 59d2788c4510..9d0d76f3a319 100644
> > --- a/drivers/gpu/drm/msm/msm_io_utils.c
> > +++ b/drivers/gpu/drm/msm/msm_io_utils.c
> > @@ -50,6 +50,24 @@ struct clk *msm_clk_get(struct platform_device *pdev, 
> > const char *name)
> > return clk;
> >  }
> >
> > +void __iomem *msm_ioremap_mdss(struct platform_device *mdss_pdev,
> > +  struct platform_device *pdev,
> > +  const char *name)
> > +{
> > +   struct resource *res;
> > +   void __iomem *ptr;
> > +
> > +   res = platform_get_resource_byname(mdss_pdev, IORESOURCE_MEM, name);
> > +   if (!res)
> > +   return ERR_PTR(-EINVAL);
> > +
> > +   ptr = devm_ioremap_resource(&pdev->dev, res);
> > +   if (!ptr)
>
> devm_ioremap_resource() returns an error pointer. Too bad we can't use
> devm_platform_ioremap_resource_byname() here.

Unfortunately :-(

>
> > +   return ERR_PTR(-ENOMEM);
> > +
> > +   return ptr;
> > +}



-- 
With best wishes
Dmitry


Re: [Freedreno] [PATCH 3/6] drm/msm/dpu: support binding to the mdp5 devices

2023-09-06 Thread Stephen Boyd
Quoting Dmitry Baryshkov (2023-09-05 10:43:50)
> diff --git a/drivers/gpu/drm/msm/msm_io_utils.c 
> b/drivers/gpu/drm/msm/msm_io_utils.c
> index 59d2788c4510..9d0d76f3a319 100644
> --- a/drivers/gpu/drm/msm/msm_io_utils.c
> +++ b/drivers/gpu/drm/msm/msm_io_utils.c
> @@ -50,6 +50,24 @@ struct clk *msm_clk_get(struct platform_device *pdev, 
> const char *name)
> return clk;
>  }
>
> +void __iomem *msm_ioremap_mdss(struct platform_device *mdss_pdev,
> +  struct platform_device *pdev,
> +  const char *name)
> +{
> +   struct resource *res;
> +   void __iomem *ptr;
> +
> +   res = platform_get_resource_byname(mdss_pdev, IORESOURCE_MEM, name);
> +   if (!res)
> +   return ERR_PTR(-EINVAL);
> +
> +   ptr = devm_ioremap_resource(&pdev->dev, res);
> +   if (!ptr)

devm_ioremap_resource() returns an error pointer. Too bad we can't use
devm_platform_ioremap_resource_byname() here.

> +   return ERR_PTR(-ENOMEM);
> +
> +   return ptr;
> +}