iio: adc: ad4130: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 9 Apr 2025 08:40:43 +0000 (10:40 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 22 Apr 2025 18:10:02 +0000 (19:10 +0100)
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-5-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad4130.c

index 0f4c9cd..6cf790f 100644 (file)
@@ -522,15 +522,15 @@ static int ad4130_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
        return GPIO_LINE_DIRECTION_OUT;
 }
 
-static void ad4130_gpio_set(struct gpio_chip *gc, unsigned int offset,
-                           int value)
+static int ad4130_gpio_set(struct gpio_chip *gc, unsigned int offset,
+                          int value)
 {
        struct ad4130_state *st = gpiochip_get_data(gc);
        unsigned int mask = FIELD_PREP(AD4130_IO_CONTROL_GPIO_DATA_MASK,
                                       BIT(offset));
 
-       regmap_update_bits(st->regmap, AD4130_IO_CONTROL_REG, mask,
-                          value ? mask : 0);
+       return regmap_update_bits(st->regmap, AD4130_IO_CONTROL_REG, mask,
+                                 value ? mask : 0);
 }
 
 static int ad4130_set_mode(struct ad4130_state *st, enum ad4130_mode mode)
@@ -2064,7 +2064,7 @@ static int ad4130_probe(struct spi_device *spi)
        st->gc.can_sleep = true;
        st->gc.init_valid_mask = ad4130_gpio_init_valid_mask;
        st->gc.get_direction = ad4130_gpio_get_direction;
-       st->gc.set = ad4130_gpio_set;
+       st->gc.set_rv = ad4130_gpio_set;
 
        ret = devm_gpiochip_add_data(dev, &st->gc, st);
        if (ret)