mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-26 11:40:24 +02:00
iio: dac: ad5592r: use new GPIO 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. 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-3-4b36428f39cb@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
135e101f4d
commit
8a2d2326f5
@@ -40,7 +40,8 @@ static int ad5592r_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
return !!(val & BIT(offset));
|
||||
}
|
||||
|
||||
static void ad5592r_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
static int ad5592r_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct ad5592r_state *st = gpiochip_get_data(chip);
|
||||
|
||||
@@ -51,7 +52,7 @@ static void ad5592r_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
else
|
||||
st->gpio_val &= ~BIT(offset);
|
||||
|
||||
st->ops->reg_write(st, AD5592R_REG_GPIO_SET, st->gpio_val);
|
||||
return st->ops->reg_write(st, AD5592R_REG_GPIO_SET, st->gpio_val);
|
||||
}
|
||||
|
||||
static int ad5592r_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
@@ -128,7 +129,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st)
|
||||
st->gpiochip.direction_input = ad5592r_gpio_direction_input;
|
||||
st->gpiochip.direction_output = ad5592r_gpio_direction_output;
|
||||
st->gpiochip.get = ad5592r_gpio_get;
|
||||
st->gpiochip.set = ad5592r_gpio_set;
|
||||
st->gpiochip.set_rv = ad5592r_gpio_set;
|
||||
st->gpiochip.request = ad5592r_gpio_request;
|
||||
st->gpiochip.owner = THIS_MODULE;
|
||||
st->gpiochip.names = ad5592r_gpio_names;
|
||||
|
||||
Reference in New Issue
Block a user