From: Nicolas Frattaroli Date: Mon, 25 Aug 2025 08:28:24 +0000 (+0200) Subject: media: synopsys: hdmirx: replace macros with bitfield variants X-Git-Tag: v6.18-rc1~138^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d5f75a9d413de35c376597ead4174081373644b;p=thirdparty%2Flinux.git media: synopsys: hdmirx: replace macros with bitfield variants The era of hand-rolled HIWORD_UPDATE macros is over, at least for those drivers that use constant masks. Replace the UPDATE macro with bitfield.h's FIELD_PREP, to give us additional error checking. Also, replace the HIWORD_UPDATE macro at the same time with the new FIELD_PREP_WM16 macro in hw_bitfield.h, which also gives us additional error checking. The UPDATE/HIWORD_UPDATE macros are left as wrappers around the replacement macros, in order to not rock the boat too much, and keep the changes easy to review. Yury: drop extra parens around FIELD_PREPs (Dmitry) Signed-off-by: Nicolas Frattaroli Acked-by: Dmitry Osipenko Acked-by: Heiko Stuebner Signed-off-by: Yury Norov (NVIDIA) --- diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h index 220ab99ca6115..b13f58e319448 100644 --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h @@ -8,10 +8,12 @@ #ifndef DW_HDMIRX_H #define DW_HDMIRX_H +#include #include +#include -#define UPDATE(x, h, l) (((x) << (l)) & GENMASK((h), (l))) -#define HIWORD_UPDATE(v, h, l) (((v) << (l)) | (GENMASK((h), (l)) << 16)) +#define UPDATE(x, h, l) FIELD_PREP(GENMASK((h), (l)), (x)) +#define HIWORD_UPDATE(v, h, l) FIELD_PREP_WM16(GENMASK((h), (l)), (v)) /* SYS_GRF */ #define SYS_GRF_SOC_CON1 0x0304