]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 4 Nov 2024 09:34:20 +0000 (11:34 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Sat, 9 Nov 2024 13:55:33 +0000 (14:55 +0100)
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-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/input/keyboard/gpio_keys_polled.c

index 41ca0d3c9098562b7de9735fef775dea95d6cc7a..e6707d72210e3c9b78180b5f20e10234511cf859 100644 (file)
@@ -306,13 +306,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
                         * Legacy GPIO number so request the GPIO here and
                         * convert it to descriptor.
                         */
-                       unsigned flags = GPIOF_IN;
-
-                       if (button->active_low)
-                               flags |= GPIOF_ACTIVE_LOW;
-
-                       error = devm_gpio_request_one(dev, button->gpio,
-                                       flags, button->desc ? : DRV_NAME);
+                       error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN,
+                                                     button->desc ? : DRV_NAME);
                        if (error)
                                return dev_err_probe(dev, error,
                                                     "unable to claim gpio %u\n",
@@ -325,6 +320,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
                                        button->gpio);
                                return -EINVAL;
                        }
+
+                       if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
+                               gpiod_toggle_active_low(bdata->gpiod);
                }
 
                bdata->last_state = -1;