]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ath79: mikrotik: fix 6.18 kernel GPIO driver build errors 22771/head
authorShiji Yang <yangshiji66@outlook.com>
Sat, 4 Apr 2026 10:30:15 +0000 (18:30 +0800)
committerNick Hainke <vincent@systemli.org>
Sat, 11 Apr 2026 19:11:07 +0000 (21:11 +0200)
gpio_chip .set() callback return type has been changed since linux
6.17 kernel[1-2]. Fix:

drivers/gpio/gpio-latch-mikrotik.c: In function 'gpio_latch_probe':
drivers/gpio/gpio-latch-mikrotik.c:152:17: error: assignment to 'int (*)(struct gpio_chip *, unsigned int,  int)' from incompatible pointer type 'void (*)(struct gpio_chip *, unsigned int,  int)' [-Wincompatible-pointer-types]
  152 |         gc->set = gpio_latch_set;
      |                 ^

drivers/gpio/gpio-rb4xx.c: In function 'rb4xx_gpio_probe':
drivers/gpio/gpio-rb4xx.c:133:41: error: assignment to 'int (*)(struct gpio_chip *, unsigned int,  int)' from incompatible pointer type 'void (*)(struct gpio_chip *, unsigned int,  int)' [-Wincompatible-pointer-types]
  133 |         gpio->chip.set                  = rb4xx_gpio_set;
      |                                         ^

drivers/gpio/gpio-rb91x-key.c: In function 'gpio_rb91x_key_probe':
drivers/gpio/gpio-rb91x-key.c:165:17: error: assignment to 'int (*)(struct gpio_chip *, unsigned int,  int)' from incompatible pointer type 'void (*)(struct gpio_chip *, unsigned int,  int)' [-Wincompatible-pointer-types]
  165 |         gc->set = gpio_rb91x_key_set;
      |                 ^

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.18.y&id=397a46c9aa3343e8efe6847bdaa124945bab1de4
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.18.y&id=d9d87d90cc0b10cd56ae353f50b11417e7d21712
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/22771
Signed-off-by: Nick Hainke <vincent@systemli.org>
target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c
target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c

index 6ed1e82a5a75a642f8658efe9a28415289ff9ce2..d8b5603a580f6f0be1495843f581572a86002754 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 #include <linux/platform_device.h>
+#include <linux/version.h>
 
 #define GPIO_LATCH_DRIVER_NAME  "gpio-latch-mikrotik"
 #define GPIO_LATCH_LINES 9
@@ -61,7 +62,11 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset)
        return ret;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+static int
+#else
 static void
+#endif
 gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value)
 {
        struct gpio_latch_chip *glc = gpiochip_get_data(gc);
@@ -76,6 +81,9 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value)
        gpio_latch_lock(glc, enable_latch);
        gpiod_set_raw_value_cansleep(glc->gpios[offset], value);
        gpio_latch_unlock(glc, disable_latch);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+       return 0;
+#endif
 }
 
 static int
index 299dc7d0a1715cb4f28fea0381e87e75fb5549d2..ccb46f512f387e7b6e446f5b7c2a20c4bff5e484 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/version.h>
 
 #include <mfd/rb4xx-cpld.h>
 
@@ -93,10 +94,18 @@ static int rb4xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
        return ret;
 }
 
-static void rb4xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+static int
+#else
+static void
+#endif
+rb4xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
                           int value)
 {
        rb4xx_gpio_cpld_set(gpiochip_get_data(chip), offset, value);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+       return 0;
+#endif
 }
 
 static int rb4xx_gpio_probe(struct platform_device *pdev)
index 9e98d6a55ed21bf1efa0095277244e29c94b9296..8b30542c12bb6dd1b3bcd54e5956cb8eb7c27181 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/gpio/driver.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/version.h>
 
 #define GPIO_RB91X_KEY_DRIVER_NAME  "gpio-rb91x-key"
 
@@ -88,7 +89,12 @@ static int gpio_rb91x_key_direction_input(struct gpio_chip *gc, unsigned offset)
        }
 }
 
-static void gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+static int
+#else
+static void
+#endif
+gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value)
 {
        struct gpio_rb91x_key *drvdata = gpiochip_get_data(gc);
        struct gpio_desc *gpio = drvdata->gpio;
@@ -117,6 +123,9 @@ static void gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value)
        }
 
        mutex_unlock(&drvdata->mutex);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+       return 0;
+#endif
 }
 
 static int gpio_rb91x_key_direction_output(struct gpio_chip *gc, unsigned offset,