From 49e688b03ebed3f3ddac3cbea58ed7f7ef812117 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 7 Feb 2019 09:46:12 -0800 Subject: [PATCH] gpio: gpio_sch: fix check for interrupt trigger The controller does not support trigger. However, the check for this condition was incorrectly (as GPIO_INT_LEVEL is 0). So fix it. Signed-off-by: Daniel Leung --- drivers/gpio/gpio_sch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio_sch.c b/drivers/gpio/gpio_sch.c index cd1e528f8aba1..2ccdc046288a0 100644 --- a/drivers/gpio/gpio_sch.c +++ b/drivers/gpio/gpio_sch.c @@ -132,9 +132,11 @@ static int gpio_sch_config(struct device *dev, const struct gpio_sch_config *info = dev->config->config_info; /* Do some sanity check first */ - if (flags & (GPIO_INT | GPIO_INT_LEVEL)) { - /* controller does not support level trigger */ - return -EINVAL; + if (flags & GPIO_INT) { + if (!(flags & GPIO_INT_EDGE)) { + /* controller does not support level trigger */ + return -EINVAL; + } } if (access_op == GPIO_ACCESS_BY_PIN) {