Re: [PATCH 8/8] net: ethernet: ti: davinci_emac: Use platform_get_irq() to get the interrupt
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Date: 2021-12-25 17:18:19
Also in:
linux-omap, lkml
Hi Andy, Thank you for the review. On Sat, Dec 25, 2021 at 4:59 PM Andy Shevchenko [off-list ref] wrote:
On Sat, Dec 25, 2021 at 4:06 AM Lad Prabhakar [off-list ref] wrote:quoted
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.quoted
+ if (dev_of_node(&priv->pdev->dev)) {Why?! What's wrong with using the same approach in all cases?
The earlier code looped the resource from start to end and then requested the resources. So I believed the the IORESOURCE_IRQ was sending the range of interrupts. But now looking at the mach-davinci folder I can confirm its just send an single IRQ resource. So this check can be dropped and same approach can be used for OF and non OF users.
quoted
+ 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.
Right, Ill have a look. Cheers, Prabhakar
quoted
+ 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