aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2012-06-26 08:37:20 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-16 14:22:43 -0400
commit35f2fce9a4376f89f2ebac705a2742ffc058f988 (patch)
tree38477539a474c08a68dbd4676016b6f36f61c250 /net/mac80211/chan.c
parentc3645eac479d9aaac9f8099c94bf681dc695dd34 (diff)
mac80211: use channel context notifications
Channel context pointer will be accessible on both assign and unassign events. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 4ae94860a161..ff3b29ec396a 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -5,6 +5,7 @@
5#include <linux/nl80211.h> 5#include <linux/nl80211.h>
6#include <net/cfg80211.h> 6#include <net/cfg80211.h>
7#include "ieee80211_i.h" 7#include "ieee80211_i.h"
8#include "driver-ops.h"
8 9
9static enum ieee80211_chan_mode 10static enum ieee80211_chan_mode
10__ieee80211_get_channel_mode(struct ieee80211_local *local, 11__ieee80211_get_channel_mode(struct ieee80211_local *local,
@@ -205,6 +206,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
205 enum ieee80211_chanctx_mode mode) 206 enum ieee80211_chanctx_mode mode)
206{ 207{
207 struct ieee80211_chanctx *ctx; 208 struct ieee80211_chanctx *ctx;
209 int err;
208 210
209 lockdep_assert_held(&local->chanctx_mtx); 211 lockdep_assert_held(&local->chanctx_mtx);
210 212
@@ -216,6 +218,12 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
216 ctx->conf.channel_type = channel_type; 218 ctx->conf.channel_type = channel_type;
217 ctx->mode = mode; 219 ctx->mode = mode;
218 220
221 err = drv_add_chanctx(local, ctx);
222 if (err) {
223 kfree(ctx);
224 return ERR_PTR(err);
225 }
226
219 list_add(&ctx->list, &local->chanctx_list); 227 list_add(&ctx->list, &local->chanctx_list);
220 228
221 return ctx; 229 return ctx;
@@ -228,6 +236,8 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local,
228 236
229 WARN_ON_ONCE(ctx->refcount != 0); 237 WARN_ON_ONCE(ctx->refcount != 0);
230 238
239 drv_remove_chanctx(local, ctx);
240
231 list_del(&ctx->list); 241 list_del(&ctx->list);
232 kfree_rcu(ctx, rcu_head); 242 kfree_rcu(ctx, rcu_head);
233} 243}
@@ -235,10 +245,15 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local,
235static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, 245static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
236 struct ieee80211_chanctx *ctx) 246 struct ieee80211_chanctx *ctx)
237{ 247{
238 struct ieee80211_local *local __maybe_unused = sdata->local; 248 struct ieee80211_local *local = sdata->local;
249 int ret;
239 250
240 lockdep_assert_held(&local->chanctx_mtx); 251 lockdep_assert_held(&local->chanctx_mtx);
241 252
253 ret = drv_assign_vif_chanctx(local, sdata, ctx);
254 if (ret)
255 return ret;
256
242 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf); 257 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf);
243 ctx->refcount++; 258 ctx->refcount++;
244 259
@@ -248,12 +263,14 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
248static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata, 263static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
249 struct ieee80211_chanctx *ctx) 264 struct ieee80211_chanctx *ctx)
250{ 265{
251 struct ieee80211_local *local __maybe_unused = sdata->local; 266 struct ieee80211_local *local = sdata->local;
252 267
253 lockdep_assert_held(&local->chanctx_mtx); 268 lockdep_assert_held(&local->chanctx_mtx);
254 269
255 ctx->refcount--; 270 ctx->refcount--;
256 rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); 271 rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
272
273 drv_unassign_vif_chanctx(local, sdata, ctx);
257} 274}
258 275
259static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) 276static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata)