Skip to content

Commit 76e242c

Browse files
Dilip Kotavinodkoul
authored andcommitted
phy: intel: Fix compilation error on FIELD_PREP usage
FIELD_PREP expects constant arguments. Istead of doing FIELD_PREP operation on the arguments of combo_phy_w32_off_mask(), pass the final FIELD_PREP value as an argument. Error reported as: In file included from include/linux/build_bug.h:5, from include/linux/bitfield.h:10, from drivers/phy/intel/phy-intel-combo.c:8: drivers/phy/intel/phy-intel-combo.c: In function 'combo_phy_w32_off_mask': include/linux/bitfield.h:52:28: warning: comparison is always false due to limited range of data type [-Wtype-limits] include/linux/compiler.h:350:38: error: call to '__compiletime_assert_37' declared with attribute error: FIELD_PREP: mask is not constant 94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); | ^~~~~~~~~~~~~~~~ drivers/phy/intel/phy-intel-combo.c:137:13: note: in expansion of macro 'FIELD_PREP' 137 | reg_val |= FIELD_PREP(mask, val); | ^~~~~~~~~~ ../include/linux/compiler.h:392:38: error: call to__compiletime_assert_137 declared with attribute error: BUILD_BUG_ON failed: (((mask) + (1ULL << (__builtin_ffsll(mask) - 1))) & (((mask) + (1ULL << (__builtin_ffsll(mask) - 1))) - 1)) != 0 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ../include/linux/bitfield.h:94:3: note: in expansion of macro __BF_FIELD_CHECK __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ^~~~~~~~~~~~~~~~ ../drivers/phy/intel/phy-intel-combo.c:137:13: note: in expansion of macro FIELD_PREP reg_val |= FIELD_PREP(mask, val); ^~~~~~~~~~ Fixes: ac0a95a ("phy: intel: Add driver support for ComboPhy") Reported-by: kbuild test robot <[email protected]> Reported-by: Randy Dunlap <[email protected]> Signed-off-by: Dilip Kota <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Link: https://lore.kernel.org/r/8a309dd3c238efbaa59d1649704255d6f8b6c9c5.1590575358.git.eswara.kota@linux.intel.com Signed-off-by: Vinod Koul <[email protected]>
1 parent b3a9e3b commit 76e242c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/phy/intel/phy-intel-combo.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static inline void combo_phy_w32_off_mask(void __iomem *base, unsigned int reg,
134134

135135
reg_val = readl(base + reg);
136136
reg_val &= ~mask;
137-
reg_val |= FIELD_PREP(mask, val);
137+
reg_val |= val;
138138
writel(reg_val, base + reg);
139139
}
140140

@@ -169,7 +169,7 @@ static int intel_cbphy_pcie_en_pad_refclk(struct intel_cbphy_iphy *iphy)
169169
return 0;
170170

171171
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
172-
PCIE_PHY_CLK_PAD, 0);
172+
PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 0));
173173

174174
/* Delay for stable clock PLL */
175175
usleep_range(50, 100);
@@ -192,7 +192,7 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy)
192192
return 0;
193193

194194
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
195-
PCIE_PHY_CLK_PAD, 1);
195+
PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 1));
196196

197197
return 0;
198198
}
@@ -385,7 +385,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
385385

386386
/* trigger auto RX adaptation */
387387
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
388-
ADAPT_REQ_MSK, 3);
388+
ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 3));
389389
/* Wait RX adaptation to finish */
390390
ret = readl_poll_timeout(cr_base + CR_ADDR(PCS_XF_RX_ADAPT_ACK, id),
391391
val, val & RX_ADAPT_ACK_BIT, 10, 5000);
@@ -396,7 +396,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
396396

397397
/* Stop RX adaptation */
398398
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
399-
ADAPT_REQ_MSK, 0);
399+
ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 0));
400400

401401
return ret;
402402
}

0 commit comments

Comments
 (0)