diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2022-09-28 09:07:46 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-09-29 07:42:31 +0200 |
commit | 84513eccd67804c02a0c42017bc7eaa4ad112478 (patch) | |
tree | 7667f7842cd0b64b9b6009aca1998adc4377d55e /drivers/phy | |
parent | phy: qcom-qmp-usb: Use dev_err_probe() to simplify code (diff) | |
download | linux-84513eccd67804c02a0c42017bc7eaa4ad112478.tar.xz linux-84513eccd67804c02a0c42017bc7eaa4ad112478.zip |
phy: mediatek: fix build warning of FIELD_PREP()
Change the inline function mtk_phy_update_field() into a macro to
avoid check warning of FIELD_PREP() with compiler parameter
-Wtautological-constant-out-of-range-compare
the warning is caused by mask check:
"BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \"
Fixes: 29c07477556e ("phy: mediatek: add a new helper to update bitfield")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220928070746.5393-1-chunfeng.yun@mediatek.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/mediatek/phy-mtk-io.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/phy/mediatek/phy-mtk-io.h b/drivers/phy/mediatek/phy-mtk-io.h index a723d4afc9b4..d20ad5e5be81 100644 --- a/drivers/phy/mediatek/phy-mtk-io.h +++ b/drivers/phy/mediatek/phy-mtk-io.h @@ -36,10 +36,11 @@ static inline void mtk_phy_update_bits(void __iomem *reg, u32 mask, u32 val) writel(tmp, reg); } -/* field @mask should be constant and continuous */ -static inline void mtk_phy_update_field(void __iomem *reg, u32 mask, u32 val) -{ - mtk_phy_update_bits(reg, mask, FIELD_PREP(mask, val)); -} +/* field @mask shall be constant and continuous */ +#define mtk_phy_update_field(reg, mask, val) \ +({ \ + typeof(mask) mask_ = (mask); \ + mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \ +}) #endif |