Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36b31279 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f8b52dd5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3262,6 +3262,12 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
	if (!chip->can_sleep && chip->get_direction) {
		int dir = chip->get_direction(chip, offset);

		if (dir < 0) {
			chip_err(chip, "%s: cannot get GPIO direction\n",
				 __func__);
			return dir;
		}

		if (dir)
			clear_bit(FLAG_IS_OUT, &desc->flags);
		else