diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-07-19 01:02:51 +0300 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-07-19 11:14:37 +0300 |
commit | d3054ba1db6270e14245efa28dbd1cf10207d4f2 (patch) | |
tree | 4647792d7cbe4ca703807ab67e21f20d9a780135 | |
parent | 10fcd2f180bcbfb3392fcc98670baff81c61bcf2 (diff) | |
download | linux-d3054ba1db6270e14245efa28dbd1cf10207d4f2.tar.xz |
gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()
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>
-rw-r--r-- | drivers/gpio/gpio-74xx-mmio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-74xx-mmio.c b/drivers/gpio/gpio-74xx-mmio.c index 5e3c948ddb73..b2cc8a55c257 100644 --- a/drivers/gpio/gpio-74xx-mmio.c +++ b/drivers/gpio/gpio-74xx-mmio.c @@ -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) |