summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2016-09-07 10:12:11 +0200
committerLinus Walleij <linus.walleij@linaro.org>2016-09-12 11:05:03 +0200
commit332e99d5ae4056523bcb24ab16cd7a41474c4807 (patch)
tree95c9739de010ba9960924b50a0b4dbb1fffb8f4e /drivers/gpio
parentgpio: rcar: Add r8a7796 (R-Car M3-W) support (diff)
downloadlinux-332e99d5ae4056523bcb24ab16cd7a41474c4807.tar.xz
linux-332e99d5ae4056523bcb24ab16cd7a41474c4807.zip
gpio/gpiolib: Forbid irqchip default trigger if probed over DT
Using a default trigger is a bad idea if using DT to configure interrupts, as the device's interrupt specifier will always contain the trigger configuration. Let's warn about that particular situation, and revert to not having a default. Hopefully, the couple of drivers still using this feature will quickly be fixed. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index deaf4d4dc68e..e183ee2f5f65 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1613,6 +1613,15 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
if (gpiochip->of_node)
of_node = gpiochip->of_node;
#endif
+ /*
+ * Specifying a default trigger is a terrible idea if DT is
+ * used to configure the interrupts, as you may end-up with
+ * conflicting triggers. Tell the user, and reset to NONE.
+ */
+ if (WARN(of_node && type != IRQ_TYPE_NONE,
+ "%s: Ignoring %d default trigger\n", of_node->full_name, type))
+ type = IRQ_TYPE_NONE;
+
gpiochip->irqchip = irqchip;
gpiochip->irq_handler = handler;
gpiochip->irq_default_type = type;