mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
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>
This commit is contained in:
parent
aca4d2218c
commit
a04abf25fb
1 changed files with 4 additions and 6 deletions
|
@ -531,12 +531,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||||
* Legacy GPIO number, so request the GPIO here and
|
* Legacy GPIO number, so request the GPIO here and
|
||||||
* convert it to descriptor.
|
* convert it to descriptor.
|
||||||
*/
|
*/
|
||||||
unsigned flags = GPIOF_IN;
|
error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN, desc);
|
||||||
|
|
||||||
if (button->active_low)
|
|
||||||
flags |= GPIOF_ACTIVE_LOW;
|
|
||||||
|
|
||||||
error = devm_gpio_request_one(dev, button->gpio, flags, desc);
|
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
dev_err(dev, "Failed to request GPIO %d, error %d\n",
|
dev_err(dev, "Failed to request GPIO %d, error %d\n",
|
||||||
button->gpio, error);
|
button->gpio, error);
|
||||||
|
@ -546,6 +541,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||||
bdata->gpiod = gpio_to_desc(button->gpio);
|
bdata->gpiod = gpio_to_desc(button->gpio);
|
||||||
if (!bdata->gpiod)
|
if (!bdata->gpiod)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
|
||||||
|
gpiod_toggle_active_low(bdata->gpiod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdata->gpiod) {
|
if (bdata->gpiod) {
|
||||||
|
|
Loading…
Reference in a new issue