Re: [PATCH 8/8] net: ethernet: ti: davinci_emac: Use platform_get_irq() to get the interrupt

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

 



On Sat, Dec 25, 2021 at 4:06 AM Lad Prabhakar
<prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> 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() for DT users only.
>
> While at it propagate error code in case request_irq() fails instead of
> returning -EBUSY.


> +       if (dev_of_node(&priv->pdev->dev)) {

Why?! What's wrong with using the same approach in all cases?

> +               while ((ret = platform_get_irq_optional(priv->pdev, res_num)) != -ENXIO) {

This is wrong.

You need to check better as I pointed several times against your patches.

> +                       if (ret < 0)
> +                               goto rollback;
>
> +                       ret = request_irq(ret, emac_irq, 0, ndev->name, ndev);
> +                       if (ret) {
> +                               dev_err(emac_dev, "DaVinci EMAC: request_irq() failed\n");
>                                 goto rollback;
>                         }
> +                       res_num++;
>                 }
> -               res_num++;
> +       } else {
> +               while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, res_num))) {
> +                       for (irq_num = res->start; irq_num <= res->end; irq_num++) {
> +                               ret = request_irq(irq_num, emac_irq, 0, ndev->name, ndev);
> +                               if (ret) {
> +                                       dev_err(emac_dev, "DaVinci EMAC: request_irq() failed\n");
> +                                       goto rollback;
> +                               }
> +                       }
> +                       res_num++;
> +               }
> +               /* prepare counters for rollback in case of an error */
> +               res_num--;
> +               irq_num--;
>         }

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux