gpiolib: Make use of assign_bit() API (part 2)
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 18 May 2021 08:46:19 +0000 (11:46 +0300)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 21 May 2021 12:53:35 +0000 (14:53 +0200)
We have for some time the assign_bit() API to replace open coded

if (foo)
set_bit(n, bar);
else
clear_bit(n, bar);

Use this API in GPIO library code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpiolib-sysfs.c

index ae49bb23c6ed1eb0dbfa311b64ff1f500f1ab12f..ae7acd6a4f2845de825db5600acef607d255581b 100644 (file)
@@ -312,10 +312,7 @@ static int gpio_sysfs_set_active_low(struct device *dev, int value)
        if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value)
                return 0;
 
-       if (value)
-               set_bit(FLAG_ACTIVE_LOW, &desc->flags);
-       else
-               clear_bit(FLAG_ACTIVE_LOW, &desc->flags);
+       assign_bit(FLAG_ACTIVE_LOW, &desc->flags, value);
 
        /* reconfigure poll(2) support if enabled on one edge only */
        if (flags == GPIO_IRQF_TRIGGER_FALLING ||