]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
gpio: max3191x: use gpiod_multi_set_value_cansleep
authorDavid Lechner <dlechner@baylibre.com>
Mon, 10 Feb 2025 22:33:32 +0000 (16:33 -0600)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 12 Feb 2025 09:36:40 +0000 (10:36 +0100)
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value_cansleep().

Also add max3191x_ namespace prefix to the driver's helper function
since we are changing the function signature anyway.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250210-gpio-set-array-helper-v3-6-d6a673674da8@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-max3191x.c

index bbacc714632b70e672a3d8494636fbc40dfea8ec..fc0708ab5192bd518bb0e6362f737bacbd549d61 100644 (file)
@@ -309,23 +309,21 @@ static int max3191x_set_config(struct gpio_chip *gpio, unsigned int offset,
        return 0;
 }
 
-static void gpiod_set_array_single_value_cansleep(unsigned int ndescs,
-                                                 struct gpio_desc **desc,
-                                                 struct gpio_array *info,
+static void max3191x_gpiod_multi_set_single_value(struct gpio_descs *descs,
                                                  int value)
 {
        unsigned long *values;
 
-       values = bitmap_alloc(ndescs, GFP_KERNEL);
+       values = bitmap_alloc(descs->ndescs, GFP_KERNEL);
        if (!values)
                return;
 
        if (value)
-               bitmap_fill(values, ndescs);
+               bitmap_fill(values, descs->ndescs);
        else
-               bitmap_zero(values, ndescs);
+               bitmap_zero(values, descs->ndescs);
 
-       gpiod_set_array_value_cansleep(ndescs, desc, info, values);
+       gpiod_multi_set_value_cansleep(descs, values);
        bitmap_free(values);
 }
 
@@ -396,10 +394,8 @@ static int max3191x_probe(struct spi_device *spi)
        max3191x->mode = device_property_read_bool(dev, "maxim,modesel-8bit")
                                 ? STATUS_BYTE_DISABLED : STATUS_BYTE_ENABLED;
        if (max3191x->modesel_pins)
-               gpiod_set_array_single_value_cansleep(
-                                max3191x->modesel_pins->ndescs,
-                                max3191x->modesel_pins->desc,
-                                max3191x->modesel_pins->info, max3191x->mode);
+               max3191x_gpiod_multi_set_single_value(max3191x->modesel_pins,
+                                                     max3191x->mode);
 
        max3191x->ignore_uv = device_property_read_bool(dev,
                                                  "maxim,ignore-undervoltage");