gpio: tegra: fix unbalanced chained_irq_enter/exit
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Tue, 18 Jul 2017 12:35:45 +0000 (14:35 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 2 Aug 2017 08:42:38 +0000 (10:42 +0200)
When more than one GPIO IRQs are triggered simultaneously,
tegra_gpio_irq_handler() called chained_irq_exit() multiple
times for one chained_irq_enter().

Fixes: 3c92db9ac0ca3eee8e46e2424b6c074e2e394ad9
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
[Also changed the variable to a bool]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-tegra.c

index 88529d3c06c9af4d6e4a69ea71557939ba0ff48e..506c6a67c5fcb951154faad9c4b73cb7b8c45ac3 100644 (file)
@@ -360,7 +360,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
 {
        int port;
        int pin;
-       int unmasked = 0;
+       bool unmasked = false;
        int gpio;
        u32 lvl;
        unsigned long sta;
@@ -384,8 +384,8 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
                         * before executing the handler so that we don't
                         * miss edges
                         */
-                       if (lvl & (0x100 << pin)) {
-                               unmasked = 1;
+                       if (!unmasked && lvl & (0x100 << pin)) {
+                               unmasked = true;
                                chained_irq_exit(chip, desc);
                        }