]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
phy: rockchip-pcie: switch to FIELD_PREP_WM16 macro
authorNicolas Frattaroli <nicolas.frattaroli@collabora.com>
Mon, 25 Aug 2025 08:28:40 +0000 (10:28 +0200)
committerYury Norov (NVIDIA) <yury.norov@gmail.com>
Mon, 22 Sep 2025 19:52:44 +0000 (15:52 -0400)
commit4688bb13dafbf07c4810c552245b4700e3624018
tree93369efe40b5b7dcffec34e0e9bfef42d17d2d3a
parentb8b567718844da9cf37a843706e60e71b8071645
phy: rockchip-pcie: switch to FIELD_PREP_WM16 macro

The era of hand-rolled HIWORD_UPDATE macros is over, at least for those
drivers that use constant masks.

The Rockchip PCIe PHY driver, used on the RK3399, has its own definition
of HIWORD_UPDATE.

Remove it, and replace instances of it with hw_bitfield.h's
FIELD_PREP_WM16. To achieve this, some mask defines are reshuffled, as
FIELD_PREP_WM16 uses the mask as both the mask of bits to write and to
derive the shift amount from in order to shift the value.

In order to ensure that the mask is always a constant, the inst->index
shift is performed after the FIELD_PREP_WM16, as this is a runtime
value.

>From this, we gain compile-time error checking, and in my humble opinion
nicer code, as well as a single definition of this macro across the
entire codebase to aid in code comprehension.

Tested on a RK3399 ROCKPro64, where PCIe still works as expected when
accessing an NVMe drive.

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>
drivers/phy/rockchip/phy-rockchip-pcie.c