Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: da9052: 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/20250310-gpiochip-set-conversion-v1-14-03798bb833eb@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

+12 -22
+12 -22
drivers/gpio/gpio-da9052.c
··· 89 89 } 90 90 } 91 91 92 - static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 92 + static int da9052_gpio_set(struct gpio_chip *gc, unsigned int offset, int value) 93 93 { 94 94 struct da9052_gpio *gpio = gpiochip_get_data(gc); 95 - int ret; 96 95 97 - if (da9052_gpio_port_odd(offset)) { 98 - ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 99 - DA9052_GPIO_0_1_REG, 100 - DA9052_GPIO_ODD_PORT_MODE, 101 - value << DA9052_GPIO_ODD_SHIFT); 102 - if (ret != 0) 103 - dev_err(gpio->da9052->dev, 104 - "Failed to updated gpio odd reg,%d", 105 - ret); 106 - } else { 107 - ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 108 - DA9052_GPIO_0_1_REG, 109 - DA9052_GPIO_EVEN_PORT_MODE, 110 - value << DA9052_GPIO_EVEN_SHIFT); 111 - if (ret != 0) 112 - dev_err(gpio->da9052->dev, 113 - "Failed to updated gpio even reg,%d", 114 - ret); 115 - } 96 + if (da9052_gpio_port_odd(offset)) 97 + return da9052_reg_update(gpio->da9052, (offset >> 1) + 98 + DA9052_GPIO_0_1_REG, 99 + DA9052_GPIO_ODD_PORT_MODE, 100 + value << DA9052_GPIO_ODD_SHIFT); 101 + 102 + return da9052_reg_update(gpio->da9052, 103 + (offset >> 1) + DA9052_GPIO_0_1_REG, 104 + DA9052_GPIO_EVEN_PORT_MODE, 105 + value << DA9052_GPIO_EVEN_SHIFT); 116 106 } 117 107 118 108 static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset) ··· 172 182 .label = "da9052-gpio", 173 183 .owner = THIS_MODULE, 174 184 .get = da9052_gpio_get, 175 - .set = da9052_gpio_set, 185 + .set_rv = da9052_gpio_set, 176 186 .direction_input = da9052_gpio_direction_input, 177 187 .direction_output = da9052_gpio_direction_output, 178 188 .to_irq = da9052_gpio_to_irq,