linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Chris Brandt <chris.brandt@renesas.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	linux-rpi-kernel <linux-rpi-kernel@lists.infradead.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Prabhakarprabhakar.csengg@gmail.com
Subject: Re: [PATCH v2 2/3] i2c: sh_mobile: Use platform_get_irq_optional() to get the interrupt
Date: Sat, 25 Dec 2021 19:48:46 +0200	[thread overview]
Message-ID: <CAHp75VcxCGjPiuQi9w5M3Gv97nj+TQVMdF86TQXi6bxgSTL1mQ@mail.gmail.com> (raw)
In-Reply-To: <20211221175322.7096-3-prabhakar.mahadev-lad.rj@bp.renesas.com>

On Wed, Dec 22, 2021 at 2:41 PM 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_optional() for DT users only.

...

> +       if (np) {

Same comments as per your other patches, i.e.
Why is this check here?

> +               int irq;
> +
> +               while ((irq = platform_get_irq_optional(dev, k)) != -ENXIO) {

Consider 0 as no IRQ.

> +                       if (irq < 0)
> +                               return irq;
> +                       ret = devm_request_irq(&dev->dev, irq, sh_mobile_i2c_isr,
> +                                              0, dev_name(&dev->dev), pd);
>                         if (ret) {
> -                               dev_err(&dev->dev, "cannot request IRQ %pa\n", &n);
> +                               dev_err(&dev->dev, "cannot request IRQ %d\n", irq);
>                                 return ret;
>                         }
> +                       k++;
> +               };
> +       } else {
> +               struct resource *res;
> +               resource_size_t n;
> +
> +               while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
> +                       for (n = res->start; n <= res->end; n++) {
> +                               ret = devm_request_irq(&dev->dev, n, sh_mobile_i2c_isr,
> +                                                      0, dev_name(&dev->dev), pd);
> +                               if (ret) {
> +                                       dev_err(&dev->dev, "cannot request IRQ %pa\n", &n);
> +                                       return ret;
> +                               }
> +                       }
> +                       k++;
>                 }
> -               k++;
>         }

-- 
With Best Regards,
Andy Shevchenko

  parent reply	other threads:[~2021-12-25 17:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 17:53 [PATCH v2 0/3] i2c/busses: Use platform_get_irq/_optional() variants to fetch IRQ's Lad Prabhakar
2021-12-21 17:53 ` [PATCH v2 1/3] i2c: bcm2835: Use platform_get_irq() to get the interrupt Lad Prabhakar
2021-12-21 18:24   ` Florian Fainelli
2022-01-03  9:18   ` Wolfram Sang
2021-12-21 17:53 ` [PATCH v2 2/3] i2c: sh_mobile: Use platform_get_irq_optional() " Lad Prabhakar
2021-12-22  9:20   ` Geert Uytterhoeven
2021-12-22  9:49   ` Wolfram Sang
2021-12-25 17:48   ` Andy Shevchenko [this message]
2021-12-25 23:45     ` Prabhakar Mahadev Lad
2021-12-26  8:40       ` Andy Shevchenko
2021-12-26 10:03         ` Lad, Prabhakar
2022-01-03  9:19   ` Wolfram Sang
2021-12-21 17:53 ` [PATCH v2 3/3] i2c: riic: Use platform_get_irq() " Lad Prabhakar
2021-12-22  9:52   ` Wolfram Sang
2021-12-22 13:00   ` Geert Uytterhoeven
2022-01-03  9:19   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VcxCGjPiuQi9w5M3Gv97nj+TQVMdF86TQXi6bxgSTL1mQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Prabhakarprabhakar.csengg@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=chris.brandt@renesas.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=nsaenz@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).