gpio: lpc18xx: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 6 May 2025 09:01:46 +0000 (11:01 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 13 May 2025 13:15:34 +0000 (15:15 +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.

Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-3-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-lpc18xx.c

index 2cf9fb4637a2bbc7b97b26b4d2c69ba071e9638f..8bb8a87ec1e9935f4ebd3b6ff3d6751ea766e613 100644 (file)
@@ -263,10 +263,14 @@ free_ic:
        return ret;
 }
 
-static void lpc18xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int lpc18xx_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                           int value)
 {
        struct lpc18xx_gpio_chip *gc = gpiochip_get_data(chip);
+
        writeb(value ? 1 : 0, gc->base + offset);
+
+       return 0;
 }
 
 static int lpc18xx_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -316,7 +320,7 @@ static const struct gpio_chip lpc18xx_chip = {
        .free                   = gpiochip_generic_free,
        .direction_input        = lpc18xx_gpio_direction_input,
        .direction_output       = lpc18xx_gpio_direction_output,
-       .set                    = lpc18xx_gpio_set,
+       .set_rv                 = lpc18xx_gpio_set,
        .get                    = lpc18xx_gpio_get,
        .ngpio                  = LPC18XX_MAX_PORTS * LPC18XX_PINS_PER_PORT,
        .owner                  = THIS_MODULE,