From owner-svn-src-head@FreeBSD.ORG Thu Feb 5 21:13:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79772106564A; Thu, 5 Feb 2009 21:13:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD718FC19; Thu, 5 Feb 2009 21:13:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15LDV4u039273; Thu, 5 Feb 2009 21:13:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15LDVxT039271; Thu, 5 Feb 2009 21:13:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902052113.n15LDVxT039271@svn.freebsd.org> From: Sam Leffler Date: Thu, 5 Feb 2009 21:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188197 - head/sys/dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2009 21:13:31 -0000 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; }