[PATCH v2 2/3] i2c: sh_mobile: Use platform_get_irq_optional() to get the interrupt

Andy Shevchenko andy.shevchenko at gmail.com
Sat Dec 25 09:48:46 PST 2021


On Wed, Dec 22, 2021 at 2:41 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj at bp.renesas.com> wrote:
>
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
>
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq_optional() for DT users only.

...

> +       if (np) {

Same comments as per your other patches, i.e.
Why is this check here?

> +               int irq;
> +
> +               while ((irq = platform_get_irq_optional(dev, k)) != -ENXIO) {

Consider 0 as no IRQ.

> +                       if (irq < 0)
> +                               return irq;
> +                       ret = devm_request_irq(&dev->dev, irq, sh_mobile_i2c_isr,
> +                                              0, dev_name(&dev->dev), pd);
>                         if (ret) {
> -                               dev_err(&dev->dev, "cannot request IRQ %pa\n", &n);
> +                               dev_err(&dev->dev, "cannot request IRQ %d\n", irq);
>                                 return ret;
>                         }
> +                       k++;
> +               };
> +       } else {
> +               struct resource *res;
> +               resource_size_t n;
> +
> +               while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
> +                       for (n = res->start; n <= res->end; n++) {
> +                               ret = devm_request_irq(&dev->dev, n, sh_mobile_i2c_isr,
> +                                                      0, dev_name(&dev->dev), pd);
> +                               if (ret) {
> +                                       dev_err(&dev->dev, "cannot request IRQ %pa\n", &n);
> +                                       return ret;
> +                               }
> +                       }
> +                       k++;
>                 }
> -               k++;
>         }

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list