summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorRabin Vincent <rabin@rab.in>2015-07-31 14:48:56 +0200
committerLinus Walleij <linus.walleij@linaro.org>2015-08-03 10:52:02 +0200
commit8b67a1f0ad1f260f1a4032d5f7b032ac113bfa7d (patch)
treed30b035ee0e8b8577c1c918ffc2fa39acf7c8955 /drivers/gpio/gpiolib.c
parentgpio: mpc8xxx: Convert mpc8xxx_gpio_chip.lock to raw_spinlock (diff)
downloadlinux-8b67a1f0ad1f260f1a4032d5f7b032ac113bfa7d.tar.xz
linux-8b67a1f0ad1f260f1a4032d5f7b032ac113bfa7d.zip
gpio: don't override irq_*_resources() callbacks
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>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 1b5b8da71154..34f95fbc884a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -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