Skip to content

Commit ed836b1

Browse files
graysky2robimarko
authored andcommitted
package: gpio-nct5104d: adapt to kernel 6.18
- 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 <[email protected]> Link: openwrt/openwrt#21218 Signed-off-by: Robert Marko <[email protected]>
1 parent bc4e7fd commit ed836b1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

package/kernel/gpio-nct5104d/src/gpio-nct5104d.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ static int nct5104d_gpio_direction_in(struct gpio_chip *chip, unsigned offset);
124124
static int nct5104d_gpio_get(struct gpio_chip *chip, unsigned offset);
125125
static int nct5104d_gpio_direction_out(struct gpio_chip *chip,
126126
unsigned offset, int value);
127+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
128+
static int nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
129+
#else
127130
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value);
128-
131+
#endif
129132
#define NCT5104D_GPIO_BANK(_base, _ngpio, _regbase) \
130133
{ \
131134
.chip = { \
@@ -219,7 +222,11 @@ static int nct5104d_gpio_direction_out(struct gpio_chip *chip,
219222
return 0;
220223
}
221224

225+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
226+
static int nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
227+
#else
222228
static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
229+
#endif
223230
{
224231
int err;
225232
struct nct5104d_gpio_bank *bank = gpiochip_get_data(chip);
@@ -228,7 +235,11 @@ static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value
228235

229236
err = superio_enter(sio->addr);
230237
if (err)
238+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
239+
return err;
240+
#else
231241
return;
242+
#endif
232243
superio_select(sio->addr, SIO_LD_GPIO);
233244

234245
data_out = superio_inb(sio->addr, gpio_data(bank->regbase));
@@ -239,6 +250,10 @@ static void nct5104d_gpio_set(struct gpio_chip *chip, unsigned offset, int value
239250
superio_outb(sio->addr, gpio_data(bank->regbase), data_out);
240251

241252
superio_exit(sio->addr);
253+
254+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0)
255+
return 0;
256+
#endif
242257
}
243258

244259
/*

0 commit comments

Comments
 (0)