gpio: kempld: use new line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 23 Apr 2025 07:15:09 +0000 (09:15 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 30 Apr 2025 08:27:58 +0000 (10:27 +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.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-7-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-kempld.c

index 4ea15f08e0f4ceca7b400a5360741d5a4b135952..e38e604baa223d200045aaf49a64fe44f513b52b 100644 (file)
@@ -63,7 +63,8 @@ static int kempld_gpio_get(struct gpio_chip *chip, unsigned offset)
        return !!kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset);
 }
 
-static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int kempld_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                          int value)
 {
        struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
        struct kempld_device_data *pld = gpio->pld;
@@ -71,6 +72,8 @@ static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
        kempld_get_mutex(pld);
        kempld_gpio_bitop(pld, KEMPLD_GPIO_LVL_NUM(offset), offset, value);
        kempld_release_mutex(pld);
+
+       return 0;
 }
 
 static int kempld_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -166,7 +169,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
        chip->direction_output = kempld_gpio_direction_output;
        chip->get_direction = kempld_gpio_get_direction;
        chip->get = kempld_gpio_get;
-       chip->set = kempld_gpio_set;
+       chip->set_rv = kempld_gpio_set;
        chip->ngpio = kempld_gpio_pincount(pld);
        if (chip->ngpio == 0) {
                dev_err(dev, "No GPIO pins detected\n");