]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: wcove: Unify style of to_reg() with to_ireg()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 20 May 2021 10:00:01 +0000 (13:00 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 20 May 2021 10:43:22 +0000 (13:43 +0300)
Use ternary and rename parameter to 'type' in to_reg() to be in
the same style as to_ireg().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpio-wcove.c

index 923a37a3d6d3462e2bcb0303330daaef9919925a..5ce315f64dc577d9f29f91a72d7c4e21771e39b1 100644 (file)
@@ -99,19 +99,14 @@ struct wcove_gpio {
        bool set_irq_mask;
 };
 
-static inline int to_reg(int gpio, enum ctrl_register reg_type)
+static inline int to_reg(int gpio, enum ctrl_register type)
 {
-       unsigned int reg;
+       unsigned int reg = type == CTRL_IN ? GPIO_IN_CTRL_BASE : GPIO_OUT_CTRL_BASE;
 
        if (gpio >= WCOVE_GPIO_NUM)
                return -EOPNOTSUPP;
 
-       if (reg_type == CTRL_IN)
-               reg = GPIO_IN_CTRL_BASE + gpio;
-       else
-               reg = GPIO_OUT_CTRL_BASE + gpio;
-
-       return reg;
+       return reg + gpio;
 }
 
 static inline int to_ireg(int gpio, enum ctrl_register type, unsigned int *mask)