ath9k_hw: simplify ar9003_hw_per_calibration

Reduce indentation, use a variable to save a few pointer dereferences

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Felix Fietkau
2016-07-11 12:02:46 +02:00
committed by Kalle Valo
parent 3ff25093cb
commit 8f778c72ac

View File

@@ -75,21 +75,21 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah,
struct ath9k_cal_list *currCal) struct ath9k_cal_list *currCal)
{ {
struct ath9k_hw_cal_data *caldata = ah->caldata; struct ath9k_hw_cal_data *caldata = ah->caldata;
/* Cal is assumed not done until explicitly set below */ const struct ath9k_percal_data *cur_caldata = currCal->calData;
bool iscaldone = false;
/* Calibration in progress. */ /* Calibration in progress. */
if (currCal->calState == CAL_RUNNING) { if (currCal->calState == CAL_RUNNING) {
/* Check to see if it has finished. */ /* Check to see if it has finished. */
if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) { if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
return false;
/* /*
* Accumulate cal measures for active chains * Accumulate cal measures for active chains
*/ */
currCal->calData->calCollect(ah); cur_caldata->calCollect(ah);
ah->cal_samples++; ah->cal_samples++;
if (ah->cal_samples >= if (ah->cal_samples >= cur_caldata->calNumSamples) {
currCal->calData->calNumSamples) {
unsigned int i, numChains = 0; unsigned int i, numChains = 0;
for (i = 0; i < AR9300_MAX_CHAINS; i++) { for (i = 0; i < AR9300_MAX_CHAINS; i++) {
if (rxchainmask & (1 << i)) if (rxchainmask & (1 << i))
@@ -99,12 +99,12 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah,
/* /*
* Process accumulated data * Process accumulated data
*/ */
currCal->calData->calPostProc(ah, numChains); cur_caldata->calPostProc(ah, numChains);
/* Calibration has finished. */ /* Calibration has finished. */
caldata->CalValid |= currCal->calData->calType; caldata->CalValid |= cur_caldata->calType;
currCal->calState = CAL_DONE; currCal->calState = CAL_DONE;
iscaldone = true; return true;
} else { } else {
/* /*
* Set-up collection of another sub-sample until we * Set-up collection of another sub-sample until we
@@ -112,13 +112,12 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah,
*/ */
ar9003_hw_setup_calibration(ah, currCal); ar9003_hw_setup_calibration(ah, currCal);
} }
} } else if (!(caldata->CalValid & cur_caldata->calType)) {
} else if (!(caldata->CalValid & currCal->calData->calType)) {
/* If current cal is marked invalid in channel, kick it off */ /* If current cal is marked invalid in channel, kick it off */
ath9k_hw_reset_calibration(ah, currCal); ath9k_hw_reset_calibration(ah, currCal);
} }
return iscaldone; return false;
} }
static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,