[v2] gpiolib: Fix logic for driver override

Message ID 20180504132016.25687-1-chris.lesiak@licor.com
State New
Headers show
Series
  • [v2] gpiolib: Fix logic for driver override
Related show

Commit Message

Chris Lesiak May 4, 2018, 1:20 p.m.
Fix incorrect logic in gpiochip_irqchip_add_key().
A driver needs to override both irq_request_resources and
irq_release_resources, otherwise gpiochip_irq_reqres and
gpiochip_irq_relres should be used.

Changed v1 -> v2:
  Correct repeated irq_request_resources in commit message

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index bdd68ff197dc..3e441879fea7 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1831,7 +1831,7 @@  int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
 	 * It is possible for a driver to override this, but only if the
 	 * alternative functions are both implemented.
 	 */
-	if (!irqchip->irq_request_resources &&
+	if (!irqchip->irq_request_resources ||
 	    !irqchip->irq_release_resources) {
 		irqchip->irq_request_resources = gpiochip_irq_reqres;
 		irqchip->irq_release_resources = gpiochip_irq_relres;