Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: sim: 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-6-bc4cfd38dae3@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

+9 -5
+9 -5
drivers/gpio/gpio-sim.c
··· 120 120 return !!test_bit(offset, chip->value_map); 121 121 } 122 122 123 - static void gpio_sim_set(struct gpio_chip *gc, unsigned int offset, int value) 123 + static int gpio_sim_set(struct gpio_chip *gc, unsigned int offset, int value) 124 124 { 125 125 struct gpio_sim_chip *chip = gpiochip_get_data(gc); 126 126 127 127 scoped_guard(mutex, &chip->lock) 128 128 __assign_bit(offset, chip->value_map, value); 129 + 130 + return 0; 129 131 } 130 132 131 133 static int gpio_sim_get_multiple(struct gpio_chip *gc, ··· 141 139 return 0; 142 140 } 143 141 144 - static void gpio_sim_set_multiple(struct gpio_chip *gc, 145 - unsigned long *mask, unsigned long *bits) 142 + static int gpio_sim_set_multiple(struct gpio_chip *gc, 143 + unsigned long *mask, unsigned long *bits) 146 144 { 147 145 struct gpio_sim_chip *chip = gpiochip_get_data(gc); 148 146 149 147 scoped_guard(mutex, &chip->lock) 150 148 bitmap_replace(chip->value_map, chip->value_map, bits, mask, 151 149 gc->ngpio); 150 + 151 + return 0; 152 152 } 153 153 154 154 static int gpio_sim_direction_output(struct gpio_chip *gc, ··· 486 482 gc->parent = dev; 487 483 gc->fwnode = swnode; 488 484 gc->get = gpio_sim_get; 489 - gc->set = gpio_sim_set; 485 + gc->set_rv = gpio_sim_set; 490 486 gc->get_multiple = gpio_sim_get_multiple; 491 - gc->set_multiple = gpio_sim_set_multiple; 487 + gc->set_multiple_rv = gpio_sim_set_multiple; 492 488 gc->direction_output = gpio_sim_direction_output; 493 489 gc->direction_input = gpio_sim_direction_input; 494 490 gc->get_direction = gpio_sim_get_direction;