mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
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>
This commit is contained in:
@@ -171,21 +171,24 @@ static int pcf857x_output(struct gpio_chip *chip, unsigned int offset, int value
|
||||
return status;
|
||||
}
|
||||
|
||||
static void pcf857x_set(struct gpio_chip *chip, unsigned int offset, int value)
|
||||
static int pcf857x_set(struct gpio_chip *chip, unsigned int offset, int value)
|
||||
{
|
||||
pcf857x_output(chip, offset, value);
|
||||
return pcf857x_output(chip, offset, value);
|
||||
}
|
||||
|
||||
static void pcf857x_set_multiple(struct gpio_chip *chip, unsigned long *mask,
|
||||
unsigned long *bits)
|
||||
static int pcf857x_set_multiple(struct gpio_chip *chip, unsigned long *mask,
|
||||
unsigned long *bits)
|
||||
{
|
||||
struct pcf857x *gpio = gpiochip_get_data(chip);
|
||||
int status;
|
||||
|
||||
mutex_lock(&gpio->lock);
|
||||
gpio->out &= ~*mask;
|
||||
gpio->out |= *bits & *mask;
|
||||
gpio->write(gpio->client, gpio->out);
|
||||
status = gpio->write(gpio->client, gpio->out);
|
||||
mutex_unlock(&gpio->lock);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -292,8 +295,8 @@ static int pcf857x_probe(struct i2c_client *client)
|
||||
gpio->chip.owner = THIS_MODULE;
|
||||
gpio->chip.get = pcf857x_get;
|
||||
gpio->chip.get_multiple = pcf857x_get_multiple;
|
||||
gpio->chip.set = pcf857x_set;
|
||||
gpio->chip.set_multiple = pcf857x_set_multiple;
|
||||
gpio->chip.set_rv = pcf857x_set;
|
||||
gpio->chip.set_multiple_rv = pcf857x_set_multiple;
|
||||
gpio->chip.direction_input = pcf857x_input;
|
||||
gpio->chip.direction_output = pcf857x_output;
|
||||
gpio->chip.ngpio = (uintptr_t)i2c_get_match_data(client);
|
||||
|
||||
Reference in New Issue
Block a user