Skip to content

Commit

Permalink
ath9k_hw: get rid of some duplicate code in calibration init
Browse files Browse the repository at this point in the history
Remove a misleading debug message as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Felix Fietkau authored and Kalle Valo committed Jul 19, 2016
1 parent 8f778c7 commit feaacb1
Showing 1 changed file with 22 additions and 32 deletions.
54 changes: 22 additions & 32 deletions drivers/net/wireless/ath/ath9k/ar9003_calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(struct ath_hw *ah, bool is_reusable)
}
}

static void ar9003_hw_init_cal_common(struct ath_hw *ah)
{
struct ath9k_hw_cal_data *caldata = ah->caldata;

/* Initialize list pointers */
ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;

INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata);

/* Initialize current pointer to first element in list */
ah->cal_list_curr = ah->cal_list;

if (ah->cal_list_curr)
ath9k_hw_reset_calibration(ah, ah->cal_list_curr);

if (caldata)
caldata->CalValid = 0;
}

static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
struct ath9k_channel *chan)
{
Expand Down Expand Up @@ -1532,21 +1552,7 @@ static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
/* Revert chainmask to runtime parameters */
ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);

/* Initialize list pointers */
ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;

INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata);
ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");

/* Initialize current pointer to first element in list */
ah->cal_list_curr = ah->cal_list;

if (ah->cal_list_curr)
ath9k_hw_reset_calibration(ah, ah->cal_list_curr);

if (caldata)
caldata->CalValid = 0;
ar9003_hw_init_cal_common(ah);

return true;
}
Expand Down Expand Up @@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath_hw *ah)
static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
struct ath9k_channel *chan)
{
struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_hw_cal_data *caldata = ah->caldata;
bool txiqcal_done = false;
bool status = true;
bool run_agc_cal = false, sep_iq_cal = false;
Expand Down Expand Up @@ -1676,21 +1680,7 @@ static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
/* Revert chainmask to runtime parameters */
ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);

/* Initialize list pointers */
ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;

INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata);
ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");

/* Initialize current pointer to first element in list */
ah->cal_list_curr = ah->cal_list;

if (ah->cal_list_curr)
ath9k_hw_reset_calibration(ah, ah->cal_list_curr);

if (caldata)
caldata->CalValid = 0;
ar9003_hw_init_cal_common(ah);

return true;
}
Expand Down

0 comments on commit feaacb1

Please sign in to comment.