summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-02-05 21:13:31 +0000
committersam <sam@FreeBSD.org>2009-02-05 21:13:31 +0000
commit336cb9e99f780761517df6623bc4c8e4e37e2d1e (patch)
tree5a736847b8c6861312484bc45dc79b088ea3562e /sys/dev/ath
parent2187c7fab719de8a21527f44ba15250bb030e536 (diff)
downloadFreeBSD-src-336cb9e99f780761517df6623bc4c8e4e37e2d1e.zip
FreeBSD-src-336cb9e99f780761517df6623bc4c8e4e37e2d1e.tar.gz
eliminate gainFCorrection; just have ar5212GetGainFCorrection return
the calculated value as it's only used in one place
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212.h1
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c22
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212.h b/sys/dev/ath/ath_hal/ar5212/ar5212.h
index e0edcf6..86a8674 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212.h
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212.h
@@ -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;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
index 4d17eef..f9fbc9c 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
@@ -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;
}
OpenPOWER on IntegriCloud