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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241106095520.GM1807686@google.com>
Date: Wed, 6 Nov 2024 09:55:20 +0000
From: Lee Jones <lee@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Tony Lindgren <tony@...mide.com>, linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
	linux-leds@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-usb@...r.kernel.org, Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>, Pavel Machek <pavel@....cz>,
	Dominik Brodowski <linux@...inikbrodowski.net>,
	Daniel Mack <daniel@...que.org>,
	Haojian Zhuang <haojian.zhuang@...il.com>,
	Robert Jarzmik <robert.jarzmik@...e.fr>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1 3/6] leds: gpio: Avoid using GPIOF_ACTIVE_LOW

On Mon, 04 Nov 2024, Andy Shevchenko wrote:

> Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/leds/leds-gpio.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Acked-by: Lee Jones <lee@...nel.org>

> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 0d59b0bbc002..a3428b22de3a 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -212,7 +212,6 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
>  					    const struct gpio_led *template)
>  {
>  	struct gpio_desc *gpiod;
> -	unsigned long flags = GPIOF_OUT_INIT_LOW;
>  	int ret;
>  
>  	/*
> @@ -239,10 +238,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
>  	if (!gpio_is_valid(template->gpio))
>  		return ERR_PTR(-ENOENT);
>  
> -	if (template->active_low)
> -		flags |= GPIOF_ACTIVE_LOW;
> -
> -	ret = devm_gpio_request_one(dev, template->gpio, flags,
> +	ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
>  				    template->name);
>  	if (ret < 0)
>  		return ERR_PTR(ret);
> @@ -251,6 +247,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
>  	if (!gpiod)
>  		return ERR_PTR(-EINVAL);
>  
> +	if (template->active_low ^ gpiod_is_active_low(gpiod))
> +		gpiod_toggle_active_low(gpiod);
> +
>  	return gpiod;
>  }
>  
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac
> 

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ