]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: mt7621-gpio: use ternary operator in return in mediatek_gpio_get_direction
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Sun, 20 May 2018 13:00:25 +0000 (15:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 16:49:32 +0000 (18:49 +0200)
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@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-gpio/gpio-mt7621.c

index bbe6cce56d9098f9e616e552e0d9e0bec25932dc..15a1003017f8f406c3e5b212e52be3c384e05d47 100644 (file)
@@ -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