Commit 43a8440f authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Dmitry Torokhov
Browse files

Input: adp5589 - 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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20250610-gpiochip-set-rv-input-v1-3-5875240b48d8@linaro.org


Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 687f0d0e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -404,8 +404,8 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
	return !!(val & bit);
}

static void adp5589_gpio_set_value(struct gpio_chip *chip,
				   unsigned off, int val)
static int adp5589_gpio_set_value(struct gpio_chip *chip, unsigned int off,
				  int val)
{
	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
@@ -418,8 +418,9 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
	else
		kpad->dat_out[bank] &= ~bit;

	adp5589_write(kpad->client, kpad->var->reg(ADP5589_GPO_DATA_OUT_A) +
		      bank, kpad->dat_out[bank]);
	return adp5589_write(kpad->client,
			     kpad->var->reg(ADP5589_GPO_DATA_OUT_A) + bank,
			     kpad->dat_out[bank]);
}

static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
@@ -520,7 +521,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
	kpad->gc.direction_input = adp5589_gpio_direction_input;
	kpad->gc.direction_output = adp5589_gpio_direction_output;
	kpad->gc.get = adp5589_gpio_get_value;
	kpad->gc.set = adp5589_gpio_set_value;
	kpad->gc.set_rv = adp5589_gpio_set_value;
	kpad->gc.can_sleep = 1;

	kpad->gc.base = gpio_data->gpio_start;