1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 11 Jul 2016 11:34:47 +0200
3 Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
5 Reduce indentation, use a variable to save a few pointer dereferences
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
11 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
12 @@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
13 struct ath9k_cal_list *currCal)
15 struct ath9k_hw_cal_data *caldata = ah->caldata;
16 - /* Cal is assumed not done until explicitly set below */
17 - bool iscaldone = false;
18 + const struct ath9k_percal_data *cur_caldata = currCal->calData;
20 /* Calibration in progress. */
21 if (currCal->calState == CAL_RUNNING) {
22 /* Check to see if it has finished. */
23 - if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
25 - * Accumulate cal measures for active chains
27 - currCal->calData->calCollect(ah);
29 + if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
32 - if (ah->cal_samples >=
33 - currCal->calData->calNumSamples) {
34 - unsigned int i, numChains = 0;
35 - for (i = 0; i < AR9300_MAX_CHAINS; i++) {
36 - if (rxchainmask & (1 << i))
40 + * Accumulate cal measures for active chains
42 + cur_caldata->calCollect(ah);
46 - * Process accumulated data
48 - currCal->calData->calPostProc(ah, numChains);
49 + if (ah->cal_samples >= cur_caldata->calNumSamples) {
50 + unsigned int i, numChains = 0;
51 + for (i = 0; i < AR9300_MAX_CHAINS; i++) {
52 + if (rxchainmask & (1 << i))
56 - /* Calibration has finished. */
57 - caldata->CalValid |= currCal->calData->calType;
58 - currCal->calState = CAL_DONE;
62 + * Process accumulated data
64 + cur_caldata->calPostProc(ah, numChains);
66 + /* Calibration has finished. */
67 + caldata->CalValid |= cur_caldata->calType;
68 + currCal->calState = CAL_DONE;
72 * Set-up collection of another sub-sample until we
75 ar9003_hw_setup_calibration(ah, currCal);
78 - } else if (!(caldata->CalValid & currCal->calData->calType)) {
79 + } else if (!(caldata->CalValid & cur_caldata->calType)) {
80 /* If current cal is marked invalid in channel, kick it off */
81 ath9k_hw_reset_calibration(ah, currCal);
88 static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,