[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeCwR-eP930s3miv-ux8=_P+vmdkhN+K=weTL1nwNA1ig@mail.gmail.com>
Date: Sat, 25 Dec 2021 19:32:16 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Cc: Linux Media Mailing List <linux-media@...r.kernel.org>,
"Lad, Prabhakar" <prabhakar.csengg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
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 06/13] media: davinci: vpif: Use platform_get_irq_optional()
to get the interrupt
On Sat, Dec 25, 2021 at 3:04 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 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_optional().
>
> Also this patch propagates error code in case devm_request_irq()
> fails instead of returing -EINVAL.
returning
...
> + res_irq->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
> + res_irq->start = irq;
> + res_irq->end = irq;
> + res_irq->name = dev_of_node(&pdev->dev) ? of_node_full_name(pdev->dev.of_node) : NULL;
If you convert DEFINE_RES_NAMED() to return a compound literal, then
you may use it here like
res_irq = DEFINE_RES_NAMED(...);
or even do like this
if (dev_of_node(...))
res_irq = DEFINE_RES_IRQ_NAMED(...)
else
res_irq = DEFINE_RES_IRQ(...);
res_irq->flags |= irq_get_trigger_type(irq);
I'm not sure why you can't simply use the NAMED variant in both cases
(yes, I see that of_node_full_name() will return something, not NULL).
...
> + while ((err = platform_get_irq_optional(pdev, res_idx)) != -ENXIO) {
> + if (err < 0)
> + goto vpif_unregister;
Needs a better error checking, i.e. consider 0 as no-IRQ (equivalent
to -ENXIO (note, OF code never returns 0 as valid vIRQ).
> res_idx++;
> }
...
> + while ((err = platform_get_irq_optional(pdev, res_idx)) != -ENXIO) {
> + if (err < 0)
> + goto vpif_unregister;
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists