Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
e6a2f0ea 081aaf2d

+4 -5
+4 -5
drivers/leds/leds-gpio.c
··· 217 217 const struct gpio_led *template) 218 218 { 219 219 struct gpio_desc *gpiod; 220 - unsigned long flags = GPIOF_OUT_INIT_LOW; 221 220 int ret; 222 221 223 222 /* ··· 243 244 if (!gpio_is_valid(template->gpio)) 244 245 return ERR_PTR(-ENOENT); 245 246 246 - if (template->active_low) 247 - flags |= GPIOF_ACTIVE_LOW; 248 - 249 - ret = devm_gpio_request_one(dev, template->gpio, flags, 247 + ret = devm_gpio_request_one(dev, template->gpio, GPIOF_OUT_INIT_LOW, 250 248 template->name); 251 249 if (ret < 0) 252 250 return ERR_PTR(ret); ··· 251 255 gpiod = gpio_to_desc(template->gpio); 252 256 if (!gpiod) 253 257 return ERR_PTR(-EINVAL); 258 + 259 + if (template->active_low ^ gpiod_is_active_low(gpiod)) 260 + gpiod_toggle_active_low(gpiod); 254 261 255 262 return gpiod; 256 263 }