OSDN Git Service

gpio: tegra: Use platform_irq_count()
authorThierry Reding <treding@nvidia.com>
Thu, 20 Jul 2017 16:00:56 +0000 (18:00 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 14 Aug 2017 13:01:13 +0000 (15:01 +0200)
Use platform_irq_count() instead of open-coding the same code sequence.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-tegra.c

index 1e72c52..b8de130 100644 (file)
@@ -589,13 +589,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;