Skip to content

Commit e1cc2c8

Browse files
Bartosz Golaszewskilag-linaro
authored andcommitted
leds: pca9532: 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: 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>
1 parent 2aafd2e commit e1cc2c8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/leds/leds-pca9532.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
318318
return -EBUSY;
319319
}
320320

321-
static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val)
321+
static int pca9532_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
322+
int val)
322323
{
323324
struct pca9532_data *data = gpiochip_get_data(gc);
324325
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
329330
led->state = PCA9532_OFF;
330331

331332
pca9532_setled(led);
333+
334+
return 0;
332335
}
333336

334337
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)
351354

352355
static int pca9532_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int val)
353356
{
354-
pca9532_gpio_set_value(gc, offset, val);
355-
356-
return 0;
357+
return pca9532_gpio_set_value(gc, offset, val);
357358
}
358359
#endif /* CONFIG_LEDS_PCA9532_GPIO */
359360

@@ -472,7 +473,7 @@ static int pca9532_configure(struct i2c_client *client,
472473
data->gpio.label = "gpio-pca9532";
473474
data->gpio.direction_input = pca9532_gpio_direction_input;
474475
data->gpio.direction_output = pca9532_gpio_direction_output;
475-
data->gpio.set = pca9532_gpio_set_value;
476+
data->gpio.set_rv = pca9532_gpio_set_value;
476477
data->gpio.get = pca9532_gpio_get_value;
477478
data->gpio.request = pca9532_gpio_request_pin;
478479
data->gpio.can_sleep = 1;

0 commit comments

Comments
 (0)