Skip to content

Commit 2eb5dc9

Browse files
author
Bartosz Golaszewski
committed
gpio: da9055: 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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 489c19c commit 2eb5dc9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/gpio/gpio-da9055.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ static int da9055_gpio_get(struct gpio_chip *gc, unsigned offset)
5959

6060
}
6161

62-
static void da9055_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
62+
static int da9055_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
6363
{
6464
struct da9055_gpio *gpio = gpiochip_get_data(gc);
6565

66-
da9055_reg_update(gpio->da9055,
67-
DA9055_REG_GPIO_MODE0_2,
68-
1 << offset,
69-
value << offset);
66+
return da9055_reg_update(gpio->da9055, DA9055_REG_GPIO_MODE0_2,
67+
1 << offset, value << offset);
7068
}
7169

7270
static int da9055_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
@@ -102,9 +100,7 @@ static int da9055_gpio_direction_output(struct gpio_chip *gc,
102100
if (ret < 0)
103101
return ret;
104102

105-
da9055_gpio_set(gc, offset, value);
106-
107-
return 0;
103+
return da9055_gpio_set(gc, offset, value);
108104
}
109105

110106
static int da9055_gpio_to_irq(struct gpio_chip *gc, u32 offset)
@@ -120,7 +116,7 @@ static const struct gpio_chip reference_gp = {
120116
.label = "da9055-gpio",
121117
.owner = THIS_MODULE,
122118
.get = da9055_gpio_get,
123-
.set = da9055_gpio_set,
119+
.set_rv = da9055_gpio_set,
124120
.direction_input = da9055_gpio_direction_input,
125121
.direction_output = da9055_gpio_direction_output,
126122
.to_irq = da9055_gpio_to_irq,

0 commit comments

Comments
 (0)