Commit 02b6ab0a authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

rtlwifi: rtl8192c-common: rtl8192se: rtl8192de: Simplify if statements

Devendra Naga <devendra.aaru@gmail.com> submitted a patch for rtl8192c_common
to change the tests in _rtl92c_store_pwrIndex_diffrate_offset(). This patch
improves on those changes and applies similar modifications to drivers rtl8192se
and rtl8192de.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b6df7f1d
...@@ -253,121 +253,51 @@ void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, ...@@ -253,121 +253,51 @@ void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_phy *rtlphy = &(rtlpriv->phy);
int index;
if (regaddr == RTXAGC_A_RATE18_06)
index = 0;
else if (regaddr == RTXAGC_A_RATE54_24)
index = 1;
else if (regaddr == RTXAGC_A_CCK1_MCS32)
index = 6;
else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00)
index = 7;
else if (regaddr == RTXAGC_A_MCS03_MCS00)
index = 2;
else if (regaddr == RTXAGC_A_MCS07_MCS04)
index = 3;
else if (regaddr == RTXAGC_A_MCS11_MCS08)
index = 4;
else if (regaddr == RTXAGC_A_MCS15_MCS12)
index = 5;
else if (regaddr == RTXAGC_B_RATE18_06)
index = 8;
else if (regaddr == RTXAGC_B_RATE54_24)
index = 9;
else if (regaddr == RTXAGC_B_CCK1_55_MCS32)
index = 14;
else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff)
index = 15;
else if (regaddr == RTXAGC_B_MCS03_MCS00)
index = 10;
else if (regaddr == RTXAGC_B_MCS07_MCS04)
index = 11;
else if (regaddr == RTXAGC_B_MCS11_MCS08)
index = 12;
else if (regaddr == RTXAGC_B_MCS15_MCS12)
index = 13;
else
return;
if (regaddr == RTXAGC_A_RATE18_06) { rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][index] = data;
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0] = data; RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n",
"MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", rtlphy->pwrgroup_cnt, index,
rtlphy->pwrgroup_cnt, rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][index]);
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0]);
}
if (regaddr == RTXAGC_A_RATE54_24) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1]);
}
if (regaddr == RTXAGC_A_CCK1_MCS32) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6]);
}
if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7]);
}
if (regaddr == RTXAGC_A_MCS03_MCS00) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2]);
}
if (regaddr == RTXAGC_A_MCS07_MCS04) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3]);
}
if (regaddr == RTXAGC_A_MCS11_MCS08) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4]);
}
if (regaddr == RTXAGC_A_MCS15_MCS12) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5]);
}
if (regaddr == RTXAGC_B_RATE18_06) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8]);
}
if (regaddr == RTXAGC_B_RATE54_24) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9]);
}
if (regaddr == RTXAGC_B_CCK1_55_MCS32) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14]);
}
if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15]);
}
if (regaddr == RTXAGC_B_MCS03_MCS00) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10]);
}
if (regaddr == RTXAGC_B_MCS07_MCS04) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11]);
}
if (regaddr == RTXAGC_B_MCS11_MCS08) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12]);
}
if (regaddr == RTXAGC_B_MCS15_MCS12) {
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n",
rtlphy->pwrgroup_cnt,
rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13]);
if (index == 13)
rtlphy->pwrgroup_cnt++; rtlphy->pwrgroup_cnt++;
}
} }
EXPORT_SYMBOL(_rtl92c_store_pwrIndex_diffrate_offset); EXPORT_SYMBOL(_rtl92c_store_pwrIndex_diffrate_offset);
......
...@@ -665,152 +665,51 @@ static void _rtl92d_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw, ...@@ -665,152 +665,51 @@ static void _rtl92d_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_phy *rtlphy = &(rtlpriv->phy);
int index;
if (regaddr == RTXAGC_A_RATE18_06)
index = 0;
else if (regaddr == RTXAGC_A_RATE54_24)
index = 1;
else if (regaddr == RTXAGC_A_CCK1_MCS32)
index = 6;
else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00)
index = 7;
else if (regaddr == RTXAGC_A_MCS03_MCS00)
index = 2;
else if (regaddr == RTXAGC_A_MCS07_MCS04)
index = 3;
else if (regaddr == RTXAGC_A_MCS11_MCS08)
index = 4;
else if (regaddr == RTXAGC_A_MCS15_MCS12)
index = 5;
else if (regaddr == RTXAGC_B_RATE18_06)
index = 8;
else if (regaddr == RTXAGC_B_RATE54_24)
index = 9;
else if (regaddr == RTXAGC_B_CCK1_55_MCS32)
index = 14;
else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff)
index = 15;
else if (regaddr == RTXAGC_B_MCS03_MCS00)
index = 10;
else if (regaddr == RTXAGC_B_MCS07_MCS04)
index = 11;
else if (regaddr == RTXAGC_B_MCS11_MCS08)
index = 12;
else if (regaddr == RTXAGC_B_MCS15_MCS12)
index = 13;
else
return;
if (regaddr == RTXAGC_A_RATE18_06) { rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][index] = data;
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][0] = RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
data; "MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%ulx\n",
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, rtlphy->pwrgroup_cnt, index,
"MCSTxPowerLevelOriginalOffset[%d][0] = 0x%ulx\n", rtlphy->mcs_txpwrlevel_origoffset
rtlphy->pwrgroup_cnt, [rtlphy->pwrgroup_cnt][index]);
rtlphy->mcs_txpwrlevel_origoffset if (index == 13)
[rtlphy->pwrgroup_cnt][0]);
}
if (regaddr == RTXAGC_A_RATE54_24) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][1] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][1] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][1]);
}
if (regaddr == RTXAGC_A_CCK1_MCS32) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][6] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][6] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][6]);
}
if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][7] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][7] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][7]);
}
if (regaddr == RTXAGC_A_MCS03_MCS00) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][2] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][2] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][2]);
}
if (regaddr == RTXAGC_A_MCS07_MCS04) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][3] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][3] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][3]);
}
if (regaddr == RTXAGC_A_MCS11_MCS08) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][4] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][4] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][4]);
}
if (regaddr == RTXAGC_A_MCS15_MCS12) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][5] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][5] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][5]);
}
if (regaddr == RTXAGC_B_RATE18_06) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][8] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][8] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][8]);
}
if (regaddr == RTXAGC_B_RATE54_24) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][9] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][9] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][9]);
}
if (regaddr == RTXAGC_B_CCK1_55_MCS32) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][14] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][14] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][14]);
}
if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][15] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][15] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][15]);
}
if (regaddr == RTXAGC_B_MCS03_MCS00) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][10] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][10] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][10]);
}
if (regaddr == RTXAGC_B_MCS07_MCS04) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][11] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][11] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][11]);
}
if (regaddr == RTXAGC_B_MCS11_MCS08) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][12] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][12] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][12]);
}
if (regaddr == RTXAGC_B_MCS15_MCS12) {
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][13] =
data;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"MCSTxPowerLevelOriginalOffset[%d][13] = 0x%ulx\n",
rtlphy->pwrgroup_cnt,
rtlphy->mcs_txpwrlevel_origoffset
[rtlphy->pwrgroup_cnt][13]);
rtlphy->pwrgroup_cnt++; rtlphy->pwrgroup_cnt++;
}
} }
static bool _rtl92d_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, static bool _rtl92d_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
......
...@@ -678,30 +678,28 @@ static void _rtl92s_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw, ...@@ -678,30 +678,28 @@ static void _rtl92s_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_phy *rtlphy = &(rtlpriv->phy);
int index;
if (reg_addr == RTXAGC_RATE18_06) if (reg_addr == RTXAGC_RATE18_06)
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][0] = index = 0;
data; else if (reg_addr == RTXAGC_RATE54_24)
if (reg_addr == RTXAGC_RATE54_24) index = 1;
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][1] = else if (reg_addr == RTXAGC_CCK_MCS32)
data; index = 6;
if (reg_addr == RTXAGC_CCK_MCS32) else if (reg_addr == RTXAGC_MCS03_MCS00)
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][6] = index = 2;
data; else if (reg_addr == RTXAGC_MCS07_MCS04)
if (reg_addr == RTXAGC_MCS03_MCS00) index = 3;
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][2] = else if (reg_addr == RTXAGC_MCS11_MCS08)
data; index = 4;
if (reg_addr == RTXAGC_MCS07_MCS04) else if (reg_addr == RTXAGC_MCS15_MCS12)
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][3] = index = 5;
data; else
if (reg_addr == RTXAGC_MCS11_MCS08) return;
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][4] =
data; rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][index] = data;
if (reg_addr == RTXAGC_MCS15_MCS12) { if (index == 5)
rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][5] =
data;
rtlphy->pwrgroup_cnt++; rtlphy->pwrgroup_cnt++;
}
} }
static void _rtl92s_phy_init_register_definition(struct ieee80211_hw *hw) static void _rtl92s_phy_init_register_definition(struct ieee80211_hw *hw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment