Re: [PATCH 13/14] drm/vc4: move to devm_platform_ioremap_resource() usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Jan 29, 2025 at 8:18 AM Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx> wrote:
Hi Anusha

On Tue, 28 Jan 2025 at 22:33, Anusha Srivatsa <asrivats@xxxxxxxxxx> wrote:
>
> Replace platform_get_resource_byname + devm_ioremap_resource
> with just devm_platform_ioremap_resource()
>
> Used Coccinelle to do this change. SmPl patch:
> //rule s/(devm_)platform_get_resource_byname +
> //(devm_)ioremap/devm_platform_ioremap_resource.
> @rule_3@
> identifier res;
> _expression_ ioremap;
> identifier pdev;
> constant mem;
> _expression_ name;
> @@
> -struct resource *res;
> ...
> -res = platform_get_resource_byname(pdev,mem,name);
> <...
> -if (!res) {
> -...
> -}
> ...>
> -ioremap = devm_ioremap(...);
> +ioremap = devm_platform_ioremap_resource_byname(pdev,name);
>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
> Cc: "Maíra Canal" <mcanal@xxxxxxxxxx>
> Signed-off-by: Anusha Srivatsa <asrivats@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 47d9ada98430634cfd8c1e21c2a4d00d501bab7e..e22733f8159aa4b247a915e24a236f620bae932c 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -2951,15 +2951,10 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
>  {
>         struct platform_device *pdev = vc4_hdmi->pdev;
>         struct device *dev = &pdev->dev;
> -       struct resource *res;
>         int ret;
>
> -       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi");
> -       if (!res)
> -               return -ENODEV;
> -
> -       vc4_hdmi->hdmicore_regs = devm_ioremap(dev, res->start,
> -                                              resource_size(res));
> +       vc4_hdmi->hdmicore_regs = devm_platform_ioremap_resource_byname(pdev,
> +                                                                       "hdmi");

Whilst I totally agree with this change, why was only one of the 8
instances of this pattern within this function updated? Is that a
limitation in your script?
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/vc4/vc4_hdmi.c#L2957-L3020


Yes! looks like it is. My script is missing one set of ellipses which makes it apply the rule only to the first appearance of the pattern. Will rectify this. Thanks!!

Anusha
  Dave

>         if (!vc4_hdmi->hdmicore_regs)
>                 return -ENOMEM;
>
>
> --
> 2.47.0
>


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux