Skip to content

Commit bde8c0e

Browse files
pdp7linusw
authored andcommitted
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: Gustavo A. R. Silva <[email protected]> Signed-off-by: Drew Fustini <[email protected]> Acked-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent ecb55df commit bde8c0e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/gpio/gpio-omap.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,13 +899,18 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
899899
u32 debounce;
900900
int ret = -ENOTSUPP;
901901

902-
if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
903-
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
904-
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN)) {
902+
switch (pinconf_to_config_param(config)) {
903+
case PIN_CONFIG_BIAS_DISABLE:
904+
case PIN_CONFIG_BIAS_PULL_UP:
905+
case PIN_CONFIG_BIAS_PULL_DOWN:
905906
ret = gpiochip_generic_config(chip, offset, config);
906-
} else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
907+
break;
908+
case PIN_CONFIG_INPUT_DEBOUNCE:
907909
debounce = pinconf_to_config_argument(config);
908910
ret = omap_gpio_debounce(chip, offset, debounce);
911+
break;
912+
default:
913+
break;
909914
}
910915

911916
return ret;

0 commit comments

Comments
 (0)