]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: intel: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 10 Jun 2025 12:58:49 +0000 (14:58 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 11 Jun 2025 08:27:30 +0000 (11:27 +0300)
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>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/pinctrl/intel/pinctrl-intel.c

index d889c7c878e2d57eb075f4147a3eb2e2ae05ec5b..846b25ed1cc44cf9549aafc63192c80d8e66a797 100644 (file)
@@ -1033,8 +1033,8 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
        return !!(padcfg0 & PADCFG0_GPIORXSTATE);
 }
 
-static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
-                          int value)
+static int intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                         int value)
 {
        struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
        void __iomem *reg;
@@ -1043,11 +1043,11 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
 
        pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
        if (pin < 0)
-               return;
+               return -EINVAL;
 
        reg = intel_get_padcfg(pctrl, pin, PADCFG0);
        if (!reg)
-               return;
+               return -EINVAL;
 
        guard(raw_spinlock_irqsave)(&pctrl->lock);
 
@@ -1057,6 +1057,8 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
        else
                padcfg0 &= ~PADCFG0_GPIOTXSTATE;
        writel(padcfg0, reg);
+
+       return 0;
 }
 
 static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1094,7 +1096,12 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offse
 static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
                                       int value)
 {
-       intel_gpio_set(chip, offset, value);
+       int ret;
+
+       ret = intel_gpio_set(chip, offset, value);
+       if (ret)
+               return ret;
+
        return pinctrl_gpio_direction_output(chip, offset);
 }
 
@@ -1106,7 +1113,7 @@ static const struct gpio_chip intel_gpio_chip = {
        .direction_input = intel_gpio_direction_input,
        .direction_output = intel_gpio_direction_output,
        .get = intel_gpio_get,
-       .set = intel_gpio_set,
+       .set_rv = intel_gpio_set,
        .set_config = gpiochip_generic_config,
 };