Commit 023a24f8 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

gpio: wm831x: 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.

Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20250709-gpiochip-set-rv-gpio-remaining-v1-6-b8950f69618d@linaro.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent dd94adf7
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -58,12 +58,13 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset)
		return 0;
}

static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int wm831x_gpio_set(struct gpio_chip *chip, unsigned int offset,
			   int value)
{
	struct wm831x_gpio *wm831x_gpio = gpiochip_get_data(chip);
	struct wm831x *wm831x = wm831x_gpio->wm831x;

	wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
	return wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
			       value << offset);
}

@@ -85,9 +86,7 @@ static int wm831x_gpio_direction_out(struct gpio_chip *chip,
		return ret;

	/* Can only set GPIO state once it's in output mode */
	wm831x_gpio_set(chip, offset, value);

	return 0;
	return wm831x_gpio_set(chip, offset, value);
}

static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
@@ -254,7 +253,7 @@ static const struct gpio_chip template_chip = {
	.direction_input	= wm831x_gpio_direction_in,
	.get			= wm831x_gpio_get,
	.direction_output	= wm831x_gpio_direction_out,
	.set			= wm831x_gpio_set,
	.set_rv			= wm831x_gpio_set,
	.to_irq			= wm831x_gpio_to_irq,
	.set_config		= wm831x_set_config,
	.dbg_show		= wm831x_gpio_dbg_show,