diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2024-11-04 11:34:21 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-11-09 14:55:33 +0100 |
commit | e6a2f0ea519fd2478920d02ce3de07a14fe36b2f (patch) | |
tree | 64a2dca8a35ed340ccad2e07c097cda77ed9a49c | |
parent | 081aaf2dfcfa10fa5cb5444b77b154cce4355708 (diff) | |
download | lwn-e6a2f0ea519fd2478920d02ce3de07a14fe36b2f.tar.gz lwn-e6a2f0ea519fd2478920d02ce3de07a14fe36b2f.zip |
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>
-rw-r--r-- | drivers/leds/leds-gpio.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 4d1612d557c8..cf5038cde5b8 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -217,7 +217,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; /* @@ -244,10 +243,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); @@ -256,6 +252,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; } |