rtlwifi: rtl8192de: Style clean-ups
[ Upstream commit 69831173fcbbfebb7aa2d76523deaf0b87b8eddd ] Clean up some style issues: - Use ARRAY_SIZE() even though it's a u8 array. - Remove redundant CHANNEL_MAX_NUMBER_2G define. Additionally fix some dead code WARNs. Acked-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://lore.kernel.org/lkml/57d0d1b6064342309f680f692192556c@realtek.com/ Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20211119192233.1021063-1-keescook@chromium.org Stable-dep-of: de4d4be4fa64 ("wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
77942a0272
commit
33628b6ed3
@@ -892,7 +892,7 @@ static u8 _rtl92c_phy_get_rightchnlplace(u8 chnl)
|
|||||||
u8 place = chnl;
|
u8 place = chnl;
|
||||||
|
|
||||||
if (chnl > 14) {
|
if (chnl > 14) {
|
||||||
for (place = 14; place < sizeof(channel5g); place++) {
|
for (place = 14; place < ARRAY_SIZE(channel5g); place++) {
|
||||||
if (channel5g[place] == chnl) {
|
if (channel5g[place] == chnl) {
|
||||||
place++;
|
place++;
|
||||||
break;
|
break;
|
||||||
@@ -1359,7 +1359,7 @@ u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl)
|
|||||||
u8 place = chnl;
|
u8 place = chnl;
|
||||||
|
|
||||||
if (chnl > 14) {
|
if (chnl > 14) {
|
||||||
for (place = 14; place < sizeof(channel_all); place++) {
|
for (place = 14; place < ARRAY_SIZE(channel_all); place++) {
|
||||||
if (channel_all[place] == chnl)
|
if (channel_all[place] == chnl)
|
||||||
return place - 13;
|
return place - 13;
|
||||||
}
|
}
|
||||||
@@ -2417,7 +2417,7 @@ static bool _rtl92d_is_legal_5g_channel(struct ieee80211_hw *hw, u8 channel)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(channel5g); i++)
|
for (i = 0; i < ARRAY_SIZE(channel5g); i++)
|
||||||
if (channel == channel5g[i])
|
if (channel == channel5g[i])
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -2681,9 +2681,8 @@ void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw)
|
|||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD,
|
rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD,
|
||||||
"settings regs %d default regs %d\n",
|
"settings regs %zu default regs %d\n",
|
||||||
(int)(sizeof(rtlphy->iqk_matrix) /
|
ARRAY_SIZE(rtlphy->iqk_matrix),
|
||||||
sizeof(struct iqk_matrix_regs)),
|
|
||||||
IQK_MATRIX_REG_NUM);
|
IQK_MATRIX_REG_NUM);
|
||||||
/* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */
|
/* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */
|
||||||
for (i = 0; i < IQK_MATRIX_SETTINGS_NUM; i++) {
|
for (i = 0; i < IQK_MATRIX_SETTINGS_NUM; i++) {
|
||||||
@@ -2850,16 +2849,14 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
|
|||||||
case BAND_ON_5G:
|
case BAND_ON_5G:
|
||||||
/* Get first channel error when change between
|
/* Get first channel error when change between
|
||||||
* 5G and 2.4G band. */
|
* 5G and 2.4G band. */
|
||||||
if (channel <= 14)
|
if (WARN_ONCE(channel <= 14, "rtl8192de: 5G but channel<=14\n"))
|
||||||
return 0;
|
return 0;
|
||||||
WARN_ONCE((channel <= 14), "rtl8192de: 5G but channel<=14\n");
|
|
||||||
break;
|
break;
|
||||||
case BAND_ON_2_4G:
|
case BAND_ON_2_4G:
|
||||||
/* Get first channel error when change between
|
/* Get first channel error when change between
|
||||||
* 5G and 2.4G band. */
|
* 5G and 2.4G band. */
|
||||||
if (channel > 14)
|
if (WARN_ONCE(channel > 14, "rtl8192de: 2G but channel>14\n"))
|
||||||
return 0;
|
return 0;
|
||||||
WARN_ONCE((channel > 14), "rtl8192de: 2G but channel>14\n");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN_ONCE(true, "rtl8192de: Invalid WirelessMode(%#x)!!\n",
|
WARN_ONCE(true, "rtl8192de: Invalid WirelessMode(%#x)!!\n",
|
||||||
|
@@ -108,7 +108,6 @@
|
|||||||
#define CHANNEL_GROUP_IDX_5GM 6
|
#define CHANNEL_GROUP_IDX_5GM 6
|
||||||
#define CHANNEL_GROUP_IDX_5GH 9
|
#define CHANNEL_GROUP_IDX_5GH 9
|
||||||
#define CHANNEL_GROUP_MAX_5G 9
|
#define CHANNEL_GROUP_MAX_5G 9
|
||||||
#define CHANNEL_MAX_NUMBER_2G 14
|
|
||||||
#define AVG_THERMAL_NUM 8
|
#define AVG_THERMAL_NUM 8
|
||||||
#define AVG_THERMAL_NUM_88E 4
|
#define AVG_THERMAL_NUM_88E 4
|
||||||
#define AVG_THERMAL_NUM_8723BE 4
|
#define AVG_THERMAL_NUM_8723BE 4
|
||||||
|
Reference in New Issue
Block a user