[OpenWrt-Devel] [PATCH 6/8] staging: mt7621-gpio: use ternary operator in return in mediatek_gpio_get_direction

Rosen Penev rosenp at gmail.com
Wed May 30 02:36:37 EDT 2018


From: Sergio Paracuellos <sergio.paracuellos at gmail.com>

This commits replaces if statement and two returns in favour
of a only one return using a ternary operator.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
Reviewed-by: NeilBrown <neil at brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c b/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
index bbe6cce56d..15a1003017 100644
--- a/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
+++ b/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
@@ -135,10 +135,7 @@ mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 	t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
 	spin_unlock_irqrestore(&rg->lock, flags);
 
-	if (t & BIT(offset))
-		return 0;
-
-	return 1;
+	return (t & BIT(offset)) ? 0 : 1;
 }
 
 static int
-- 
2.17.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel



More information about the openwrt-devel mailing list