Skip to content

Commit cfdca14

Browse files
MrVanbrgl
authored andcommitted
gpio: bcm-kona: use platform_irq_count
platform_irq_count() is the more generic way (independent of device trees) to determine the count of available interrupts. So use this instead. As platform_irq_count() might return an error code (which of_irq_count doesn't) some additional handling is necessary. Signed-off-by: Peng Fan <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 0c21639 commit cfdca14

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/gpio/gpio-bcm-kona.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/io.h>
2020
#include <linux/gpio/driver.h>
2121
#include <linux/of_device.h>
22-
#include <linux/of_irq.h>
2322
#include <linux/init.h>
2423
#include <linux/irqdomain.h>
2524
#include <linux/irqchip/chained_irq.h>
@@ -586,11 +585,18 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
586585

587586
kona_gpio->gpio_chip = template_chip;
588587
chip = &kona_gpio->gpio_chip;
589-
kona_gpio->num_bank = of_irq_count(dev->of_node);
590-
if (kona_gpio->num_bank == 0) {
588+
ret = platform_irq_count(pdev);
589+
if (!ret) {
591590
dev_err(dev, "Couldn't determine # GPIO banks\n");
592591
return -ENOENT;
592+
} else if (ret < 0) {
593+
if (ret != -EPROBE_DEFER)
594+
dev_err(dev, "Couldn't determine GPIO banks: (%pe)\n",
595+
ERR_PTR(ret));
596+
return ret;
593597
}
598+
kona_gpio->num_bank = ret;
599+
594600
if (kona_gpio->num_bank > GPIO_MAX_BANK_NUM) {
595601
dev_err(dev, "Too many GPIO banks configured (max=%d)\n",
596602
GPIO_MAX_BANK_NUM);

0 commit comments

Comments
 (0)