diff options
author | Rajkumar Manoharan <rmanohar@qti.qualcomm.com> | 2014-06-11 06:47:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-06-19 15:49:18 -0400 |
commit | c4dc0d040e356efc0263e0b27181b05f9ef33e5f (patch) | |
tree | a2a694b3925d7d3a89993900c082172c7fc78d1c /drivers/net/wireless/ath/ath9k/main.c | |
parent | 3930563570d3714420a2ebe0324a917ff64e0422 (diff) |
ath9k: Fetch appropriate operating channel context
Retrieve appropriate operating channel context while switching
between operating and off channels.
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index e0cb2af51767..92bf9079184f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -2161,7 +2161,8 @@ ath_scan_next_channel(struct ath_softc *sc) | |||
2161 | 2161 | ||
2162 | if (sc->offchannel.scan_idx >= req->n_channels) { | 2162 | if (sc->offchannel.scan_idx >= req->n_channels) { |
2163 | sc->offchannel.state = ATH_OFFCHANNEL_IDLE; | 2163 | sc->offchannel.state = ATH_OFFCHANNEL_IDLE; |
2164 | ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc), NULL); | 2164 | ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false), |
2165 | NULL); | ||
2165 | return; | 2166 | return; |
2166 | } | 2167 | } |
2167 | 2168 | ||
@@ -2184,7 +2185,8 @@ static void ath_offchannel_next(struct ath_softc *sc) | |||
2184 | sc->offchannel.state = ATH_OFFCHANNEL_ROC_START; | 2185 | sc->offchannel.state = ATH_OFFCHANNEL_ROC_START; |
2185 | ath_chanctx_offchan_switch(sc, sc->offchannel.roc_chan); | 2186 | ath_chanctx_offchan_switch(sc, sc->offchannel.roc_chan); |
2186 | } else { | 2187 | } else { |
2187 | ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc), NULL); | 2188 | ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false), |
2189 | NULL); | ||
2188 | sc->offchannel.state = ATH_OFFCHANNEL_IDLE; | 2190 | sc->offchannel.state = ATH_OFFCHANNEL_IDLE; |
2189 | if (sc->ps_idle) | 2191 | if (sc->ps_idle) |
2190 | ath_cancel_work(sc); | 2192 | ath_cancel_work(sc); |
@@ -2310,13 +2312,15 @@ void ath_offchannel_channel_change(struct ath_softc *sc) | |||
2310 | void ath_offchannel_timer(unsigned long data) | 2312 | void ath_offchannel_timer(unsigned long data) |
2311 | { | 2313 | { |
2312 | struct ath_softc *sc = (struct ath_softc *)data; | 2314 | struct ath_softc *sc = (struct ath_softc *)data; |
2313 | struct ath_chanctx *ctx = ath_chanctx_get_oper_chan(sc); | 2315 | struct ath_chanctx *ctx; |
2314 | 2316 | ||
2315 | switch (sc->offchannel.state) { | 2317 | switch (sc->offchannel.state) { |
2316 | case ATH_OFFCHANNEL_PROBE_WAIT: | 2318 | case ATH_OFFCHANNEL_PROBE_WAIT: |
2317 | if (!sc->offchannel.scan_req) | 2319 | if (!sc->offchannel.scan_req) |
2318 | return; | 2320 | return; |
2319 | 2321 | ||
2322 | /* get first active channel context */ | ||
2323 | ctx = ath_chanctx_get_oper_chan(sc, true); | ||
2320 | if (ctx->active) { | 2324 | if (ctx->active) { |
2321 | sc->offchannel.state = ATH_OFFCHANNEL_SUSPEND; | 2325 | sc->offchannel.state = ATH_OFFCHANNEL_SUSPEND; |
2322 | ath_chanctx_switch(sc, ctx, NULL); | 2326 | ath_chanctx_switch(sc, ctx, NULL); |
@@ -2332,6 +2336,7 @@ void ath_offchannel_timer(unsigned long data) | |||
2332 | break; | 2336 | break; |
2333 | case ATH_OFFCHANNEL_ROC_START: | 2337 | case ATH_OFFCHANNEL_ROC_START: |
2334 | case ATH_OFFCHANNEL_ROC_WAIT: | 2338 | case ATH_OFFCHANNEL_ROC_WAIT: |
2339 | ctx = ath_chanctx_get_oper_chan(sc, false); | ||
2335 | sc->offchannel.state = ATH_OFFCHANNEL_ROC_DONE; | 2340 | sc->offchannel.state = ATH_OFFCHANNEL_ROC_DONE; |
2336 | ath_chanctx_switch(sc, ctx, NULL); | 2341 | ath_chanctx_switch(sc, ctx, NULL); |
2337 | break; | 2342 | break; |
@@ -2432,26 +2437,22 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw, | |||
2432 | { | 2437 | { |
2433 | struct ath_softc *sc = hw->priv; | 2438 | struct ath_softc *sc = hw->priv; |
2434 | struct ath_chanctx *ctx, **ptr; | 2439 | struct ath_chanctx *ctx, **ptr; |
2435 | int i; | ||
2436 | 2440 | ||
2437 | mutex_lock(&sc->mutex); | 2441 | mutex_lock(&sc->mutex); |
2438 | for (i = 0; i < ATH9K_NUM_CHANCTX; i++) { | 2442 | |
2439 | if (!sc->chanctx[i].assigned) | 2443 | ath_for_each_chanctx(sc, ctx) { |
2440 | break; | 2444 | if (ctx->assigned) |
2441 | } | 2445 | continue; |
2442 | if (i == ATH9K_NUM_CHANCTX) { | 2446 | |
2447 | ptr = (void *) conf->drv_priv; | ||
2448 | *ptr = ctx; | ||
2449 | ctx->assigned = true; | ||
2450 | ath_chanctx_set_channel(sc, ctx, &conf->def); | ||
2443 | mutex_unlock(&sc->mutex); | 2451 | mutex_unlock(&sc->mutex); |
2444 | return -ENOSPC; | 2452 | return 0; |
2445 | } | 2453 | } |
2446 | |||
2447 | ctx = &sc->chanctx[i]; | ||
2448 | ptr = (void *) conf->drv_priv; | ||
2449 | *ptr = ctx; | ||
2450 | ctx->assigned = true; | ||
2451 | ath_chanctx_set_channel(sc, ctx, &conf->def); | ||
2452 | mutex_unlock(&sc->mutex); | 2454 | mutex_unlock(&sc->mutex); |
2453 | 2455 | return -ENOSPC; | |
2454 | return 0; | ||
2455 | } | 2456 | } |
2456 | 2457 | ||
2457 | 2458 | ||