lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <220612cc-8f76-cb7a-a98f-0464b7728e83@ti.com>
Date:   Wed, 19 Aug 2020 14:29:29 +0300
From:   Grygorii Strashko <grygorii.strashko@...com>
To:     Drew Fustini <drew@...gleboard.org>,
        Tony Lindgren <tony@...mide.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Santosh Shilimkar <ssantosh@...nel.org>,
        Kevin Hilman <khilman@...nel.org>,
        <linux-omap@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: Re: [PATCH] gpio: omap: improve coding style for pin config flags



On 22/07/2020 15:07, Drew Fustini wrote:
> 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 <gustavo@...eddedor.com>
> Signed-off-by: Drew Fustini <drew@...gleboard.org>
> ---
>   drivers/gpio/gpio-omap.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index e0eada82178c..7fbe0c9e1fc1 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -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;
> 

Thank you.
Acked-by: Grygorii Strashko <grygorii.strashko@...com>

-- 
Best regards,
grygorii

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ