Skip to content

Commit 7bd2bb7

Browse files
author
Bartosz Golaszewski
committed
gpio: bd71815: 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. Reviewed-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent d5cc728 commit 7bd2bb7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/gpio/gpio-bd71815.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,18 @@ static int bd71815gpo_get(struct gpio_chip *chip, unsigned int offset)
3737
return (val >> offset) & 1;
3838
}
3939

40-
static void bd71815gpo_set(struct gpio_chip *chip, unsigned int offset,
41-
int value)
40+
static int bd71815gpo_set(struct gpio_chip *chip, unsigned int offset,
41+
int value)
4242
{
4343
struct bd71815_gpio *bd71815 = gpiochip_get_data(chip);
44-
int ret, bit;
44+
int bit;
4545

4646
bit = BIT(offset);
4747

4848
if (value)
49-
ret = regmap_set_bits(bd71815->regmap, BD71815_REG_GPO, bit);
50-
else
51-
ret = regmap_clear_bits(bd71815->regmap, BD71815_REG_GPO, bit);
49+
return regmap_set_bits(bd71815->regmap, BD71815_REG_GPO, bit);
5250

53-
if (ret)
54-
dev_warn(bd71815->dev, "failed to toggle GPO\n");
51+
return regmap_clear_bits(bd71815->regmap, BD71815_REG_GPO, bit);
5552
}
5653

5754
static int bd71815_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
@@ -88,7 +85,7 @@ static const struct gpio_chip bd71815gpo_chip = {
8885
.owner = THIS_MODULE,
8986
.get = bd71815gpo_get,
9087
.get_direction = bd71815gpo_direction_get,
91-
.set = bd71815gpo_set,
88+
.set_rv = bd71815gpo_set,
9289
.set_config = bd71815_gpio_set_config,
9390
.can_sleep = true,
9491
};

0 commit comments

Comments
 (0)