mirror of
https://github.com/torvalds/linux.git
synced 2026-03-13 23:46:14 +01:00
gpio: adp5520: 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. Acked-by: Michael Hennerich <michael.hennerich@analog.com> Link: https://lore.kernel.org/r/20250303-gpiochip-set-conversion-v1-5-1d5cceeebf8b@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
0dfce460fe
commit
8a9bc5a56f
1 changed files with 7 additions and 5 deletions
|
|
@ -40,16 +40,18 @@ static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off)
|
|||
return !!(reg_val & dev->lut[off]);
|
||||
}
|
||||
|
||||
static void adp5520_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned off, int val)
|
||||
static int adp5520_gpio_set_value(struct gpio_chip *chip,
|
||||
unsigned int off, int val)
|
||||
{
|
||||
struct adp5520_gpio *dev;
|
||||
dev = gpiochip_get_data(chip);
|
||||
|
||||
if (val)
|
||||
adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
|
||||
return adp5520_set_bits(dev->master, ADP5520_GPIO_OUT,
|
||||
dev->lut[off]);
|
||||
else
|
||||
adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
|
||||
return adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT,
|
||||
dev->lut[off]);
|
||||
}
|
||||
|
||||
static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off)
|
||||
|
|
@ -120,7 +122,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
|
|||
gc->direction_input = adp5520_gpio_direction_input;
|
||||
gc->direction_output = adp5520_gpio_direction_output;
|
||||
gc->get = adp5520_gpio_get_value;
|
||||
gc->set = adp5520_gpio_set_value;
|
||||
gc->set_rv = adp5520_gpio_set_value;
|
||||
gc->can_sleep = true;
|
||||
|
||||
gc->base = pdata->gpio_start;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue