mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-18 12:40:01 +10:00
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>
This commit is contained in:
parent
2aafd2e41c
commit
e1cc2c8cc7
@ -318,7 +318,8 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
|
|||||||
return -EBUSY;
|
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_data *data = gpiochip_get_data(gc);
|
||||||
struct pca9532_led *led = &data->leds[offset];
|
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;
|
led->state = PCA9532_OFF;
|
||||||
|
|
||||||
pca9532_setled(led);
|
pca9532_setled(led);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)
|
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)
|
static int pca9532_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int val)
|
||||||
{
|
{
|
||||||
pca9532_gpio_set_value(gc, offset, val);
|
return pca9532_gpio_set_value(gc, offset, val);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_LEDS_PCA9532_GPIO */
|
#endif /* CONFIG_LEDS_PCA9532_GPIO */
|
||||||
|
|
||||||
@ -472,7 +473,7 @@ static int pca9532_configure(struct i2c_client *client,
|
|||||||
data->gpio.label = "gpio-pca9532";
|
data->gpio.label = "gpio-pca9532";
|
||||||
data->gpio.direction_input = pca9532_gpio_direction_input;
|
data->gpio.direction_input = pca9532_gpio_direction_input;
|
||||||
data->gpio.direction_output = pca9532_gpio_direction_output;
|
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.get = pca9532_gpio_get_value;
|
||||||
data->gpio.request = pca9532_gpio_request_pin;
|
data->gpio.request = pca9532_gpio_request_pin;
|
||||||
data->gpio.can_sleep = 1;
|
data->gpio.can_sleep = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user