diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2013-02-28 04:55:30 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-06 10:35:58 -0500 |
commit | 153a5fc4107902a5e053bf4937a9250a1f8da574 (patch) | |
tree | 2da8d64b1c76be7d57601e566e9b3bf2d77fa912 | |
parent | 690205f18fd069898c70d743f498ba42798e5c4e (diff) |
mac80211: merge reconfig assign chanctx code
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/mac80211/util.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index f5d4e326b0c9..b7a856e3281b 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1357,6 +1357,25 @@ void ieee80211_stop_device(struct ieee80211_local *local) | |||
1357 | drv_stop(local); | 1357 | drv_stop(local); |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | static void ieee80211_assign_chanctx(struct ieee80211_local *local, | ||
1361 | struct ieee80211_sub_if_data *sdata) | ||
1362 | { | ||
1363 | struct ieee80211_chanctx_conf *conf; | ||
1364 | struct ieee80211_chanctx *ctx; | ||
1365 | |||
1366 | if (!local->use_chanctx) | ||
1367 | return; | ||
1368 | |||
1369 | mutex_lock(&local->chanctx_mtx); | ||
1370 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
1371 | lockdep_is_held(&local->chanctx_mtx)); | ||
1372 | if (conf) { | ||
1373 | ctx = container_of(conf, struct ieee80211_chanctx, conf); | ||
1374 | drv_assign_vif_chanctx(local, sdata, ctx); | ||
1375 | } | ||
1376 | mutex_unlock(&local->chanctx_mtx); | ||
1377 | } | ||
1378 | |||
1360 | int ieee80211_reconfig(struct ieee80211_local *local) | 1379 | int ieee80211_reconfig(struct ieee80211_local *local) |
1361 | { | 1380 | { |
1362 | struct ieee80211_hw *hw = &local->hw; | 1381 | struct ieee80211_hw *hw = &local->hw; |
@@ -1445,36 +1464,14 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1445 | } | 1464 | } |
1446 | 1465 | ||
1447 | list_for_each_entry(sdata, &local->interfaces, list) { | 1466 | list_for_each_entry(sdata, &local->interfaces, list) { |
1448 | struct ieee80211_chanctx_conf *ctx_conf; | ||
1449 | |||
1450 | if (!ieee80211_sdata_running(sdata)) | 1467 | if (!ieee80211_sdata_running(sdata)) |
1451 | continue; | 1468 | continue; |
1452 | 1469 | ieee80211_assign_chanctx(local, sdata); | |
1453 | mutex_lock(&local->chanctx_mtx); | ||
1454 | ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
1455 | lockdep_is_held(&local->chanctx_mtx)); | ||
1456 | if (ctx_conf) { | ||
1457 | ctx = container_of(ctx_conf, struct ieee80211_chanctx, | ||
1458 | conf); | ||
1459 | drv_assign_vif_chanctx(local, sdata, ctx); | ||
1460 | } | ||
1461 | mutex_unlock(&local->chanctx_mtx); | ||
1462 | } | 1470 | } |
1463 | 1471 | ||
1464 | sdata = rtnl_dereference(local->monitor_sdata); | 1472 | sdata = rtnl_dereference(local->monitor_sdata); |
1465 | if (sdata && local->use_chanctx && ieee80211_sdata_running(sdata)) { | 1473 | if (sdata && ieee80211_sdata_running(sdata)) |
1466 | struct ieee80211_chanctx_conf *ctx_conf; | 1474 | ieee80211_assign_chanctx(local, sdata); |
1467 | |||
1468 | mutex_lock(&local->chanctx_mtx); | ||
1469 | ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
1470 | lockdep_is_held(&local->chanctx_mtx)); | ||
1471 | if (ctx_conf) { | ||
1472 | ctx = container_of(ctx_conf, struct ieee80211_chanctx, | ||
1473 | conf); | ||
1474 | drv_assign_vif_chanctx(local, sdata, ctx); | ||
1475 | } | ||
1476 | mutex_unlock(&local->chanctx_mtx); | ||
1477 | } | ||
1478 | 1475 | ||
1479 | /* add STAs back */ | 1476 | /* add STAs back */ |
1480 | mutex_lock(&local->sta_mtx); | 1477 | mutex_lock(&local->sta_mtx); |