Date: Thu, 5 Feb 2009 21:13:31 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r188197 - head/sys/dev/ath/ath_hal/ar5212 Message-ID: <200902052113.n15LDVxT039271@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sam Date: Thu Feb 5 21:13:31 2009 New Revision: 188197 URL: http://svn.freebsd.org/changeset/base/188197 Log: eliminate gainFCorrection; just have ar5212GetGainFCorrection return the calculated value as it's only used in one place Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Feb 5 21:09:46 2009 (r188196) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Feb 5 21:13:31 2009 (r188197) @@ -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; Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c Thu Feb 5 21:09:46 2009 (r188196) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c Thu Feb 5 21:13:31 2009 (r188197) @@ -239,34 +239,36 @@ ar5212AdjustGain(struct ath_hal *ah, GAI /* * 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902052113.n15LDVxT039271>