Skip to content

Commit a04abf2

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
Input: gpio_keys - 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: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20241104093609.156059-2-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent aca4d22 commit a04abf2

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/input/keyboard/gpio_keys.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
531531
* Legacy GPIO number, so request the GPIO here and
532532
* convert it to descriptor.
533533
*/
534-
unsigned flags = GPIOF_IN;
535-
536-
if (button->active_low)
537-
flags |= GPIOF_ACTIVE_LOW;
538-
539-
error = devm_gpio_request_one(dev, button->gpio, flags, desc);
534+
error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN, desc);
540535
if (error < 0) {
541536
dev_err(dev, "Failed to request GPIO %d, error %d\n",
542537
button->gpio, error);
@@ -546,6 +541,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
546541
bdata->gpiod = gpio_to_desc(button->gpio);
547542
if (!bdata->gpiod)
548543
return -EINVAL;
544+
545+
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
546+
gpiod_toggle_active_low(bdata->gpiod);
549547
}
550548

551549
if (bdata->gpiod) {

0 commit comments

Comments
 (0)