Skip to content

Commit 8a050f7

Browse files
author
Bartosz Golaszewski
committed
gpio: bd71828: 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 7bd2bb7 commit 8a050f7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/gpio/gpio-bd71828.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ struct bd71828_gpio {
1616
struct gpio_chip gpio;
1717
};
1818

19-
static void bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
20-
int value)
19+
static int bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
20+
int value)
2121
{
22-
int ret;
2322
struct bd71828_gpio *bdgpio = gpiochip_get_data(chip);
2423
u8 val = (value) ? BD71828_GPIO_OUT_HI : BD71828_GPIO_OUT_LO;
2524

@@ -28,12 +27,10 @@ static void bd71828_gpio_set(struct gpio_chip *chip, unsigned int offset,
2827
* we are dealing with - then we are done
2928
*/
3029
if (offset == HALL_GPIO_OFFSET)
31-
return;
30+
return 0;
3231

33-
ret = regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset),
34-
BD71828_GPIO_OUT_MASK, val);
35-
if (ret)
36-
dev_err(bdgpio->dev, "Could not set gpio to %d\n", value);
32+
return regmap_update_bits(bdgpio->regmap, GPIO_OUT_REG(offset),
33+
BD71828_GPIO_OUT_MASK, val);
3734
}
3835

3936
static int bd71828_gpio_get(struct gpio_chip *chip, unsigned int offset)
@@ -112,7 +109,7 @@ static int bd71828_probe(struct platform_device *pdev)
112109
bdgpio->gpio.set_config = bd71828_gpio_set_config;
113110
bdgpio->gpio.can_sleep = true;
114111
bdgpio->gpio.get = bd71828_gpio_get;
115-
bdgpio->gpio.set = bd71828_gpio_set;
112+
bdgpio->gpio.set_rv = bd71828_gpio_set;
116113
bdgpio->gpio.base = -1;
117114

118115
/*

0 commit comments

Comments
 (0)