mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
gpio: loongson: 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. 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-11-b22245cde81a@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
145c4d7052
commit
7d34d9fbab
|
|
@ -48,8 +48,8 @@ static int loongson_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
|||
return !!(val & BIT(gpio + LOONGSON_GPIO_IN_OFFSET));
|
||||
}
|
||||
|
||||
static void loongson_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned gpio, int value)
|
||||
static int loongson_gpio_set_value(struct gpio_chip *chip, unsigned int gpio,
|
||||
int value)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
|
|
@ -61,6 +61,8 @@ static void loongson_gpio_set_value(struct gpio_chip *chip,
|
|||
val &= ~BIT(gpio);
|
||||
LOONGSON_GPIODATA = val;
|
||||
spin_unlock(&gpio_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int loongson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
|
||||
|
|
@ -104,7 +106,7 @@ static int loongson_gpio_probe(struct platform_device *pdev)
|
|||
gc->base = 0;
|
||||
gc->ngpio = LOONGSON_N_GPIO;
|
||||
gc->get = loongson_gpio_get_value;
|
||||
gc->set = loongson_gpio_set_value;
|
||||
gc->set_rv = loongson_gpio_set_value;
|
||||
gc->direction_input = loongson_gpio_direction_input;
|
||||
gc->direction_output = loongson_gpio_direction_output;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user