serial: max310x: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 8 Apr 2025 07:42:00 +0000 (09:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 14:52:25 +0000 (16:52 +0200)
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>
Link: https://lore.kernel.org/r/20250408-gpiochip-set-rv-tty-v1-1-fb49444827d4@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/max310x.c

index 35369a2f77b29e0f62e8c847d7eb63facb4e7713..541c790c0109019e364a25106f9951179b7f694e 100644 (file)
@@ -1189,13 +1189,16 @@ static int max310x_gpio_get(struct gpio_chip *chip, unsigned int offset)
        return !!((val >> 4) & (1 << (offset % 4)));
 }
 
-static void max310x_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int max310x_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                           int value)
 {
        struct max310x_port *s = gpiochip_get_data(chip);
        struct uart_port *port = &s->p[offset / 4].port;
 
        max310x_port_update(port, MAX310X_GPIODATA_REG, 1 << (offset % 4),
                            value ? 1 << (offset % 4) : 0);
+
+       return 0;
 }
 
 static int max310x_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
@@ -1411,7 +1414,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
        s->gpio.direction_input = max310x_gpio_direction_input;
        s->gpio.get             = max310x_gpio_get;
        s->gpio.direction_output= max310x_gpio_direction_output;
-       s->gpio.set             = max310x_gpio_set;
+       s->gpio.set_rv          = max310x_gpio_set;
        s->gpio.set_config      = max310x_gpio_set_config;
        s->gpio.base            = -1;
        s->gpio.ngpio           = devtype->nr * 4;