On some of i.MX SoCs like i.MX8QXP, there is ONLY one IRQ for each
GPIO bank, so it is better to check the IRQ count before getting
second IRQ to avoid below error message during probe:
[ 1.070908] gpio-mxc
5d080000.gpio: IRQ index 1 not found
[ 1.077420] gpio-mxc
5d090000.gpio: IRQ index 1 not found
[ 1.083766] gpio-mxc
5d0a0000.gpio: IRQ index 1 not found
[ 1.090122] gpio-mxc
5d0b0000.gpio: IRQ index 1 not found
[ 1.096470] gpio-mxc
5d0c0000.gpio: IRQ index 1 not found
[ 1.102804] gpio-mxc
5d0d0000.gpio: IRQ index 1 not found
[ 1.109144] gpio-mxc
5d0e0000.gpio: IRQ index 1 not found
[ 1.115475] gpio-mxc
5d0f0000.gpio: IRQ index 1 not found
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
{
struct device_node *np = pdev->dev.of_node;
struct mxc_gpio_port *port;
+ int irq_count;
int irq_base;
int err;
if (IS_ERR(port->base))
return PTR_ERR(port->base);
- port->irq_high = platform_get_irq(pdev, 1);
- if (port->irq_high < 0)
- port->irq_high = 0;
+ irq_count = platform_irq_count(pdev);
+ if (irq_count < 0)
+ return irq_count;
+
+ if (irq_count > 1) {
+ port->irq_high = platform_get_irq(pdev, 1);
+ if (port->irq_high < 0)
+ port->irq_high = 0;
+ }
port->irq = platform_get_irq(pdev, 0);
if (port->irq < 0)