]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
gpio: don't override irq_*_resources() callbacks
authorRabin Vincent <rabin@rab.in>
Fri, 31 Jul 2015 12:48:56 +0000 (14:48 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 3 Aug 2015 08:52:02 +0000 (10:52 +0200)
If the driver has specified its own irq_{request/release}_resources()
functions, don't override them.  The gpio-etraxfs driver will use this.

Signed-off-by: Rabin Vincent <rabin@rab.in>
[Added a small comment blurb]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index 1b5b8da71154a9eabca7affb4612f6d07a4ba476..34f95fbc884a5197c60c571a2e6518f9e42558d6 100644 (file)
@@ -641,8 +641,16 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
                gpiochip->irqchip = NULL;
                return -EINVAL;
        }
-       irqchip->irq_request_resources = gpiochip_irq_reqres;
-       irqchip->irq_release_resources = gpiochip_irq_relres;
+
+       /*
+        * It is possible for a driver to override this, but only if the
+        * alternative functions are both implemented.
+        */
+       if (!irqchip->irq_request_resources &&
+           !irqchip->irq_release_resources) {
+               irqchip->irq_request_resources = gpiochip_irq_reqres;
+               irqchip->irq_release_resources = gpiochip_irq_relres;
+       }
 
        /*
         * Prepare the mapping since the irqchip shall be orthogonal to