gpiolib: Deduplicate find_first_zero_bit() call
PATCH 1/1 gpiolib: Deduplicate find_first_zero_bit() call
bitmap_full() is a shortcut to find_first_zero_bit(). Thus, no need to call it twice.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/gpio/gpiolib.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpio/gpiolib.c +4 -6
@@ -2594,10 +2594,9 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,bitmap_xor (value_bitmap, value_bitmap, array_info->invert_mask, array_size); -if (bitmap_full (array_info->get_mask, array_size)) -return 0 ; - i =find_first_zero_bit (array_info->get_mask, array_size); +if (i == array_size) +return 0 ; }else { array_info =NULL ; }
@@ -2878,10 +2877,9 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,gpio_chip_set_multiple (array_info->chip, array_info->set_mask, value_bitmap); -if (bitmap_full (array_info->set_mask, array_size)) -return 0 ; - i =find_first_zero_bit (array_info->set_mask, array_size); +if (i == array_size) +return 0 ; }else { array_info =NULL ; }
Signature · 1 line
2.27.0
Bartosz Golaszewski
AppliedQuoted 5 lines · Andy Shevchenko
bitmap_full()is a shortcut tofind_first_zero_bit(). Thus, no need to call it twice.Signed-off-by Andy Shevchenko <[email protected]>
Applied, thanks!
Bartosz