From: Shiji Yang Date: Sat, 4 Apr 2026 10:30:15 +0000 (+0800) Subject: ath79: mikrotik: fix 6.18 kernel GPIO driver build errors X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F22771%2Fhead;p=thirdparty%2Fopenwrt.git ath79: mikrotik: fix 6.18 kernel GPIO driver build errors 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 Link: https://github.com/openwrt/openwrt/pull/22771 Signed-off-by: Nick Hainke --- diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c index 6ed1e82a5a7..d8b5603a580 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c @@ -12,6 +12,7 @@ #include #include #include +#include #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 diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c index 299dc7d0a17..ccb46f512f3 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -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) diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c index 9e98d6a55ed..8b30542c12b 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c @@ -20,6 +20,7 @@ #include #include #include +#include #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,