Commit bde8c0e6 authored by Drew Fustini's avatar Drew Fustini Committed by Linus Walleij

gpio: omap: improve coding style for pin config flags

Change the handling of pin config flags from if/else to switch
statement to make the code more readable and cleaner.
Suggested-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarDrew Fustini <drew@beagleboard.org>
Acked-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200722120755.230741-1-drew@beagleboard.orgSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ecb55df8
......@@ -899,13 +899,18 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
u32 debounce;
int ret = -ENOTSUPP;
if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN)) {
switch (pinconf_to_config_param(config)) {
case PIN_CONFIG_BIAS_DISABLE:
case PIN_CONFIG_BIAS_PULL_UP:
case PIN_CONFIG_BIAS_PULL_DOWN:
ret = gpiochip_generic_config(chip, offset, config);
} else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
break;
case PIN_CONFIG_INPUT_DEBOUNCE:
debounce = pinconf_to_config_argument(config);
ret = omap_gpio_debounce(chip, offset, debounce);
break;
default:
break;
}
return ret;
......
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