patches: add gpio-button-hotplug compatibility fix (0039)

Fixes gpio-button-hotplug compilation on older kernel versions.

New patch for 24.10.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2025-10-19 00:00:00 +02:00
parent 408a880b49
commit 18de3bf9f3

View File

@@ -0,0 +1,48 @@
From 72b474957f9d4de5e413a2ccd3c460132f2dc7ea Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 1 Aug 2025 14:23:01 +0200
Subject: [PATCH 39/55] gpio-button-hotplug: fix compile on older kernel
Adds kernel version compatibility for GPIO API changes between 5.4/6.1 and 6.6 kernels, ensuring button driver compiles across all supported versions.
Signed-off-by: John Crispin <john@phrozen.org>
---
.../gpio-button-hotplug/src/gpio-button-hotplug.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 9876dee90f..ae7a31e80d 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -525,9 +525,10 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
button->active_low ? GPIOF_ACTIVE_LOW :
0), desc);
if (error) {
- dev_err_probe(dev, error,
- "unable to claim gpio %d",
- button->gpio);
+ if (error != -EPROBE_DEFER) {
+ dev_err(dev, "unable to claim gpio %d, err=%d\n",
+ button->gpio, error);
+ }
goto out;
}
@@ -538,9 +539,14 @@ static int gpio_keys_button_probe(struct platform_device *pdev,
struct device_node *child =
of_get_next_child(dev->of_node, prev);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,6,1))
bdata->gpiod = devm_fwnode_gpiod_get(dev,
of_fwnode_handle(child), NULL, GPIOD_IN,
desc);
+#else
+ bdata->gpiod = devm_gpiod_get_from_of_node(dev,
+ child, "gpios", 0, GPIOD_IN, desc);
+#endif
prev = child;
}
--
2.34.1