Skip to content

Commit e6a2f0e

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
leds: gpio: Avoid using GPIOF_ACTIVE_LOW
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Lee Jones <lee@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20241104093609.156059-4-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 081aaf2 commit e6a2f0e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/leds/leds-gpio.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
217217
const struct gpio_led *template)
218218
{
219219
struct gpio_desc *gpiod;
220-
unsigned long flags = GPIOF_OUT_INIT_LOW;
221220
int ret;
222221

223222
/*
@@ -244,10 +243,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
244243
if (!gpio_is_valid(template->gpio))
245244
return ERR_PTR(-ENOENT);
246245

247-
if (template->active_low)
248-
flags |= GPIOF_ACTIVE_LOW;
249-
250-
ret = devm_gpio_request_one(dev, template->gpio, flags,
246+
ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW,
251247
template->name);
252248
if (ret < 0)
253249
return ERR_PTR(ret);
@@ -256,6 +252,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
256252
if (!gpiod)
257253
return ERR_PTR(-EINVAL);
258254

255+
if (template->active_low ^ gpiod_is_active_low(gpiod))
256+
gpiod_toggle_active_low(gpiod);
257+
259258
return gpiod;
260259
}
261260

0 commit comments

Comments
 (0)