diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-05-20 13:00:01 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-05-20 13:43:22 +0300 |
commit | 5d9936648285b8ccb6b61257dd2ddd76f9cd719a (patch) | |
tree | d3a9e1f5c31f255e3b422a8890c71285bfc2580b /drivers/gpio | |
parent | f3019092eca09f3d093dbc306bf118daff15bfd2 (diff) |
gpio: wcove: Unify style of to_reg() with to_ireg()
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-wcove.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c index 923a37a3d6d3..5ce315f64dc5 100644 --- a/drivers/gpio/gpio-wcove.c +++ b/drivers/gpio/gpio-wcove.c @@ -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) |