Re: [PATCH v1 1/1] bitmap.h: add const modifier to bitmap_next_[set/clear]_region() argument

From: Andy Shevchenko
Date: Wed Jul 28 2021 - 05:19:26 EST


On Wed, Jul 28, 2021 at 9:39 AM Andrea Merello <andrea.merello@xxxxxxxxx> wrote:
> Il giorno mar 27 lug 2021 alle ore 17:26 Yury Norov
> <yury.norov@xxxxxxxxx> ha scritto:
> > On Tue, Jul 27, 2021 at 02:48:42PM +0300, Andy Shevchenko wrote:

...

> > I try to remove those two because in practice they bring more mess
> > than good. All real use-cases for bitmap_next_{set,clear}_region
> > relate to iterating the whole bitmap, ie nobody just wants to find a
> > next region. Untill recently there was only a single user of the API,
> > so I easily reworked the code to use find_first_bit/find_next bit and
> > by chance return faster.
>
> Ah, that's interesting to know: I'm working on a new driver that used
> find_next_zero_bit() and find_next_bit() [0]; Andy told me that my
> algorithm could be rewritten exploiting some bitmap_* helpers, so I
> rewrote my code using bitmap_for_each_set_region(), which in turn uses
> bitmap_next_set_region().
>
> Should I revert to my previous implementation that uses
> find_next_zero_bit() and find_next_bit() ?

According to the

https://github.com/norov/linux/commit/a2d6e02d19450a49a55f08c151d1f704723bec1a

they are transformed to for_each_bitrange(), etc.

...

> Looks like also bitmap_for_each_set_region() went away indeed ?

See above.

--
With Best Regards,
Andy Shevchenko