Commit 7067e701 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k_hw: remove confusing logic inversion in an ANI variable

Code using this had already triggered smatch complaints, so remove it before
it gets fixed the wrong way.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0b81cc39
...@@ -185,7 +185,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah) ...@@ -185,7 +185,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah)
} }
rssi = BEACON_RSSI(ah); rssi = BEACON_RSSI(ah);
if (rssi > aniState->rssiThrHigh) { if (rssi > aniState->rssiThrHigh) {
if (!aniState->ofdmWeakSigDetectOff) { if (aniState->ofdmWeakSigDetect) {
if (ath9k_hw_ani_control(ah, if (ath9k_hw_ani_control(ah,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
false)) { false)) {
...@@ -200,7 +200,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah) ...@@ -200,7 +200,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah)
return; return;
} }
} else if (rssi > aniState->rssiThrLow) { } else if (rssi > aniState->rssiThrLow) {
if (aniState->ofdmWeakSigDetectOff) if (!aniState->ofdmWeakSigDetect)
ath9k_hw_ani_control(ah, ath9k_hw_ani_control(ah,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
true); true);
...@@ -211,7 +211,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah) ...@@ -211,7 +211,7 @@ static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah)
} else { } else {
if ((conf->channel->band == IEEE80211_BAND_2GHZ) && if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
!conf_is_ht(conf)) { !conf_is_ht(conf)) {
if (!aniState->ofdmWeakSigDetectOff) if (aniState->ofdmWeakSigDetect)
ath9k_hw_ani_control(ah, ath9k_hw_ani_control(ah,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
false); false);
...@@ -296,7 +296,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel) ...@@ -296,7 +296,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
BEACON_RSSI(ah) <= aniState->rssiThrHigh) BEACON_RSSI(ah) <= aniState->rssiThrHigh)
weak_sig = true; weak_sig = true;
if (!aniState->ofdmWeakSigDetectOff != weak_sig) if (aniState->ofdmWeakSigDetect != weak_sig)
ath9k_hw_ani_control(ah, ath9k_hw_ani_control(ah,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
entry_ofdm->ofdm_weak_signal_on); entry_ofdm->ofdm_weak_signal_on);
...@@ -401,7 +401,7 @@ static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah) ...@@ -401,7 +401,7 @@ static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah)
if (rssi > aniState->rssiThrHigh) { if (rssi > aniState->rssiThrHigh) {
/* XXX: Handle me */ /* XXX: Handle me */
} else if (rssi > aniState->rssiThrLow) { } else if (rssi > aniState->rssiThrLow) {
if (aniState->ofdmWeakSigDetectOff) { if (!aniState->ofdmWeakSigDetect) {
if (ath9k_hw_ani_control(ah, if (ath9k_hw_ani_control(ah,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
true)) true))
...@@ -509,9 +509,9 @@ static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning) ...@@ -509,9 +509,9 @@ static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning)
if (aniState->spurImmunityLevel != 0) if (aniState->spurImmunityLevel != 0)
ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
aniState->spurImmunityLevel); aniState->spurImmunityLevel);
if (aniState->ofdmWeakSigDetectOff) if (!aniState->ofdmWeakSigDetect)
ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
!aniState->ofdmWeakSigDetectOff); aniState->ofdmWeakSigDetect);
if (aniState->cckWeakSigThreshold) if (aniState->cckWeakSigThreshold)
ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR, ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR,
aniState->cckWeakSigThreshold); aniState->cckWeakSigThreshold);
...@@ -887,8 +887,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah) ...@@ -887,8 +887,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
ani->ofdmWeakSigDetectOff = ani->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
!ATH9K_ANI_USE_OFDM_WEAK_SIG;
ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
ani->update_ani = false; ani->update_ani = false;
......
...@@ -122,7 +122,7 @@ struct ar5416AniState { ...@@ -122,7 +122,7 @@ struct ar5416AniState {
u8 mrcCCKOff; u8 mrcCCKOff;
u8 spurImmunityLevel; u8 spurImmunityLevel;
u8 firstepLevel; u8 firstepLevel;
u8 ofdmWeakSigDetectOff; u8 ofdmWeakSigDetect;
u8 cckWeakSigThreshold; u8 cckWeakSigThreshold;
bool update_ani; bool update_ani;
u32 listenTime; u32 listenTime;
......
...@@ -1042,12 +1042,12 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1042,12 +1042,12 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
if (!on != aniState->ofdmWeakSigDetectOff) { if (on != aniState->ofdmWeakSigDetect) {
if (on) if (on)
ah->stats.ast_ani_ofdmon++; ah->stats.ast_ani_ofdmon++;
else else
ah->stats.ast_ani_ofdmoff++; ah->stats.ast_ani_ofdmoff++;
aniState->ofdmWeakSigDetectOff = !on; aniState->ofdmWeakSigDetect = on;
} }
break; break;
} }
...@@ -1114,10 +1114,10 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1114,10 +1114,10 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
ath_dbg(common, ANI, "ANI parameters:\n"); ath_dbg(common, ANI, "ANI parameters:\n");
ath_dbg(common, ANI, ath_dbg(common, ANI,
"noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n", "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetect=%d\n",
aniState->noiseImmunityLevel, aniState->noiseImmunityLevel,
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
!aniState->ofdmWeakSigDetectOff); aniState->ofdmWeakSigDetect);
ath_dbg(common, ANI, ath_dbg(common, ANI,
"cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n", "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
aniState->cckWeakSigThreshold, aniState->cckWeakSigThreshold,
...@@ -1206,18 +1206,18 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1206,18 +1206,18 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
if (!on != aniState->ofdmWeakSigDetectOff) { if (on != aniState->ofdmWeakSigDetect) {
ath_dbg(common, ANI, ath_dbg(common, ANI,
"** ch %d: ofdm weak signal: %s=>%s\n", "** ch %d: ofdm weak signal: %s=>%s\n",
chan->channel, chan->channel,
!aniState->ofdmWeakSigDetectOff ? aniState->ofdmWeakSigDetect ?
"on" : "off", "on" : "off",
on ? "on" : "off"); on ? "on" : "off");
if (on) if (on)
ah->stats.ast_ani_ofdmon++; ah->stats.ast_ani_ofdmon++;
else else
ah->stats.ast_ani_ofdmoff++; ah->stats.ast_ani_ofdmoff++;
aniState->ofdmWeakSigDetectOff = !on; aniState->ofdmWeakSigDetect = on;
} }
break; break;
} }
...@@ -1367,7 +1367,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1367,7 +1367,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
ath_dbg(common, ANI, ath_dbg(common, ANI,
"ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
!aniState->ofdmWeakSigDetectOff ? "on" : "off", aniState->ofdmWeakSigDetect ? "on" : "off",
aniState->firstepLevel, aniState->firstepLevel,
!aniState->mrcCCKOff ? "on" : "off", !aniState->mrcCCKOff ? "on" : "off",
aniState->listenTime, aniState->listenTime,
...@@ -1456,7 +1456,7 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah) ...@@ -1456,7 +1456,7 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah)
/* these levels just got reset to defaults by the INI */ /* these levels just got reset to defaults by the INI */
aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW; aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW; aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
aniState->mrcCCKOff = true; /* not available on pre AR9003 */ aniState->mrcCCKOff = true; /* not available on pre AR9003 */
} }
......
...@@ -825,18 +825,18 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, ...@@ -825,18 +825,18 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah,
REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
if (!on != aniState->ofdmWeakSigDetectOff) { if (on != aniState->ofdmWeakSigDetect) {
ath_dbg(common, ANI, ath_dbg(common, ANI,
"** ch %d: ofdm weak signal: %s=>%s\n", "** ch %d: ofdm weak signal: %s=>%s\n",
chan->channel, chan->channel,
!aniState->ofdmWeakSigDetectOff ? aniState->ofdmWeakSigDetect ?
"on" : "off", "on" : "off",
on ? "on" : "off"); on ? "on" : "off");
if (on) if (on)
ah->stats.ast_ani_ofdmon++; ah->stats.ast_ani_ofdmon++;
else else
ah->stats.ast_ani_ofdmoff++; ah->stats.ast_ani_ofdmoff++;
aniState->ofdmWeakSigDetectOff = !on; aniState->ofdmWeakSigDetect = on;
} }
break; break;
} }
...@@ -1002,7 +1002,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, ...@@ -1002,7 +1002,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah,
ath_dbg(common, ANI, ath_dbg(common, ANI,
"ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
!aniState->ofdmWeakSigDetectOff ? "on" : "off", aniState->ofdmWeakSigDetect ? "on" : "off",
aniState->firstepLevel, aniState->firstepLevel,
!aniState->mrcCCKOff ? "on" : "off", !aniState->mrcCCKOff ? "on" : "off",
aniState->listenTime, aniState->listenTime,
...@@ -1113,7 +1113,7 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah) ...@@ -1113,7 +1113,7 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah)
/* these levels just got reset to defaults by the INI */ /* these levels just got reset to defaults by the INI */
aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW; aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW; aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
aniState->ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK; aniState->mrcCCKOff = !ATH9K_ANI_ENABLE_MRC_CCK;
} }
......
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