Am Montag, 25. August 2025, 10:28:27 Mitteleuropäische Sommerzeit schrieb Nicolas Frattaroli: > The era of hand-rolled HIWORD_UPDATE macros is over, at least for those > drivers that use constant masks. > > Remove this driver's HIWORD_UPDATE macro, and replace instances of it > with either FIELD_PREP_WM16 or FIELD_PREP_WM16_CONST, depending on > whether they're in an initializer. This gives us better error checking, > which already saved me some trouble during this refactor. > > The driver's HIWORD_UPDATE macro doesn't shift up the value, but expects > a pre-shifted value. Meanwhile, FIELD_PREP_WM16 and > FIELD_PREP_WM16_CONST will shift the value for us, based on the given > mask. So a few things that used to be a HIWORD_UPDATE(VERY_LONG_FOO, > VERY_LONG_FOO) are now a somewhat more pleasant > FIELD_PREP_WM16(VERY_LONG_FOO, 1). > > There are some non-trivial refactors here. A few literals needed a UL > suffix added to stop them from unintentionally overflowing as a signed > long. To make sure all of these cases are caught, and not just the ones > where the FIELD_PREP_WM16* macros use such a value as a mask, just mark > every literal that's used as a mask as unsigned. > > Non-contiguous masks also have to be split into multiple > FIELD_PREP_WM16* instances, as the macro's checks and shifting logic > rely on contiguous masks. > > This is compile-tested only. > > Signed-off-by: Nicolas Frattaroli <nicolas.frattar...@collabora.com>
Reviewed-by: Heiko Stuebner <he...@sntech.de>