linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: tegra: Use platform_irq_count()
@ 2017-07-20 16:00 Thierry Reding
       [not found] ` <20170720160057.13483-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-08-02 12:02 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Thierry Reding @ 2017-07-20 16:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Jonathan Hunter, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Use platform_irq_count() instead of open-coding the same code sequence.

Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/gpio/gpio-tegra.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 88529d3c06c9..cdbff018a0f4 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -588,13 +588,12 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 	tgi->soc = config;
 	tgi->dev = &pdev->dev;
 
-	for (;;) {
-		res = platform_get_resource(pdev, IORESOURCE_IRQ,
-					    tgi->bank_count);
-		if (!res)
-			break;
-		tgi->bank_count++;
-	}
+	ret = platform_irq_count(pdev);
+	if (ret < 0)
+		return ret;
+
+	tgi->bank_count = ret;
+
 	if (!tgi->bank_count) {
 		dev_err(&pdev->dev, "Missing IRQ resource\n");
 		return -ENODEV;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-02 12:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20 16:00 [PATCH 1/2] gpio: tegra: Use platform_irq_count() Thierry Reding
     [not found] ` <20170720160057.13483-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-20 16:00   ` [PATCH 2/2] gpio: tegra: Use platform_get_irq() Thierry Reding
     [not found]     ` <20170720160057.13483-2-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 12:03       ` Linus Walleij
2017-07-31 10:57   ` [PATCH 1/2] gpio: tegra: Use platform_irq_count() Thierry Reding
2017-08-02 12:02 ` Linus Walleij

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).