gpio: mockup: use value returning setters
struct gpio_chip now has additional variants of the set(_multiple) driver callbacks that return an integer to indicate success or failure. Convert the driver to using them. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250220-gpio-set-retval-v2-9-bc4cfd38dae3@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
e32ce8f62d
commit
66d231b12e
|
|
@ -122,7 +122,7 @@ static void __gpio_mockup_set(struct gpio_mockup_chip *chip,
|
|||
chip->lines[offset].value = !!value;
|
||||
}
|
||||
|
||||
static void gpio_mockup_set(struct gpio_chip *gc,
|
||||
static int gpio_mockup_set(struct gpio_chip *gc,
|
||||
unsigned int offset, int value)
|
||||
{
|
||||
struct gpio_mockup_chip *chip = gpiochip_get_data(gc);
|
||||
|
|
@ -130,10 +130,12 @@ static void gpio_mockup_set(struct gpio_chip *gc,
|
|||
guard(mutex)(&chip->lock);
|
||||
|
||||
__gpio_mockup_set(chip, offset, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gpio_mockup_set_multiple(struct gpio_chip *gc,
|
||||
unsigned long *mask, unsigned long *bits)
|
||||
static int gpio_mockup_set_multiple(struct gpio_chip *gc,
|
||||
unsigned long *mask, unsigned long *bits)
|
||||
{
|
||||
struct gpio_mockup_chip *chip = gpiochip_get_data(gc);
|
||||
unsigned int bit;
|
||||
|
|
@ -142,6 +144,8 @@ static void gpio_mockup_set_multiple(struct gpio_chip *gc,
|
|||
|
||||
for_each_set_bit(bit, mask, gc->ngpio)
|
||||
__gpio_mockup_set(chip, bit, test_bit(bit, bits));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_mockup_apply_pull(struct gpio_mockup_chip *chip,
|
||||
|
|
@ -445,9 +449,9 @@ static int gpio_mockup_probe(struct platform_device *pdev)
|
|||
gc->owner = THIS_MODULE;
|
||||
gc->parent = dev;
|
||||
gc->get = gpio_mockup_get;
|
||||
gc->set = gpio_mockup_set;
|
||||
gc->set_rv = gpio_mockup_set;
|
||||
gc->get_multiple = gpio_mockup_get_multiple;
|
||||
gc->set_multiple = gpio_mockup_set_multiple;
|
||||
gc->set_multiple_rv = gpio_mockup_set_multiple;
|
||||
gc->direction_output = gpio_mockup_dirout;
|
||||
gc->direction_input = gpio_mockup_dirin;
|
||||
gc->get_direction = gpio_mockup_get_direction;
|
||||
|
|
|
|||
Loading…
Reference in New Issue