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

gpio: pcf857x: 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.

Link: https://lore.kernel.org/r/20250619-gpiochip-set-rv-gpio-v2-2-74abf689fbd8@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

+10 -7
+10 -7
drivers/gpio/gpio-pcf857x.c
··· 171 171 return status; 172 172 } 173 173 174 - static void pcf857x_set(struct gpio_chip *chip, unsigned int offset, int value) 174 + static int pcf857x_set(struct gpio_chip *chip, unsigned int offset, int value) 175 175 { 176 - pcf857x_output(chip, offset, value); 176 + return pcf857x_output(chip, offset, value); 177 177 } 178 178 179 - static void pcf857x_set_multiple(struct gpio_chip *chip, unsigned long *mask, 180 - unsigned long *bits) 179 + static int pcf857x_set_multiple(struct gpio_chip *chip, unsigned long *mask, 180 + unsigned long *bits) 181 181 { 182 182 struct pcf857x *gpio = gpiochip_get_data(chip); 183 + int status; 183 184 184 185 mutex_lock(&gpio->lock); 185 186 gpio->out &= ~*mask; 186 187 gpio->out |= *bits & *mask; 187 - gpio->write(gpio->client, gpio->out); 188 + status = gpio->write(gpio->client, gpio->out); 188 189 mutex_unlock(&gpio->lock); 190 + 191 + return status; 189 192 } 190 193 191 194 /*-------------------------------------------------------------------------*/ ··· 295 292 gpio->chip.owner = THIS_MODULE; 296 293 gpio->chip.get = pcf857x_get; 297 294 gpio->chip.get_multiple = pcf857x_get_multiple; 298 - gpio->chip.set = pcf857x_set; 299 - gpio->chip.set_multiple = pcf857x_set_multiple; 295 + gpio->chip.set_rv = pcf857x_set; 296 + gpio->chip.set_multiple_rv = pcf857x_set_multiple; 300 297 gpio->chip.direction_input = pcf857x_input; 301 298 gpio->chip.direction_output = pcf857x_output; 302 299 gpio->chip.ngpio = (uintptr_t)i2c_get_match_data(client);