diff options
author | John W. Linville <linville@tuxdriver.com> | 2013-04-01 15:09:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-04-01 15:09:28 -0400 |
commit | 95bc6b8461d809d7573ad8cadae3f307a472c017 (patch) | |
tree | a3c53eda59b3f9303bce86ba92186495774fba78 /net/mac80211/chan.c | |
parent | 2e1253d640eb7f8707d2591c93097c1e9f9c71d5 (diff) | |
parent | 382a103b2b528a3085cde4ac56fc69d92a828b72 (diff) | |
download | op-kernel-dev-95bc6b8461d809d7573ad8cadae3f307a472c017.zip op-kernel-dev-95bc6b8461d809d7573ad8cadae3f307a472c017.tar.gz |
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r-- | net/mac80211/chan.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 78c0d90..931be41 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -63,6 +63,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local, enum ieee80211_chanctx_mode mode) { struct ieee80211_chanctx *ctx; + u32 changed; int err; lockdep_assert_held(&local->chanctx_mtx); @@ -76,6 +77,13 @@ ieee80211_new_chanctx(struct ieee80211_local *local, ctx->conf.rx_chains_dynamic = 1; ctx->mode = mode; + /* acquire mutex to prevent idle from changing */ + mutex_lock(&local->mtx); + /* turn idle off *before* setting channel -- some drivers need that */ + changed = ieee80211_idle_off(local); + if (changed) + ieee80211_hw_config(local, changed); + if (!local->use_chanctx) { local->_oper_channel_type = cfg80211_get_chandef_type(chandef); @@ -85,14 +93,17 @@ ieee80211_new_chanctx(struct ieee80211_local *local, err = drv_add_chanctx(local, ctx); if (err) { kfree(ctx); - return ERR_PTR(err); + ctx = ERR_PTR(err); + + ieee80211_recalc_idle(local); + goto out; } } + /* and keep the mutex held until the new chanctx is on the list */ list_add_rcu(&ctx->list, &local->chanctx_list); - mutex_lock(&local->mtx); - ieee80211_recalc_idle(local); + out: mutex_unlock(&local->mtx); return ctx; |