[1/2] gpio: tegra: Use platform_irq_count()

Submitted by Thierry Reding on July 20, 2017, 4 p.m.

Details

Message ID 20170720160057.13483-1-thierry.reding@gmail.com
State Accepted
Headers show

Commit Message

Thierry Reding July 20, 2017, 4 p.m.
From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpio/gpio-tegra.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Thierry Reding July 31, 2017, 10:57 a.m.
On Thu, Jul 20, 2017 at 06:00:56PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Use platform_irq_count() instead of open-coding the same code sequence.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpio/gpio-tegra.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)

Ping...

Thierry
Linus Walleij Aug. 2, 2017, 12:02 p.m.
On Thu, Jul 20, 2017 at 6:00 PM, Thierry Reding
<thierry.reding@gmail.com> wrote:

> From: Thierry Reding <treding@nvidia.com>
>
> Use platform_irq_count() instead of open-coding the same code sequence.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

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;