diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-23 18:58:50 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:35 -0500 |
commit | c0d7c7af0a8298a43449d54762e655ab57739539 (patch) | |
tree | 41194021eff7629ce8abd08da037be9dea4a0071 /drivers | |
parent | 0de57d991b82eb64b7a0f4cf406251713ee633cf (diff) |
ath9k: remove superfluous check on changing channel
When we try to change the channel in ath9k its because
either the configuration indicates we *have* changed
channels or HT configuration has changed. In both cases
we want to do a reset. Either way mac80211 will inform us
when we want to actually change the channel so trust those
calls.
Although in the patch it may seem as I am doing more code
changes I am not, all I am doing is removing the initial
branch conditional and shifting the code to the left.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 756604485532..5cbda9245560 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -268,61 +268,56 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan) | |||
268 | if (sc->sc_flags & SC_OP_INVALID) | 268 | if (sc->sc_flags & SC_OP_INVALID) |
269 | return -EIO; | 269 | return -EIO; |
270 | 270 | ||
271 | if (hchan->channel != sc->sc_ah->ah_curchan->channel || | 271 | /* |
272 | hchan->channelFlags != sc->sc_ah->ah_curchan->channelFlags || | 272 | * This is only performed if the channel settings have |
273 | (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) || | 273 | * actually changed. |
274 | (sc->sc_flags & SC_OP_FULL_RESET)) { | 274 | * |
275 | /* | 275 | * To switch channels clear any pending DMA operations; |
276 | * This is only performed if the channel settings have | 276 | * wait long enough for the RX fifo to drain, reset the |
277 | * actually changed. | 277 | * hardware at the new frequency, and then re-enable |
278 | * | 278 | * the relevant bits of the h/w. |
279 | * To switch channels clear any pending DMA operations; | 279 | */ |
280 | * wait long enough for the RX fifo to drain, reset the | 280 | ath9k_hw_set_interrupts(ah, 0); |
281 | * hardware at the new frequency, and then re-enable | 281 | ath_draintxq(sc, false); |
282 | * the relevant bits of the h/w. | 282 | stopped = ath_stoprecv(sc); |
283 | */ | ||
284 | ath9k_hw_set_interrupts(ah, 0); | ||
285 | ath_draintxq(sc, false); | ||
286 | stopped = ath_stoprecv(sc); | ||
287 | 283 | ||
288 | /* XXX: do not flush receive queue here. We don't want | 284 | /* XXX: do not flush receive queue here. We don't want |
289 | * to flush data frames already in queue because of | 285 | * to flush data frames already in queue because of |
290 | * changing channel. */ | 286 | * changing channel. */ |
291 | 287 | ||
292 | if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET)) | 288 | if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET)) |
293 | fastcc = false; | 289 | fastcc = false; |
294 | 290 | ||
295 | DPRINTF(sc, ATH_DBG_CONFIG, | 291 | DPRINTF(sc, ATH_DBG_CONFIG, |
296 | "(%u MHz) -> (%u MHz), chanwidth: %d\n", | 292 | "(%u MHz) -> (%u MHz), chanwidth: %d\n", |
297 | sc->sc_ah->ah_curchan->channel, | 293 | sc->sc_ah->ah_curchan->channel, |
298 | channel->center_freq, sc->tx_chan_width); | 294 | channel->center_freq, sc->tx_chan_width); |
299 | 295 | ||
300 | spin_lock_bh(&sc->sc_resetlock); | 296 | spin_lock_bh(&sc->sc_resetlock); |
301 | 297 | ||
302 | r = ath9k_hw_reset(ah, hchan, fastcc); | 298 | r = ath9k_hw_reset(ah, hchan, fastcc); |
303 | if (r) { | 299 | if (r) { |
304 | DPRINTF(sc, ATH_DBG_FATAL, | 300 | DPRINTF(sc, ATH_DBG_FATAL, |
305 | "Unable to reset channel (%u Mhz) " | 301 | "Unable to reset channel (%u Mhz) " |
306 | "reset status %u\n", | 302 | "reset status %u\n", |
307 | channel->center_freq, r); | 303 | channel->center_freq, r); |
308 | spin_unlock_bh(&sc->sc_resetlock); | ||
309 | return r; | ||
310 | } | ||
311 | spin_unlock_bh(&sc->sc_resetlock); | 304 | spin_unlock_bh(&sc->sc_resetlock); |
305 | return r; | ||
306 | } | ||
307 | spin_unlock_bh(&sc->sc_resetlock); | ||
312 | 308 | ||
313 | sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE; | 309 | sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE; |
314 | sc->sc_flags &= ~SC_OP_FULL_RESET; | 310 | sc->sc_flags &= ~SC_OP_FULL_RESET; |
315 | |||
316 | if (ath_startrecv(sc) != 0) { | ||
317 | DPRINTF(sc, ATH_DBG_FATAL, | ||
318 | "Unable to restart recv logic\n"); | ||
319 | return -EIO; | ||
320 | } | ||
321 | 311 | ||
322 | ath_cache_conf_rate(sc, &hw->conf); | 312 | if (ath_startrecv(sc) != 0) { |
323 | ath_update_txpow(sc); | 313 | DPRINTF(sc, ATH_DBG_FATAL, |
324 | ath9k_hw_set_interrupts(ah, sc->sc_imask); | 314 | "Unable to restart recv logic\n"); |
315 | return -EIO; | ||
325 | } | 316 | } |
317 | |||
318 | ath_cache_conf_rate(sc, &hw->conf); | ||
319 | ath_update_txpow(sc); | ||
320 | ath9k_hw_set_interrupts(ah, sc->sc_imask); | ||
326 | return 0; | 321 | return 0; |
327 | } | 322 | } |
328 | 323 | ||