On Mon, Aug 25, 2025 at 10:28:20AM +0200, Nicolas Frattaroli wrote:
> This series was spawned by [1], where I was asked to move every instance
> of HIWORD_UPDATE et al that I could find to a common macro in the same
> series that I am introducing said common macro.
>
> The first patch of the series introduces a new header file,
> hw_bitfield.h, which contains two new macros: FIELD_PREP_WM16 and
> FIELD_PREP_WM16_CONST. The latter can be used in initializers.
>
> I've cheekily added the hw_bitfield.h header to the BITMAP API section
> of the MAINTAINERS file.
>
> This macro definition checks that the mask fits, and that the value fits
> in the mask. Like FIELD_PREP, it also shifts the value up to the mask,
> so turning off a bit does not require using the mask as a value. Masks
> are also required to be contiguous, like with FIELD_PREP.
>
> For each definition of such a macro, the driver(s) that used it were
> evaluated for three different treatments:
> - full conversion to the new macro, for cases where replacing the
> implementation of the old macro wouldn't have worked, or where the
> conversion was trivial. These are the most complex patches in this
> series, as they sometimes have to pull apart definitions of masks
> and values due to the new semantics, which require a contiguous
> mask and shift the value for us.
> - replacing the implementation of the old macro with an instance of the
> new macro, done where I felt it made the patch much easier to review
> because I didn't want to drop a big diff on people.
> - skipping conversion entirely, usually because the mask is
> non-constant and it's not trivial to make it constant. Sometimes an
> added complication is that said non-constant mask is either used in a
> path where runtime overhead may not be desirable, or in an
> initializer.
Applied in bitmap-for-next for testing.
Thanks,
Yury
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]