linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: Samuel Holland <samuel.holland@sifive.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Emil Renner Berthing <emil.renner.berthing@canonical.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 2/4] gpio: sifive: Look up IRQs only once during probe
Date: Wed, 19 Jul 2023 19:48:02 +0300	[thread overview]
Message-ID: <ZLgTwiTzykDhCd5w@smile.fi.intel.com> (raw)
In-Reply-To: <20230719163446.1398961-3-samuel.holland@sifive.com>

On Wed, Jul 19, 2023 at 09:34:43AM -0700, Samuel Holland wrote:
> of_irq_count(), or eqivalently platform_irq_count(), simply looks up
> successively-numbered IRQs until that fails. Since this driver needs to
> look up each IRQ anyway to get its virq number, use that existing loop
> to count the IRQs at the same time.

...

> -	ngpio = of_irq_count(node);
> -	if (ngpio > SIFIVE_GPIO_MAX) {
> -		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
> -			SIFIVE_GPIO_MAX);
> -		return -ENXIO;

Do we still need this check?

> -	}

...

> +	for (ngpio = 0; ngpio < SIFIVE_GPIO_MAX; ngpio++) {
> +		ret = platform_get_irq_optional(pdev, ngpio);
>  		if (ret < 0)
> -			return ret;
> -		chip->irq_number[i] = ret;
> +			break;
> +		chip->irq_number[ngpio] = ret;
>  	}

If so, here we need something like

	ret = platform_get_irq_optional(pdev, ngpio);
	if (ret > 0) {
		dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
			SIFIVE_GPIO_MAX);
		return -ENXIO;
	}

Otherwise you need to mention this relaxation in the commit message.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-07-19 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 16:34 [PATCH v2 0/4] gpio: sifive: Module support Samuel Holland
2023-07-19 16:34 ` [PATCH v2 1/4] gpio: sifive: Directly use the device's fwnode Samuel Holland
2023-07-19 16:44   ` Andy Shevchenko
2023-07-19 16:34 ` [PATCH v2 2/4] gpio: sifive: Look up IRQs only once during probe Samuel Holland
2023-07-19 16:48   ` Andy Shevchenko [this message]
2023-07-19 16:55     ` Samuel Holland
2023-07-19 16:34 ` [PATCH v2 3/4] gpio: sifive: Get the parent IRQ's domain from its irq_data Samuel Holland
2023-07-19 16:54   ` Andy Shevchenko
2023-07-19 17:03     ` Samuel Holland
2023-07-19 17:21       ` Andy Shevchenko
2023-07-19 16:34 ` [PATCH v2 4/4] gpio: sifive: Allow building the driver as a module Samuel Holland
2023-07-19 16:54   ` Andy Shevchenko

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=ZLgTwiTzykDhCd5w@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=emil.renner.berthing@canonical.com \
    --cc=frowand.list@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    --cc=samuel.holland@sifive.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).