summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-tegra.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-07-20 19:00:56 +0300
committerLinus Walleij <linus.walleij@linaro.org>2017-08-14 16:01:13 +0300
commit564209037dfe09b91a9110e80bd4bcdbccfcceed (patch)
tree98a4243442421fadaebd1c494c7bebfd9d7e91e3 /drivers/gpio/gpio-tegra.c
parent7eb6ce2f272336ff8337f40fa8668fa04dc2d684 (diff)
downloadlinux-564209037dfe09b91a9110e80bd4bcdbccfcceed.tar.xz
gpio: tegra: Use platform_irq_count()
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>
Diffstat (limited to 'drivers/gpio/gpio-tegra.c')
-rw-r--r--drivers/gpio/gpio-tegra.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 1e72c52fbf35..b8de130d2ecd 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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;