]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
gpio: bd71815: use new line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 10 Mar 2025 12:40:17 +0000 (13:40 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 17 Mar 2025 07:27:41 +0000 (08:27 +0100)
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/20250310-gpiochip-set-conversion-v1-3-03798bb833eb@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-bd71815.c

index 08ff2857256f1d14d46793ee397e63f639a097bd..36701500925e47f3988c604a674ecbc2ca859ada 100644 (file)
@@ -37,21 +37,18 @@ static int bd71815gpo_get(struct gpio_chip *chip, unsigned int offset)
        return (val >> offset) & 1;
 }
 
-static void bd71815gpo_set(struct gpio_chip *chip, unsigned int offset,
-                          int value)
+static int bd71815gpo_set(struct gpio_chip *chip, unsigned int offset,
+                         int value)
 {
        struct bd71815_gpio *bd71815 = gpiochip_get_data(chip);
-       int ret, bit;
+       int bit;
 
        bit = BIT(offset);
 
        if (value)
-               ret = regmap_set_bits(bd71815->regmap, BD71815_REG_GPO, bit);
-       else
-               ret = regmap_clear_bits(bd71815->regmap, BD71815_REG_GPO, bit);
+               return regmap_set_bits(bd71815->regmap, BD71815_REG_GPO, bit);
 
-       if (ret)
-               dev_warn(bd71815->dev, "failed to toggle GPO\n");
+       return regmap_clear_bits(bd71815->regmap, BD71815_REG_GPO, bit);
 }
 
 static int bd71815_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
@@ -88,7 +85,7 @@ static const struct gpio_chip bd71815gpo_chip = {
        .owner                  = THIS_MODULE,
        .get                    = bd71815gpo_get,
        .get_direction          = bd71815gpo_direction_get,
-       .set                    = bd71815gpo_set,
+       .set_rv                 = bd71815gpo_set,
        .set_config             = bd71815_gpio_set_config,
        .can_sleep              = true,
 };