]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pinctrl: samsung: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 24 Apr 2025 08:35:35 +0000 (10:35 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 29 Apr 2025 08:34:46 +0000 (10:34 +0200)
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>
Link: https://lore.kernel.org/20250424-gpiochip-set-rv-pinctrl-part2-v1-12-504f91120b99@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/samsung/pinctrl-samsung.c

index 2896eb2de2c098c72adc4de5c9d72bb2b7e46bdb..f5d617e7070683655947c93ef4cd3f0b9e3a11ce 100644 (file)
@@ -570,15 +570,18 @@ static void samsung_gpio_set_value(struct gpio_chip *gc,
 }
 
 /* gpiolib gpio_set callback function */
-static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
+static int samsung_gpio_set(struct gpio_chip *gc, unsigned int offset,
+                           int value)
 {
        struct samsung_pin_bank *bank = gpiochip_get_data(gc);
        struct samsung_pinctrl_drv_data *drvdata = bank->drvdata;
        unsigned long flags;
+       int ret;
 
-       if (clk_enable(drvdata->pclk)) {
+       ret = clk_enable(drvdata->pclk);
+       if (ret) {
                dev_err(drvdata->dev, "failed to enable clock\n");
-               return;
+               return ret;
        }
 
        raw_spin_lock_irqsave(&bank->slock, flags);
@@ -586,6 +589,8 @@ static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
        raw_spin_unlock_irqrestore(&bank->slock, flags);
 
        clk_disable(drvdata->pclk);
+
+       return 0;
 }
 
 /* gpiolib gpio_get callback function */
@@ -1062,7 +1067,7 @@ static int samsung_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 static const struct gpio_chip samsung_gpiolib_chip = {
        .request = gpiochip_generic_request,
        .free = gpiochip_generic_free,
-       .set = samsung_gpio_set,
+       .set_rv = samsung_gpio_set,
        .get = samsung_gpio_get,
        .direction_input = samsung_gpio_direction_input,
        .direction_output = samsung_gpio_direction_output,