Re: [PATCH v2 2/3] lib/find_bit: create find_first_zero_bit_le()
From: Andy Shevchenko
Date: Wed Aug 24 2022 - 05:23:15 EST
On Wed, Aug 24, 2022 at 5:17 AM Yury Norov <yury.norov@xxxxxxxxx> wrote:
>
> find_first_zero_bit_le() is an alias to find_next_zero_bit_le(),
> despite that 'next' is known to be slower than the 'first' version.
>
> Now that we have a common FIND_FIRST_BIT() macro helper, it's trivial
> to implement find_first_zero_bit_le() as a real function.
>
> Moving find_*_le() to a separate file helps to fit the FIND_FIRST_BIT()
> to the _le needs by wiring word_op to swab.
>
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
> ---
> Like other find_*_le() functions, the new one takes void *addr, instead
> of unsigned long *. This should be fixed for all in a separate series.
>From this comment it is unclear to me why we can't fix them first and
then apply this with the correct type?
...
> +#define word_op swab
> +#include "find_bit.h"
Looking at this, I would rather always require to define __ffs_word_op
(or whatever name) in the user and replace #ifndef in the find_bit.h
with
#error "The __ffs_word_op must be defined before including find_bit.h!"
--
With Best Regards,
Andy Shevchenko