]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7606: use gpiod_multi_set_value_cansleep
authorDavid Lechner <dlechner@baylibre.com>
Mon, 10 Feb 2025 22:33:33 +0000 (16:33 -0600)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Feb 2025 13:20:36 +0000 (13:20 +0000)
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value().

These are not called in an atomic context, so changing to the cansleep
variant is fine.

Also drop unnecessary braces while we are at it.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-7-d6a673674da8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7606.c

index 1e8b03a518b8b4e61611314791ba5f82655befe8..87908cc51e4862f86f7789a6e00c19d337c169bb 100644 (file)
@@ -828,8 +828,7 @@ static int ad7606_write_os_hw(struct iio_dev *indio_dev, int val)
 
        values[0] = val & GENMASK(2, 0);
 
-       gpiod_set_array_value(st->gpio_os->ndescs, st->gpio_os->desc,
-                             st->gpio_os->info, values);
+       gpiod_multi_set_value_cansleep(st->gpio_os, values);
 
        /* AD7616 requires a reset to update value */
        if (st->chip_info->os_req_reset)
@@ -1260,10 +1259,9 @@ static int ad7606b_sw_mode_setup(struct iio_dev *indio_dev)
         * in the device tree, then they need to be set to high,
         * otherwise, they must be hardwired to VDD
         */
-       if (st->gpio_os) {
-               gpiod_set_array_value(st->gpio_os->ndescs, st->gpio_os->desc,
-                                     st->gpio_os->info, os);
-       }
+       if (st->gpio_os)
+               gpiod_multi_set_value_cansleep(st->gpio_os, os);
+
        /* OS of 128 and 256 are available only in software mode */
        st->oversampling_avail = ad7606b_oversampling_avail;
        st->num_os_ratios = ARRAY_SIZE(ad7606b_oversampling_avail);