Commit 815c9769 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

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

Link: https://lore.kernel.org/r/20250709-gpiochip-set-rv-gpio-remaining-v1-17-b8950f69618d@linaro.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent ee6e05eb
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static int zynq_gpio_get_value(struct gpio_chip *chip, unsigned int pin)
 * upper 16 bits) based on the given pin number and sets the state of a
 * gpio pin to the specified value. The state is either 0 or non-zero.
 */
static void zynq_gpio_set_value(struct gpio_chip *chip, unsigned int pin,
static int zynq_gpio_set_value(struct gpio_chip *chip, unsigned int pin,
			       int state)
{
	unsigned int reg_offset, bank_num, bank_pin_num;
@@ -290,6 +290,8 @@ static void zynq_gpio_set_value(struct gpio_chip *chip, unsigned int pin,
		((state << bank_pin_num) | ZYNQ_GPIO_UPPER_MASK);

	writel_relaxed(state, gpio->base_addr + reg_offset);

	return 0;
}

/**
@@ -930,7 +932,7 @@ static int zynq_gpio_probe(struct platform_device *pdev)
	chip->owner = THIS_MODULE;
	chip->parent = &pdev->dev;
	chip->get = zynq_gpio_get_value;
	chip->set = zynq_gpio_set_value;
	chip->set_rv = zynq_gpio_set_value;
	chip->request = zynq_gpio_request;
	chip->free = zynq_gpio_free;
	chip->direction_input = zynq_gpio_dir_in;