diff mbox series

[v1,2/3] gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()

Message ID 20220718220252.16923-2-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/3] gpio: 74xx-mmio: Make use of device properties | expand

Commit Message

Andy Shevchenko July 18, 2022, 10:02 p.m. UTC
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>
---
 drivers/gpio/gpio-74xx-mmio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Linus Walleij July 18, 2022, 10:46 p.m. UTC | #1
On Tue, Jul 19, 2022 at 12:02 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> 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>

Yep this is better.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

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)