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 <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/22771
Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Shiji Yang
2026-04-04 18:30:15 +08:00
committed by Nick Hainke
parent 9b76c858e0
commit 15374ca2e7
3 changed files with 28 additions and 2 deletions

View 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

View 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)

View 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,