- Changing return type from void to int
- Returning error code instead of void on superio_enter() failure
- Returning 0 on success
Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21218
Signed-off-by: Robert Marko <robimarko@gmail.com>
static int nct5104d_gpio_get(struct gpio_chip *chip, unsigned offset);
static int nct5104d_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value);
static int nct5104d_gpio_get(struct gpio_chip *chip, unsigned offset);
static int nct5104d_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+static int nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
+#else
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
#define NCT5104D_GPIO_BANK(_base, _ngpio, _regbase) \
{ \
.chip = { \
#define NCT5104D_GPIO_BANK(_base, _ngpio, _regbase) \
{ \
.chip = { \
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+static int nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+#else
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
int err;
struct nct5104d_gpio_bank *bank = gpiochip_get_data(chip);
{
int err;
struct nct5104d_gpio_bank *bank = gpiochip_get_data(chip);
err = superio_enter(sio->addr);
if (err)
err = superio_enter(sio->addr);
if (err)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+ return err;
+#else
superio_select(sio->addr, SIO_LD_GPIO);
data_out = superio_inb(sio->addr, gpio_data(bank->regbase));
superio_select(sio->addr, SIO_LD_GPIO);
data_out = superio_inb(sio->addr, gpio_data(bank->regbase));
superio_outb(sio->addr, gpio_data(bank->regbase), data_out);
superio_exit(sio->addr);
superio_outb(sio->addr, gpio_data(bank->regbase), data_out);
superio_exit(sio->addr);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
+ return 0;
+#endif