Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: rockchip-samsung-dcphy: 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.

phy-rockchip-samsung-dcphy is actually an exemplary example, where the
similarities to FIELD_PREP were spotted and the driver local macro has
the same semantics as the new FIELD_PREP_WM16 hw_bitfield.h macro.

Still, get rid of FIELD_PREP_HIWORD now that a shared implementation
exists, replacing the two instances of it with FIELD_PREP_WM16. This
gives us slightly better error checking; the value is now checked to fit
in 16 bits.

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>

authored by

Nicolas Frattaroli and committed by
Yury Norov
d6de45fd 9040ecd0

+3 -8
+3 -8
drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
··· 8 8 #include <dt-bindings/phy/phy.h> 9 9 #include <linux/bitfield.h> 10 10 #include <linux/clk.h> 11 + #include <linux/hw_bitfield.h> 11 12 #include <linux/init.h> 12 13 #include <linux/kernel.h> 13 14 #include <linux/mfd/syscon.h> ··· 20 19 #include <linux/pm_runtime.h> 21 20 #include <linux/regmap.h> 22 21 #include <linux/reset.h> 23 - 24 - #define FIELD_PREP_HIWORD(_mask, _val) \ 25 - ( \ 26 - FIELD_PREP((_mask), (_val)) | \ 27 - ((_mask) << 16) \ 28 - ) 29 22 30 23 #define BIAS_CON0 0x0000 31 24 #define I_RES_CNTL_MASK GENMASK(6, 4) ··· 247 252 248 253 /* MIPI_CDPHY_GRF registers */ 249 254 #define MIPI_DCPHY_GRF_CON0 0x0000 250 - #define S_CPHY_MODE FIELD_PREP_HIWORD(BIT(3), 1) 251 - #define M_CPHY_MODE FIELD_PREP_HIWORD(BIT(0), 1) 255 + #define S_CPHY_MODE FIELD_PREP_WM16(BIT(3), 1) 256 + #define M_CPHY_MODE FIELD_PREP_WM16(BIT(0), 1) 252 257 253 258 enum hs_drv_res_ohm { 254 259 STRENGTH_30_OHM = 0x8,