Re: [RFC PATCH 2/2] treewide, bits: use ffs_val() where it is open-coded

From: Yury Norov

Date: Fri Jan 09 2026 - 15:19:18 EST


On Fri, Jan 09, 2026 at 08:32:50PM +0100, Petr Tesarik wrote:
> On Fri, 9 Jan 2026 13:19:25 -0500
> Yury Norov <ynorov@xxxxxxxxxx> wrote:
>
> >[...]
> > --
> >
> > OK, let me stop here.
> >
> > Can you please instead of mechanical rework check each case
> > individually and find the best replacement to highlight the intention?
> >
> > Can you also split this patch to a series according to subsystems, so
> > that corresponding maintainers will have better access to their changes?
>
> Well, then it makes more sense to start by identifying the intention in
> every place and getting them fixed one by one. Whatever remains should
> be converted to use the new macro.
>
> In fact, I can do both in parallel, converting the places where the
> result of ffs() is immediately used as a shift count.
>
> Then no tree-wide change is necessary, as long as we can first get the
> helper (under whichever name) into bitops.h. But it will be rejected
> without an in-tree user. I somehow feel caught by Catch XXII.
>
> Advice welcome. Non-ironically.

Build your series like this:

1. Switch all 'a & -a' chunks to the existing helpers where possible;
2. Introduce the new macro;
3. Convert the rest of the codebase to using the macro;

In cover-letter mention that patches from #1 may be taken individually
or together with the rest of the series at maintainers' discretion, and
#2 and 3 must be merged at once, for example with my branch.

Then depending on feedback, I'll take your series as is, or will take
only explicitly acked patches. In 2nd case, I will ask you to resend
non-acked part for better visibility, and then decide either take it
or drop.

Thanks,
Yury