2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-12 23:54:19 +08:00

gpiolib: Respect error code of ->get_direction()

In case we try to lock GPIO pin as IRQ when something going wrong
we print a misleading message.

Correct this by checking an error code from ->get_direction() in
gpiochip_lock_as_irq() and printing a corresponding message.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Andy Shevchenko 2018-07-03 03:38:31 +03:00 committed by Linus Walleij
parent f8b52dd50c
commit 36b312792b

View File

@ -3262,6 +3262,12 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
if (!chip->can_sleep && chip->get_direction) { if (!chip->can_sleep && chip->get_direction) {
int dir = chip->get_direction(chip, offset); int dir = chip->get_direction(chip, offset);
if (dir < 0) {
chip_err(chip, "%s: cannot get GPIO direction\n",
__func__);
return dir;
}
if (dir) if (dir)
clear_bit(FLAG_IS_OUT, &desc->flags); clear_bit(FLAG_IS_OUT, &desc->flags);
else else