Skip to content

Commit 8657c6e

Browse files
Bartosz GolaszewskiLinus Walleij
authored andcommitted
pinctrl: stmfx: 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. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com> Link: https://lore.kernel.org/20250424-gpiochip-set-rv-pinctrl-part2-v1-3-504f91120b99@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent fa10247 commit 8657c6e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

drivers/pinctrl/pinctrl-stmfx.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ static int stmfx_gpio_get(struct gpio_chip *gc, unsigned int offset)
115115
return ret ? ret : !!(value & mask);
116116
}
117117

118-
static void stmfx_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
118+
static int stmfx_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
119119
{
120120
struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
121121
u32 reg = value ? STMFX_REG_GPO_SET : STMFX_REG_GPO_CLR;
122122
u32 mask = get_mask(offset);
123123

124-
regmap_write_bits(pctl->stmfx->map, reg + get_reg(offset),
125-
mask, mask);
124+
return regmap_write_bits(pctl->stmfx->map, reg + get_reg(offset),
125+
mask, mask);
126126
}
127127

128128
static int stmfx_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
@@ -161,8 +161,11 @@ static int stmfx_gpio_direction_output(struct gpio_chip *gc,
161161
struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
162162
u32 reg = STMFX_REG_GPIO_DIR + get_reg(offset);
163163
u32 mask = get_mask(offset);
164+
int ret;
164165

165-
stmfx_gpio_set(gc, offset, value);
166+
ret = stmfx_gpio_set(gc, offset, value);
167+
if (ret)
168+
return ret;
166169

167170
return regmap_write_bits(pctl->stmfx->map, reg, mask, mask);
168171
}
@@ -694,7 +697,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
694697
pctl->gpio_chip.direction_input = stmfx_gpio_direction_input;
695698
pctl->gpio_chip.direction_output = stmfx_gpio_direction_output;
696699
pctl->gpio_chip.get = stmfx_gpio_get;
697-
pctl->gpio_chip.set = stmfx_gpio_set;
700+
pctl->gpio_chip.set_rv = stmfx_gpio_set;
698701
pctl->gpio_chip.set_config = gpiochip_generic_config;
699702
pctl->gpio_chip.base = -1;
700703
pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;

0 commit comments

Comments
 (0)