eliminate gainFCorrection; just have ar5212GetGainFCorrection return

the calculated value as it's only used in one place
This commit is contained in:
Sam Leffler 2009-02-05 21:13:31 +00:00
parent cc5912f8d7
commit e25b0c1528
2 changed files with 12 additions and 11 deletions

View File

@ -122,7 +122,6 @@ typedef struct {
uint32_t targetGain;
uint32_t loTrig;
uint32_t hiTrig;
uint32_t gainFCorrection;
uint32_t active;
const GAIN_OPTIMIZATION_STEP *currStep;
} GAIN_VALUES;

View File

@ -239,34 +239,36 @@ ar5212AdjustGain(struct ath_hal *ah, GAIN_VALUES *gv)
/*
* Read rf register to determine if gainF needs correction
*/
static void
static uint32_t
ar5212GetGainFCorrection(struct ath_hal *ah)
{
struct ath_hal_5212 *ahp = AH5212(ah);
GAIN_VALUES *gv = &ahp->ah_gainValues;
uint32_t correction;
HALASSERT(IS_RADX112_REV2(ah));
gv->gainFCorrection = 0;
correction = 0;
if (ar5212GetRfField(ar5212GetRfBank(ah, 7), 1, 36, 0) == 1) {
const GAIN_VALUES *gv = &ahp->ah_gainValues;
uint32_t mixGain = gv->currStep->paramVal[0];
uint32_t gainStep =
ar5212GetRfField(ar5212GetRfBank(ah, 7), 4, 32, 0);
switch (mixGain) {
case 0 :
gv->gainFCorrection = 0;
correction = 0;
break;
case 1 :
gv->gainFCorrection = gainStep;
correction = gainStep;
break;
case 2 :
gv->gainFCorrection = 2 * gainStep - 5;
correction = 2 * gainStep - 5;
break;
case 3 :
gv->gainFCorrection = 2 * gainStep;
correction = 2 * gainStep;
break;
}
}
return correction;
}
/*
@ -303,9 +305,9 @@ ar5212GetRfgain(struct ath_hal *ah)
gv->currGain += PHY_PROBE_CCK_CORRECTION;
}
if (IS_RADX112_REV2(ah)) {
ar5212GetGainFCorrection(ah);
if (gv->currGain >= gv->gainFCorrection)
gv->currGain -= gv->gainFCorrection;
uint32_t correct = ar5212GetGainFCorrection(ah);
if (gv->currGain >= correct)
gv->currGain -= correct;
else
gv->currGain = 0;
}