[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220926023750.21183-1-chunfeng.yun@mediatek.com>
Date: Mon, 26 Sep 2022 10:37:50 +0800
From: Chunfeng Yun <chunfeng.yun@...iatek.com>
To: Vinod Koul <vkoul@...nel.org>
CC: Chunfeng Yun <chunfeng.yun@...iatek.com>,
Kishon Vijay Abraham I <kishon@...com>,
Matthias Brugger <matthias.bgg@...il.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-phy@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
Eddie Hung <eddie.hung@...iatek.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH next] 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@...el.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
---
drivers/phy/mediatek/phy-mtk-io.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/mediatek/phy-mtk-io.h b/drivers/phy/mediatek/phy-mtk-io.h
index 9e9c6f221c92..d20ad5e5be81 100644
--- a/drivers/phy/mediatek/phy-mtk-io.h
+++ b/drivers/phy/mediatek/phy-mtk-io.h
@@ -37,9 +37,10 @@ static inline void mtk_phy_update_bits(void __iomem *reg, u32 mask, u32 val)
}
/* field @mask shall 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));
-}
+#define mtk_phy_update_field(reg, mask, val) \
+({ \
+ typeof(mask) mask_ = (mask); \
+ mtk_phy_update_bits(reg, mask_, FIELD_PREP(mask_, val)); \
+})
#endif
--
2.18.0
Powered by blists - more mailing lists