package: gpio-button-hotplug: adapt to kernel 6.18

Change GPIOF_ACTIVE_LOW to gpiod_toggle_active_low

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/21078
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mieczyslaw Nalewaj
2025-12-14 01:53:22 +01:00
committed by Robert Marko
parent 7f97b2665c
commit c1599ce82e
@@ -513,10 +513,15 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
GPIOD_IN);
if (IS_ERR(bdata->gpiod)) {
/* or the legacy (button->gpio is good) way? */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,18,0)
error = devm_gpio_request_one(dev,
button->gpio, GPIOF_IN | (
button->active_low ? GPIOF_ACTIVE_LOW :
0), desc);
#else
error = devm_gpio_request_one(dev,
button->gpio, GPIOF_IN, desc);
#endif
if (error) {
dev_err_probe(dev, error,
"unable to claim gpio %d",
@@ -525,6 +530,10 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
}
bdata->gpiod = gpio_to_desc(button->gpio);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,18,0)
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
gpiod_toggle_active_low(bdata->gpiod);
#endif
}
} else {
/* Device-tree */