]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpio: 74x164: Make use of the macros from bits.h
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 7 Feb 2025 15:17:11 +0000 (17:17 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 11 Feb 2025 08:40:03 +0000 (09:40 +0100)
Make use of BIT() and GENMASK() where it makes sense.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250207151825.2122419-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-74x164.c

index 7844f8a5883471ac181352e5ad1ef25fbaa76b41..0f720d539fa75651d1f5fbacd1be4ebff1e98b21 100644 (file)
@@ -47,7 +47,7 @@ static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset)
 
        guard(mutex)(&chip->lock);
 
-       return (chip->buffer[bank] >> pin) & 0x1;
+       return !!(chip->buffer[bank] & BIT(pin));
 }
 
 static void gen_74x164_set_value(struct gpio_chip *gc,
@@ -60,9 +60,9 @@ static void gen_74x164_set_value(struct gpio_chip *gc,
        guard(mutex)(&chip->lock);
 
        if (val)
-               chip->buffer[bank] |= (1 << pin);
+               chip->buffer[bank] |= BIT(pin);
        else
-               chip->buffer[bank] &= ~(1 << pin);
+               chip->buffer[bank] &= ~BIT(pin);
 
        __gen_74x164_write_config(chip);
 }