ath9k: improve powersave filter handling
[lede.git] / package / kernel / mac80211 / patches / 327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 11 Jul 2016 11:35:20 +0200
3 Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
4  init
5
6 Remove a misleading debug message as well
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
12 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
13 @@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
14         }
15  }
16  
17 +static void ar9003_hw_init_cal_common(struct ath_hw *ah)
18 +{
19 +       struct ath9k_hw_cal_data *caldata = ah->caldata;
20 +
21 +       /* Initialize list pointers */
22 +       ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
23 +
24 +       INIT_CAL(&ah->iq_caldata);
25 +       INSERT_CAL(ah, &ah->iq_caldata);
26 +
27 +       /* Initialize current pointer to first element in list */
28 +       ah->cal_list_curr = ah->cal_list;
29 +
30 +       if (ah->cal_list_curr)
31 +               ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
32 +
33 +       if (caldata)
34 +               caldata->CalValid = 0;
35 +}
36 +
37  static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
38                                      struct ath9k_channel *chan)
39  {
40 @@ -1532,21 +1552,7 @@ skip_tx_iqcal:
41         /* Revert chainmask to runtime parameters */
42         ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
43  
44 -       /* Initialize list pointers */
45 -       ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
46 -
47 -       INIT_CAL(&ah->iq_caldata);
48 -       INSERT_CAL(ah, &ah->iq_caldata);
49 -       ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
50 -
51 -       /* Initialize current pointer to first element in list */
52 -       ah->cal_list_curr = ah->cal_list;
53 -
54 -       if (ah->cal_list_curr)
55 -               ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
56 -
57 -       if (caldata)
58 -               caldata->CalValid = 0;
59 +       ar9003_hw_init_cal_common(ah);
60  
61         return true;
62  }
63 @@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
64  static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
65                                    struct ath9k_channel *chan)
66  {
67 -       struct ath_common *common = ath9k_hw_common(ah);
68 -       struct ath9k_hw_cal_data *caldata = ah->caldata;
69         bool txiqcal_done = false;
70         bool status = true;
71         bool run_agc_cal = false, sep_iq_cal = false;
72 @@ -1676,21 +1680,7 @@ skip_tx_iqcal:
73         /* Revert chainmask to runtime parameters */
74         ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
75  
76 -       /* Initialize list pointers */
77 -       ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
78 -
79 -       INIT_CAL(&ah->iq_caldata);
80 -       INSERT_CAL(ah, &ah->iq_caldata);
81 -       ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
82 -
83 -       /* Initialize current pointer to first element in list */
84 -       ah->cal_list_curr = ah->cal_list;
85 -
86 -       if (ah->cal_list_curr)
87 -               ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
88 -
89 -       if (caldata)
90 -               caldata->CalValid = 0;
91 +       ar9003_hw_init_cal_common(ah);
92  
93         return true;
94  }