Commit a5482409 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Greg Kroah-Hartman
Browse files

serial: sc16is7xx: 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>
Link: https://lore.kernel.org/r/20250408-gpiochip-set-rv-tty-v1-2-fb49444827d4@linaro.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2318a488
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1333,13 +1333,16 @@ static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset)
	return !!(val & BIT(offset));
}

static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
static int sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
			      int val)
{
	struct sc16is7xx_port *s = gpiochip_get_data(chip);
	struct uart_port *port = &s->p[0].port;

	sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset),
			      val ? BIT(offset) : 0);

	return 0;
}

static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip,
@@ -1422,7 +1425,7 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s)
	s->gpio.direction_input	 = sc16is7xx_gpio_direction_input;
	s->gpio.get		 = sc16is7xx_gpio_get;
	s->gpio.direction_output = sc16is7xx_gpio_direction_output;
	s->gpio.set		 = sc16is7xx_gpio_set;
	s->gpio.set_rv		 = sc16is7xx_gpio_set;
	s->gpio.base		 = -1;
	s->gpio.ngpio		 = s->devtype->nr_gpio;
	s->gpio.can_sleep	 = 1;