gpiolib: Add the support for the msi parent domain
authorKevin Hao <haokexin@gmail.com>
Tue, 14 Jan 2020 08:28:20 +0000 (16:28 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 15 Jan 2020 10:18:05 +0000 (11:18 +0100)
If the gpio's parent irqdomain is a msi irqdomain, we should ignore
the EEXIST error returned by the msi irqdomain because all the msi
interrupts have already been allocated.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Link: https://lore.kernel.org/r/20200114082821.14015-4-haokexin@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index e0200dda2aee4f2be80668a3e7b6b797a4b2ddd8..4b94b9e37fdb757b66f3198b89c317e9c79e55de 100644 (file)
@@ -2050,6 +2050,12 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
        chip_info(gc, "alloc_irqs_parent for %d parent hwirq %d\n",
                  irq, parent_hwirq);
        ret = irq_domain_alloc_irqs_parent(d, irq, 1, parent_arg);
+       /*
+        * If the parent irqdomain is msi, the interrupts have already
+        * been allocated, so the EEXIST is good.
+        */
+       if (irq_domain_is_msi(d->parent) && (ret == -EEXIST))
+               ret = 0;
        if (ret)
                chip_err(gc,
                         "failed to allocate parent hwirq %d for hwirq %lu\n",