Skip to content

Commit 8f9da44

Browse files
author
Bartosz Golaszewski
committed
gpio: max77620: 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. Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-9-0fbdea5a9667@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 66a6d0e commit 8f9da44

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

drivers/gpio/gpio-max77620.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,17 @@ static int max77620_gpio_set_debounce(struct max77620_gpio *mgpio,
223223
return ret;
224224
}
225225

226-
static void max77620_gpio_set(struct gpio_chip *gc, unsigned int offset,
227-
int value)
226+
static int max77620_gpio_set(struct gpio_chip *gc, unsigned int offset,
227+
int value)
228228
{
229229
struct max77620_gpio *mgpio = gpiochip_get_data(gc);
230230
u8 val;
231-
int ret;
232231

233232
val = (value) ? MAX77620_CNFG_GPIO_OUTPUT_VAL_HIGH :
234233
MAX77620_CNFG_GPIO_OUTPUT_VAL_LOW;
235234

236-
ret = regmap_update_bits(mgpio->rmap, GPIO_REG_ADDR(offset),
237-
MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK, val);
238-
if (ret < 0)
239-
dev_err(mgpio->dev, "CNFG_GPIO_OUT update failed: %d\n", ret);
235+
return regmap_update_bits(mgpio->rmap, GPIO_REG_ADDR(offset),
236+
MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK, val);
240237
}
241238

242239
static int max77620_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
@@ -314,7 +311,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
314311
mgpio->gpio_chip.direction_input = max77620_gpio_dir_input;
315312
mgpio->gpio_chip.get = max77620_gpio_get;
316313
mgpio->gpio_chip.direction_output = max77620_gpio_dir_output;
317-
mgpio->gpio_chip.set = max77620_gpio_set;
314+
mgpio->gpio_chip.set_rv = max77620_gpio_set;
318315
mgpio->gpio_chip.set_config = max77620_gpio_set_config;
319316
mgpio->gpio_chip.ngpio = MAX77620_GPIO_NR;
320317
mgpio->gpio_chip.can_sleep = 1;

0 commit comments

Comments
 (0)