[PATCH 1/2] iommu/arm-smmu: Use platform_irq_count() to get the interrupt count
Lad, Prabhakar
prabhakar.csengg at gmail.com
Thu Dec 23 09:36:56 PST 2021
Hi Robin,
Thank you for the review.
On Thu, Dec 23, 2021 at 2:14 PM Robin Murphy <robin.murphy at arm.com> wrote:
>
> On 2021-12-23 13:00, Lad Prabhakar 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_count().
>
> Nit: platform_irq_count()
>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
> > ---
> > drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > index 4bc75c4ce402..4844cd075644 100644
> > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > @@ -2105,12 +2105,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
> > if (IS_ERR(smmu))
> > return PTR_ERR(smmu);
> >
> > - num_irqs = 0;
> > - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, num_irqs))) {
> > - num_irqs++;
> > - if (num_irqs > smmu->num_global_irqs)
> > - smmu->num_context_irqs++;
> > - }
> > + num_irqs = platform_irq_count(pdev);
> > + if (num_irqs < 0)
> > + return num_irqs;
> > +
> > + if (num_irqs > smmu->num_global_irqs)
> > + smmu->num_context_irqs += (num_irqs - smmu->num_global_irqs);
>
> This seems a bit overcomplicated. I reckon:
>
> smmu->num_context_irqs = num_irqs - smmu->num_global_irqs;
> if (num_irqs <= smmu->num_global_irqs) {
> dev_err(...
>
> should do it.
>
Agreed.
> However, FYI I have some patches refactoring most of the IRQ stuff here
> that I plan to post next cycle (didn't quite have time to get them done
> for 5.17 as I'd hoped...), so unless this needs to go in right now as an
> urgent fix, I'm happy to take care of removing platform_get_resource()
> as part of that if it's easier.
>
Fine by me, let me know if it gets any later than planned I'll send a v2.
Cheers,
Prabhakar
More information about the linux-arm-kernel
mailing list