[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdX6uC2siQ6+g4RTPk4vvxi4y17WCdU6GhQf6j5fuo34nw@mail.gmail.com>
Date: Thu, 16 Dec 2021 15:31:21 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: "Lad, Prabhakar" <prabhakar.csengg@...il.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH] irqchip/renesas-intc-irqpin: Use platform_get_irq_optional()
to get the interrupt
Hi Prabhakar,
On Thu, Dec 16, 2021 at 3:23 PM Lad, Prabhakar
<prabhakar.csengg@...il.com> wrote:
> On Thu, Dec 16, 2021 at 8:45 AM Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> > On Thu, Dec 16, 2021 at 12:45 AM Lad Prabhakar
> > <prabhakar.mahadev-lad.rj@...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 bypassed the hierarchical setup and messed up the
> > > irq chaining.
> > >
> > > In preparation for removal of static setup of IRQ resource from DT core
> > > code use platform_get_irq_optional().
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> >
> > > --- a/drivers/irqchip/irq-renesas-intc-irqpin.c
> > > +++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
> >
> > > @@ -418,12 +417,14 @@ static int intc_irqpin_probe(struct platform_device *pdev)
> > >
> > > /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */
> > > for (k = 0; k < INTC_IRQPIN_MAX; k++) {
> > > - irq = platform_get_resource(pdev, IORESOURCE_IRQ, k);
> > > - if (!irq)
> > > + ret = platform_get_irq_optional(pdev, k);
> > > + if (ret == -EPROBE_DEFER)
> > > + goto err0;
> > > + if (ret < 0)
> > > break;
> >
> > Shouldn't all errors be considered fatal, except for -ENXIO (no
> > interrupt)?
> >
> Initial behavior of this driver was even if one
> platform_get_resource() succeeded the probe continued further, this is
Indeed, the loop obtained all interrupts present, until no more are to found.
In the old logic, it would return a NULL resource for the first
non-existing one.
In the new logic, it would return -ENXIO.
Hence you need to check for -ENXIO in the loop, to distinguish "no more
interrupts" from actual errors.
> the same behavior which I wanted to keep with this code while using
> platform_get_irq_optional(). But as you pointed out I'll change it to below:
>
> + ret = platform_get_irq(pdev, k);
> + if (ret < 0)
> + goto err0;
>
> We bail out any error case and will also drop the check for (nirqs < 1).
I think that check should stay: there should be at least one interrupt.
> > > p->irq[k].p = p;
> > > - p->irq[k].requested_irq = irq->start;
> > > + p->irq[k].requested_irq = ret;
> > > }
> > >
> > > nirqs = k;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists