diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-01-17 04:33:29 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-24 14:21:55 -0500 |
commit | 889cbb911a195b832745f77240f547cb2a2885bc (patch) | |
tree | 973a6325e082b0840a56a284a95b609134058c39 /net/mac80211/rate.c | |
parent | 151a02f693b866dd43e147725c818fc1ddb96aa3 (diff) |
mac80211: clean up rate control code
It seems exceedingly unlikely that we'll ever
support swapping rate control algorithms at
runtime, so remove the unused refcounting code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r-- | net/mac80211/rate.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 5a5a7767d541..a21110aecd1a 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -159,7 +159,6 @@ static struct rate_control_ref *rate_control_alloc(const char *name, | |||
159 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); | 159 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); |
160 | if (!ref) | 160 | if (!ref) |
161 | goto fail_ref; | 161 | goto fail_ref; |
162 | kref_init(&ref->kref); | ||
163 | ref->local = local; | 162 | ref->local = local; |
164 | ref->ops = ieee80211_rate_control_ops_get(name); | 163 | ref->ops = ieee80211_rate_control_ops_get(name); |
165 | if (!ref->ops) | 164 | if (!ref->ops) |
@@ -184,11 +183,8 @@ fail_ref: | |||
184 | return NULL; | 183 | return NULL; |
185 | } | 184 | } |
186 | 185 | ||
187 | static void rate_control_release(struct kref *kref) | 186 | static void rate_control_free(struct rate_control_ref *ctrl_ref) |
188 | { | 187 | { |
189 | struct rate_control_ref *ctrl_ref; | ||
190 | |||
191 | ctrl_ref = container_of(kref, struct rate_control_ref, kref); | ||
192 | ctrl_ref->ops->free(ctrl_ref->priv); | 188 | ctrl_ref->ops->free(ctrl_ref->priv); |
193 | 189 | ||
194 | #ifdef CONFIG_MAC80211_DEBUGFS | 190 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -383,21 +379,10 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | |||
383 | BUG_ON(info->control.rates[0].idx < 0); | 379 | BUG_ON(info->control.rates[0].idx < 0); |
384 | } | 380 | } |
385 | 381 | ||
386 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref) | ||
387 | { | ||
388 | kref_get(&ref->kref); | ||
389 | return ref; | ||
390 | } | ||
391 | |||
392 | void rate_control_put(struct rate_control_ref *ref) | ||
393 | { | ||
394 | kref_put(&ref->kref, rate_control_release); | ||
395 | } | ||
396 | |||
397 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | 382 | int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, |
398 | const char *name) | 383 | const char *name) |
399 | { | 384 | { |
400 | struct rate_control_ref *ref, *old; | 385 | struct rate_control_ref *ref; |
401 | 386 | ||
402 | ASSERT_RTNL(); | 387 | ASSERT_RTNL(); |
403 | 388 | ||
@@ -417,12 +402,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
417 | return -ENOENT; | 402 | return -ENOENT; |
418 | } | 403 | } |
419 | 404 | ||
420 | old = local->rate_ctrl; | 405 | WARN_ON(local->rate_ctrl); |
421 | local->rate_ctrl = ref; | 406 | local->rate_ctrl = ref; |
422 | if (old) { | ||
423 | rate_control_put(old); | ||
424 | sta_info_flush(local, NULL); | ||
425 | } | ||
426 | 407 | ||
427 | wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", | 408 | wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", |
428 | ref->ops->name); | 409 | ref->ops->name); |
@@ -440,6 +421,6 @@ void rate_control_deinitialize(struct ieee80211_local *local) | |||
440 | return; | 421 | return; |
441 | 422 | ||
442 | local->rate_ctrl = NULL; | 423 | local->rate_ctrl = NULL; |
443 | rate_control_put(ref); | 424 | rate_control_free(ref); |
444 | } | 425 | } |
445 | 426 | ||