diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-02-07 18:17:11 +0300 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-02-11 11:40:03 +0300 |
commit | e742e6b02d858ff9f6a7b43d0b1b5aae9c7e5cf5 (patch) | |
tree | 8d68a9389074dcd3186bf94576f274382e77eba9 | |
parent | d746cc6e64027e331769f871a595a3dd2c6b30ff (diff) | |
download | linux-e742e6b02d858ff9f6a7b43d0b1b5aae9c7e5cf5.tar.xz |
gpio: 74x164: Make use of the macros from bits.h
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>
-rw-r--r-- | drivers/gpio/gpio-74x164.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 7844f8a58834..0f720d539fa7 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -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); } |