Skip to content

Commit

Permalink
gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()
Browse files Browse the repository at this point in the history
It's logically better to check the IN in ->direction_input() and
_OUT in ->direction_output().

While at it, replace ternary with plain if-conditional for the sake
of consistency with mmio_74xx_dir_out().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
  • Loading branch information
Andy Shevchenko authored and Bartosz Golaszewski committed Jul 19, 2022
1 parent 10fcd2f commit d3054ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpio/gpio-74xx-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ static int mmio_74xx_dir_in(struct gpio_chip *gc, unsigned int gpio)
{
struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc);

return (priv->flags & MMIO_74XX_DIR_OUT) ? -ENOTSUPP : 0;
if (priv->flags & MMIO_74XX_DIR_IN)
return 0;

return -ENOTSUPP;
}

static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
Expand Down

0 comments on commit d3054ba

Please sign in to comment.