On Fri, 2024-02-09 at 08:50 +0800, kernel test robot wrote: > > > > > drivers/net/wireless/realtek/rtw89/phy.c:1047:7: warning: cast to smaller integer type 'enum > > > rtw89_phy_idx' from 'void *' [-Wvoid-pointer-to-enum-cast] > 1047 | if ((enum rtw89_phy_idx)extra_data == RTW89_PHY_1) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. > > > vim +1047 drivers/net/wireless/realtek/rtw89/phy.c > > 1022 > 1023 static void rtw89_phy_config_bb_reg(struct rtw89_dev *rtwdev, > 1024 const struct rtw89_reg2_def *reg, > 1025 enum rtw89_rf_path rf_path, > 1026 void *extra_data) > 1027 { > 1028 u32 addr; > 1029 > 1030 if (reg->addr == 0xfe) { > 1031 mdelay(50); > 1032 } else if (reg->addr == 0xfd) { > 1033 mdelay(5); > 1034 } else if (reg->addr == 0xfc) { > 1035 mdelay(1); > 1036 } else if (reg->addr == 0xfb) { > 1037 udelay(50); > 1038 } else if (reg->addr == 0xfa) { > 1039 udelay(5); > 1040 } else if (reg->addr == 0xf9) { > 1041 udelay(1); > 1042 } else if (reg->data == BYPASS_CR_DATA) { > 1043 rtw89_debug(rtwdev, RTW89_DBG_PHY_TRACK, "Bypass CR 0x%x\n", reg->addr); > 1044 } else { > 1045 addr = reg->addr; > 1046 > > 1047 if ((enum rtw89_phy_idx)extra_data == RTW89_PHY_1) > 1048 addr += rtw89_phy0_phy1_offset(rtwdev, reg->addr); > 1049 > 1050 rtw89_phy_write32(rtwdev, addr, reg->data); > 1051 } > 1052 } > This function is one of callback function of 'config' argument of rtw89_phy_init_reg(). static void rtw89_phy_init_reg(struct rtw89_dev *rtwdev, const struct rtw89_phy_table *table, void (*config)(struct rtw89_dev *rtwdev, const struct rtw89_reg2_def *reg, enum rtw89_rf_path rf_path, void *data), void *extra_data) The 'void *extra_data' is explained by callback function 'config', and there are many existing callback functions. To simply suppress this warning , I plan to cast 'extra_data' from 'void *' by 'uintptr_t' to avoid clang warning, and gcc can also accept this. I did this by v2. Ping-Ke