uhttpd: prevent linking uhttpd binary against crypto libraries
[openwrt/staging/dedeckeh.git] / package / mac80211 / patches / 560-ath9k_fix_radio_stop.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -880,82 +880,6 @@ chip_reset:
4 #undef SCHED_INTR
5 }
6
7 -static void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
8 -{
9 - struct ath_hw *ah = sc->sc_ah;
10 - struct ath_common *common = ath9k_hw_common(ah);
11 - struct ieee80211_channel *channel = hw->conf.channel;
12 - int r;
13 -
14 - ath9k_ps_wakeup(sc);
15 - spin_lock_bh(&sc->sc_pcu_lock);
16 - atomic_set(&ah->intr_ref_cnt, -1);
17 -
18 - ath9k_hw_configpcipowersave(ah, false);
19 -
20 - if (!ah->curchan)
21 - ah->curchan = ath9k_cmn_get_curchannel(sc->hw, ah);
22 -
23 - r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
24 - if (r) {
25 - ath_err(common,
26 - "Unable to reset channel (%u MHz), reset status %d\n",
27 - channel->center_freq, r);
28 - }
29 -
30 - ath_complete_reset(sc, true);
31 -
32 - /* Enable LED */
33 - ath9k_hw_cfg_output(ah, ah->led_pin,
34 - AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
35 - ath9k_hw_set_gpio(ah, ah->led_pin, 0);
36 -
37 - spin_unlock_bh(&sc->sc_pcu_lock);
38 -
39 - ath9k_ps_restore(sc);
40 -}
41 -
42 -void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
43 -{
44 - struct ath_hw *ah = sc->sc_ah;
45 - struct ieee80211_channel *channel = hw->conf.channel;
46 - int r;
47 -
48 - ath9k_ps_wakeup(sc);
49 -
50 - ath_cancel_work(sc);
51 -
52 - spin_lock_bh(&sc->sc_pcu_lock);
53 -
54 - /*
55 - * Keep the LED on when the radio is disabled
56 - * during idle unassociated state.
57 - */
58 - if (!sc->ps_idle) {
59 - ath9k_hw_set_gpio(ah, ah->led_pin, 1);
60 - ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
61 - }
62 -
63 - ath_prepare_reset(sc, false, true);
64 -
65 - if (!ah->curchan)
66 - ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
67 -
68 - r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
69 - if (r) {
70 - ath_err(ath9k_hw_common(sc->sc_ah),
71 - "Unable to reset channel (%u MHz), reset status %d\n",
72 - channel->center_freq, r);
73 - }
74 -
75 - ath9k_hw_phy_disable(ah);
76 -
77 - ath9k_hw_configpcipowersave(ah, true);
78 -
79 - spin_unlock_bh(&sc->sc_pcu_lock);
80 - ath9k_ps_restore(sc);
81 -}
82 -
83 static int ath_reset(struct ath_softc *sc, bool retry_tx)
84 {
85 int r;
86 @@ -1091,6 +1015,9 @@ static int ath9k_start(struct ieee80211_
87 * and then setup of the interrupt mask.
88 */
89 spin_lock_bh(&sc->sc_pcu_lock);
90 +
91 + atomic_set(&ah->intr_ref_cnt, -1);
92 +
93 r = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
94 if (r) {
95 ath_err(common,
96 @@ -1129,6 +1056,16 @@ static int ath9k_start(struct ieee80211_
97 goto mutex_unlock;
98 }
99
100 + ath9k_hw_cfg_output(ah, ah->led_pin,
101 + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
102 + ath9k_hw_set_gpio(ah, ah->led_pin, 0);
103 +
104 + /*
105 + * Reset key cache to sane defaults (all entries cleared) instead of
106 + * semi-random values after suspend/resume.
107 + */
108 + ath9k_cmn_init_crypto(sc->sc_ah);
109 +
110 spin_unlock_bh(&sc->sc_pcu_lock);
111
112 if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) &&
113 @@ -1248,33 +1185,39 @@ static void ath9k_stop(struct ieee80211_
114 * before setting the invalid flag. */
115 ath9k_hw_disable_interrupts(ah);
116
117 - if (!(sc->sc_flags & SC_OP_INVALID)) {
118 - ath_drain_all_txq(sc, false);
119 - ath_stoprecv(sc);
120 - ath9k_hw_phy_disable(ah);
121 - } else
122 - sc->rx.rxlink = NULL;
123 + spin_unlock_bh(&sc->sc_pcu_lock);
124 +
125 + /* we can now sync irq and kill any running tasklets, since we already
126 + * disabled interrupts and not holding a spin lock */
127 + synchronize_irq(sc->irq);
128 + tasklet_kill(&sc->intr_tq);
129 + tasklet_kill(&sc->bcon_tasklet);
130 +
131 + sc->ps_idle = true;
132 +
133 + spin_lock_bh(&sc->sc_pcu_lock);
134 +
135 + ath9k_hw_set_gpio(ah, ah->led_pin, 1);
136 + ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
137 +
138 + ath_prepare_reset(sc, false, true);
139
140 if (sc->rx.frag) {
141 dev_kfree_skb_any(sc->rx.frag);
142 sc->rx.frag = NULL;
143 }
144
145 - /* disable HAL and put h/w to sleep */
146 - ath9k_hw_disable(ah);
147 + if (!ah->curchan)
148 + ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
149
150 - spin_unlock_bh(&sc->sc_pcu_lock);
151 + ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
152 + ath9k_hw_phy_disable(ah);
153
154 - /* we can now sync irq and kill any running tasklets, since we already
155 - * disabled interrupts and not holding a spin lock */
156 - synchronize_irq(sc->irq);
157 - tasklet_kill(&sc->intr_tq);
158 - tasklet_kill(&sc->bcon_tasklet);
159 + ath9k_hw_configpcipowersave(ah, true);
160
161 - ath9k_ps_restore(sc);
162 + spin_unlock_bh(&sc->sc_pcu_lock);
163
164 - sc->ps_idle = true;
165 - ath_radio_disable(sc, hw);
166 + ath9k_ps_restore(sc);
167
168 sc->sc_flags |= SC_OP_INVALID;
169
170 @@ -1598,8 +1541,8 @@ static int ath9k_config(struct ieee80211
171 struct ath_hw *ah = sc->sc_ah;
172 struct ath_common *common = ath9k_hw_common(ah);
173 struct ieee80211_conf *conf = &hw->conf;
174 - bool disable_radio = false;
175
176 + ath9k_ps_wakeup(sc);
177 mutex_lock(&sc->mutex);
178
179 /*
180 @@ -1608,16 +1551,8 @@ static int ath9k_config(struct ieee80211
181 * of the changes. Likewise we must only disable the radio towards
182 * the end.
183 */
184 - if (changed & IEEE80211_CONF_CHANGE_IDLE) {
185 + if (changed & IEEE80211_CONF_CHANGE_IDLE)
186 sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
187 - if (!sc->ps_idle) {
188 - ath_radio_enable(sc, hw);
189 - ath_dbg(common, ATH_DBG_CONFIG,
190 - "not-idle: enabling radio\n");
191 - } else {
192 - disable_radio = true;
193 - }
194 - }
195
196 /*
197 * We just prepare to enable PS. We have to wait until our AP has
198 @@ -1742,19 +1677,13 @@ static int ath9k_config(struct ieee80211
199 ath_dbg(common, ATH_DBG_CONFIG,
200 "Set power: %d\n", conf->power_level);
201 sc->config.txpowlimit = 2 * conf->power_level;
202 - ath9k_ps_wakeup(sc);
203 ath9k_cmn_update_txpow(ah, sc->curtxpow,
204 sc->config.txpowlimit, &sc->curtxpow);
205 - ath9k_ps_restore(sc);
206 conf->cur_power_level = sc->curtxpow / 2;
207 }
208
209 - if (disable_radio) {
210 - ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n");
211 - ath_radio_disable(sc, hw);
212 - }
213 -
214 mutex_unlock(&sc->mutex);
215 + ath9k_ps_restore(sc);
216
217 return 0;
218 }
219 --- a/drivers/net/wireless/ath/ath9k/pci.c
220 +++ b/drivers/net/wireless/ath/ath9k/pci.c
221 @@ -306,12 +306,11 @@ static int ath_pci_suspend(struct device
222 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
223 struct ath_softc *sc = hw->priv;
224
225 - ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
226 -
227 /* The device has to be moved to FULLSLEEP forcibly.
228 * Otherwise the chip never moved to full sleep,
229 * when no interface is up.
230 */
231 + ath9k_hw_disable(sc->sc_ah);
232 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
233
234 return 0;
235 @@ -333,22 +332,6 @@ static int ath_pci_resume(struct device
236 if ((val & 0x0000ff00) != 0)
237 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
238
239 - ath9k_ps_wakeup(sc);
240 - /* Enable LED */
241 - ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
242 - AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
243 - ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 0);
244 -
245 - /*
246 - * Reset key cache to sane defaults (all entries cleared) instead of
247 - * semi-random values after suspend/resume.
248 - */
249 - ath9k_cmn_init_crypto(sc->sc_ah);
250 - ath9k_ps_restore(sc);
251 -
252 - sc->ps_idle = true;
253 - ath_radio_disable(sc, hw);
254 -
255 return 0;
256 }
257