aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-04-09 09:29:31 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-04-25 11:08:30 -0400
commit1f0d54cdcf822894cebebaa6cdc4e838c32bfb08 (patch)
treeb85f934fe7d5ced28f07e912636791066b231f34
parented68ebcaf9688a15cbd249476334d37717d49468 (diff)
mac80211: split ieee80211_free_chanctx()
The function did a little too much. Split it up so the code can be easily reused in the future. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/chan.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 247133fe36bc..e4166b3af5d4 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -431,14 +431,11 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
431 return ctx; 431 return ctx;
432} 432}
433 433
434static void ieee80211_free_chanctx(struct ieee80211_local *local, 434static void ieee80211_del_chanctx(struct ieee80211_local *local,
435 struct ieee80211_chanctx *ctx) 435 struct ieee80211_chanctx *ctx)
436{ 436{
437 bool check_single_channel = false;
438 lockdep_assert_held(&local->chanctx_mtx); 437 lockdep_assert_held(&local->chanctx_mtx);
439 438
440 WARN_ON_ONCE(ctx->refcount != 0);
441
442 if (!local->use_chanctx) { 439 if (!local->use_chanctx) {
443 struct cfg80211_chan_def *chandef = &local->_oper_chandef; 440 struct cfg80211_chan_def *chandef = &local->_oper_chandef;
444 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 441 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
@@ -448,8 +445,9 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local,
448 /* NOTE: Disabling radar is only valid here for 445 /* NOTE: Disabling radar is only valid here for
449 * single channel context. To be sure, check it ... 446 * single channel context. To be sure, check it ...
450 */ 447 */
451 if (local->hw.conf.radar_enabled) 448 WARN_ON(local->hw.conf.radar_enabled &&
452 check_single_channel = true; 449 !list_empty(&local->chanctx_list));
450
453 local->hw.conf.radar_enabled = false; 451 local->hw.conf.radar_enabled = false;
454 452
455 ieee80211_hw_config(local, 0); 453 ieee80211_hw_config(local, 0);
@@ -457,13 +455,19 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local,
457 drv_remove_chanctx(local, ctx); 455 drv_remove_chanctx(local, ctx);
458 } 456 }
459 457
460 list_del_rcu(&ctx->list); 458 ieee80211_recalc_idle(local);
461 kfree_rcu(ctx, rcu_head); 459}
462 460
463 /* throw a warning if this wasn't the only channel context. */ 461static void ieee80211_free_chanctx(struct ieee80211_local *local,
464 WARN_ON(check_single_channel && !list_empty(&local->chanctx_list)); 462 struct ieee80211_chanctx *ctx)
463{
464 lockdep_assert_held(&local->chanctx_mtx);
465 465
466 ieee80211_recalc_idle(local); 466 WARN_ON_ONCE(ctx->refcount != 0);
467
468 list_del_rcu(&ctx->list);
469 ieee80211_del_chanctx(local, ctx);
470 kfree_rcu(ctx, rcu_head);
467} 471}
468 472
469static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, 473static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,