lkml.org 
[lkml]   [2021]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 8/8] net: ethernet: ti: davinci_emac: Use platform_get_irq() to get the interrupt
On Sat, Dec 25, 2021 at 4:06 AM Lad Prabhakar
<prabhakar.mahadev-lad.rj@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() 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

\
 
 \ /
  Last update: 2021-12-25 18:00    [W:0.103 / U:2.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site