mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
gpio: altera-a10sr: use new 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. Link: https://lore.kernel.org/r/20250303-gpiochip-set-conversion-v1-7-1d5cceeebf8b@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
@@ -35,15 +35,15 @@ static int altr_a10sr_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||
return !!(val & BIT(offset - ALTR_A10SR_LED_VALID_SHIFT));
|
||||
}
|
||||
|
||||
static void altr_a10sr_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
static int altr_a10sr_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct altr_a10sr_gpio *gpio = gpiochip_get_data(chip);
|
||||
|
||||
regmap_update_bits(gpio->regmap, ALTR_A10SR_LED_REG,
|
||||
BIT(ALTR_A10SR_LED_VALID_SHIFT + offset),
|
||||
value ? BIT(ALTR_A10SR_LED_VALID_SHIFT + offset)
|
||||
: 0);
|
||||
return regmap_update_bits(gpio->regmap, ALTR_A10SR_LED_REG,
|
||||
BIT(ALTR_A10SR_LED_VALID_SHIFT + offset),
|
||||
value ?
|
||||
BIT(ALTR_A10SR_LED_VALID_SHIFT + offset) : 0);
|
||||
}
|
||||
|
||||
static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc,
|
||||
@@ -69,7 +69,7 @@ static const struct gpio_chip altr_a10sr_gc = {
|
||||
.label = "altr_a10sr_gpio",
|
||||
.owner = THIS_MODULE,
|
||||
.get = altr_a10sr_gpio_get,
|
||||
.set = altr_a10sr_gpio_set,
|
||||
.set_rv = altr_a10sr_gpio_set,
|
||||
.direction_input = altr_a10sr_gpio_direction_input,
|
||||
.direction_output = altr_a10sr_gpio_direction_output,
|
||||
.can_sleep = true,
|
||||
|
||||
Reference in New Issue
Block a user