]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
leds: pca9532: Use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 23 Apr 2025 07:53:52 +0000 (09:53 +0200)
committerLee Jones <lee@kernel.org>
Wed, 14 May 2025 08:25:00 +0000 (09:25 +0100)
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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-leds-v1-3-2f42d8fbb525@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-pca9532.c

index 1b47acf54720b314772c2c21af6357845b5a16be..7d4c071a6cd01a914af5d4d3c718d35fbd7267f2 100644 (file)
@@ -318,7 +318,8 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
        return -EBUSY;
 }
 
-static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val)
+static int pca9532_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
+                                 int val)
 {
        struct pca9532_data *data = gpiochip_get_data(gc);
        struct pca9532_led *led = &data->leds[offset];
@@ -329,6 +330,8 @@ static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int va
                led->state = PCA9532_OFF;
 
        pca9532_setled(led);
+
+       return 0;
 }
 
 static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)
@@ -351,9 +354,7 @@ static int pca9532_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
 
 static int pca9532_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int val)
 {
-       pca9532_gpio_set_value(gc, offset, val);
-
-       return 0;
+       return pca9532_gpio_set_value(gc, offset, val);
 }
 #endif /* CONFIG_LEDS_PCA9532_GPIO */
 
@@ -472,7 +473,7 @@ static int pca9532_configure(struct i2c_client *client,
                data->gpio.label = "gpio-pca9532";
                data->gpio.direction_input = pca9532_gpio_direction_input;
                data->gpio.direction_output = pca9532_gpio_direction_output;
-               data->gpio.set = pca9532_gpio_set_value;
+               data->gpio.set_rv = pca9532_gpio_set_value;
                data->gpio.get = pca9532_gpio_get_value;
                data->gpio.request = pca9532_gpio_request_pin;
                data->gpio.can_sleep = 1;