Commit 5d993664 authored by Andy Shevchenko's avatar Andy Shevchenko

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent f3019092
...@@ -99,19 +99,14 @@ struct wcove_gpio { ...@@ -99,19 +99,14 @@ struct wcove_gpio {
bool set_irq_mask; 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) if (gpio >= WCOVE_GPIO_NUM)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (reg_type == CTRL_IN) return reg + gpio;
reg = GPIO_IN_CTRL_BASE + gpio;
else
reg = GPIO_OUT_CTRL_BASE + gpio;
return reg;
} }
static inline int to_ireg(int gpio, enum ctrl_register type, unsigned int *mask) static inline int to_ireg(int gpio, enum ctrl_register type, unsigned int *mask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment