Skip to content

Commit 21c853a

Browse files
author
Bartosz Golaszewski
committed
gpio: adnp: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Link: https://lore.kernel.org/r/20250306-gpiochip-set-conversion-v2-2-a76e72e21425@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent c7fe19e commit 21c853a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/gpio/gpio-adnp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int adnp_gpio_get(struct gpio_chip *chip, unsigned offset)
8080
return (value & BIT(pos)) ? 1 : 0;
8181
}
8282

83-
static void __adnp_gpio_set(struct adnp *adnp, unsigned offset, int value)
83+
static int __adnp_gpio_set(struct adnp *adnp, unsigned int offset, int value)
8484
{
8585
unsigned int reg = offset >> adnp->reg_shift;
8686
unsigned int pos = offset & 7;
@@ -89,23 +89,23 @@ static void __adnp_gpio_set(struct adnp *adnp, unsigned offset, int value)
8989

9090
err = adnp_read(adnp, GPIO_PLR(adnp) + reg, &val);
9191
if (err < 0)
92-
return;
92+
return err;
9393

9494
if (value)
9595
val |= BIT(pos);
9696
else
9797
val &= ~BIT(pos);
9898

99-
adnp_write(adnp, GPIO_PLR(adnp) + reg, val);
99+
return adnp_write(adnp, GPIO_PLR(adnp) + reg, val);
100100
}
101101

102-
static void adnp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
102+
static int adnp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
103103
{
104104
struct adnp *adnp = gpiochip_get_data(chip);
105105

106106
guard(mutex)(&adnp->i2c_lock);
107107

108-
__adnp_gpio_set(adnp, offset, value);
108+
return __adnp_gpio_set(adnp, offset, value);
109109
}
110110

111111
static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -430,7 +430,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
430430
chip->direction_input = adnp_gpio_direction_input;
431431
chip->direction_output = adnp_gpio_direction_output;
432432
chip->get = adnp_gpio_get;
433-
chip->set = adnp_gpio_set;
433+
chip->set_rv = adnp_gpio_set;
434434
chip->can_sleep = true;
435435

436436
if (IS_ENABLED(CONFIG_DEBUG_FS))

0 commit comments

Comments
 (0)