diff options
author | Nicolas Frattaroli <nicolas.frattaroli@collabora.com> | 2025-08-25 10:28:36 +0200 |
---|---|---|
committer | Yury Norov <yury.norov@gmail.com> | 2025-09-02 20:06:47 -0400 |
commit | eb0bf4f097c3b9236de1ad7a313f171ce501313a (patch) | |
tree | 7e59edd86c982fed008e8804e322a9291c4e44b9 /rust/helpers/bitops.c | |
parent | a785472bb0c2af5bd713c9f2d7cf45657cb3e7bf (diff) |
PCI: rockchip: Switch to FIELD_PREP_WM16* macros
The era of hand-rolled HIWORD_UPDATE macros is over, at least for those
drivers that use constant masks.
The Rockchip PCI driver, like many other Rockchip drivers, has its very
own definition of HIWORD_UPDATE.
Remove it, and replace its usage with either FIELD_PREP_WM16, or two new
header local macros for setting/clearing a bit with the high mask, which
use FIELD_PREP_WM16_CONST internally. In the process, ENCODE_LANES
needed to be adjusted, as FIELD_PREP_WM16* shifts the value for us.
That this is equivalent was verified by first making all FIELD_PREP_WM16
instances FIELD_PREP_WM16_CONST, then doing a static_assert() comparing
it to the old macro (and for those with parameters, static_asserting for
the full range of possible values with the old encode macro).
What we get out of this is compile time error checking to make sure the
value actually fits in the mask, and that the mask fits in the register,
and also generally less icky code that writes shifted values when it
actually just meant to set and clear a handful of bits.
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Diffstat (limited to 'rust/helpers/bitops.c')
0 files changed, 0 insertions, 0 deletions