Skip to content

Commit 081aaf2

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW
Avoid using GPIOF_ACTIVE_LOW as it's deprecated and subject to remove. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent a04abf2 commit 081aaf2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/input/keyboard/gpio_keys_polled.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,8 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
306306
* Legacy GPIO number so request the GPIO here and
307307
* convert it to descriptor.
308308
*/
309-
unsigned flags = GPIOF_IN;
310-
311-
if (button->active_low)
312-
flags |= GPIOF_ACTIVE_LOW;
313-
314-
error = devm_gpio_request_one(dev, button->gpio,
315-
flags, button->desc ? : DRV_NAME);
309+
error = devm_gpio_request_one(dev, button->gpio, GPIOF_IN,
310+
button->desc ? : DRV_NAME);
316311
if (error)
317312
return dev_err_probe(dev, error,
318313
"unable to claim gpio %u\n",
@@ -325,6 +320,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
325320
button->gpio);
326321
return -EINVAL;
327322
}
323+
324+
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
325+
gpiod_toggle_active_low(bdata->gpiod);
328326
}
329327

330328
bdata->last_state = -1;

0 commit comments

Comments
 (0)