aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-01-22 04:36:59 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-02-04 15:48:26 -0500
commitcc01f9b55fe77831a3ef63c0c461ca76540cee88 (patch)
tree6c4d59242e07feb57068c6beeb40d3443863cdb2
parentf6e1a73b66bdf41765e762eda0f4ecb7d987ea57 (diff)
mac80211: remove module handling from rate control ops
There's not a single rate control algorithm actually in a separate module where the module refcount would be required. Similarly, there's no specific rate control module. Therefore, all the module handling code in rate control is really just dead code, so remove it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c1
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c1
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c1
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rc.c1
-rw-r--r--include/net/mac80211.h1
-rw-r--r--net/mac80211/rate.c32
8 files changed, 9 insertions, 30 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 1219532e908a..7b5afee141da 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1467,7 +1467,6 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
1467} 1467}
1468 1468
1469static const struct rate_control_ops ath_rate_ops = { 1469static const struct rate_control_ops ath_rate_ops = {
1470 .module = NULL,
1471 .name = "ath9k_rate_control", 1470 .name = "ath9k_rate_control",
1472 .tx_status = ath_tx_status, 1471 .tx_status = ath_tx_status,
1473 .get_rate = ath_get_rate, 1472 .get_rate = ath_get_rate,
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 7088c6a89455..76b0729ade17 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -892,7 +892,6 @@ il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
892} 892}
893 893
894static const struct rate_control_ops rs_ops = { 894static const struct rate_control_ops rs_ops = {
895 .module = NULL,
896 .name = RS_NAME, 895 .name = RS_NAME,
897 .tx_status = il3945_rs_tx_status, 896 .tx_status = il3945_rs_tx_status,
898 .get_rate = il3945_rs_get_rate, 897 .get_rate = il3945_rs_get_rate,
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index cdbfc1d30b98..eaaeea19d8c5 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2808,7 +2808,6 @@ il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
2808} 2808}
2809 2809
2810static const struct rate_control_ops rs_4965_ops = { 2810static const struct rate_control_ops rs_4965_ops = {
2811 .module = NULL,
2812 .name = IL4965_RS_NAME, 2811 .name = IL4965_RS_NAME,
2813 .tx_status = il4965_rs_tx_status, 2812 .tx_status = il4965_rs_tx_status,
2814 .get_rate = il4965_rs_get_rate, 2813 .get_rate = il4965_rs_get_rate,
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index c4dded8d8091..592365ae46b6 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -3321,7 +3321,6 @@ static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sba
3321} 3321}
3322 3322
3323static const struct rate_control_ops rs_ops = { 3323static const struct rate_control_ops rs_ops = {
3324 .module = NULL,
3325 .name = RS_NAME, 3324 .name = RS_NAME,
3326 .tx_status = rs_tx_status, 3325 .tx_status = rs_tx_status,
3327 .get_rate = rs_get_rate, 3326 .get_rate = rs_get_rate,
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 22f1953880b6..c49e3a4c63ed 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -2817,7 +2817,6 @@ static void rs_rate_init_stub(void *mvm_r,
2817} 2817}
2818 2818
2819static const struct rate_control_ops rs_mvm_ops = { 2819static const struct rate_control_ops rs_mvm_ops = {
2820 .module = NULL,
2821 .name = RS_NAME, 2820 .name = RS_NAME,
2822 .tx_status = rs_tx_status, 2821 .tx_status = rs_tx_status,
2823 .get_rate = rs_get_rate, 2822 .get_rate = rs_get_rate,
diff --git a/drivers/net/wireless/rtlwifi/rc.c b/drivers/net/wireless/rtlwifi/rc.c
index 1503d9e5bc9f..ee28a1a3d010 100644
--- a/drivers/net/wireless/rtlwifi/rc.c
+++ b/drivers/net/wireless/rtlwifi/rc.c
@@ -261,7 +261,6 @@ static void rtl_rate_free_sta(void *rtlpriv,
261} 261}
262 262
263static const struct rate_control_ops rtl_rate_ops = { 263static const struct rate_control_ops rtl_rate_ops = {
264 .module = NULL,
265 .name = "rtl_rc", 264 .name = "rtl_rc",
266 .alloc = rtl_rate_alloc, 265 .alloc = rtl_rate_alloc,
267 .free = rtl_rate_free, 266 .free = rtl_rate_free,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0c2676e2a1f8..f844770b7fd4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4453,7 +4453,6 @@ struct ieee80211_tx_rate_control {
4453}; 4453};
4454 4454
4455struct rate_control_ops { 4455struct rate_control_ops {
4456 struct module *module;
4457 const char *name; 4456 const char *name;
4458 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 4457 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
4459 void (*free)(void *priv); 4458 void (*free)(void *priv);
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 255b59e616d0..8fdadfd94ba8 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -10,8 +10,8 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/rtnetlink.h> 12#include <linux/rtnetlink.h>
13#include <linux/slab.h>
14#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/slab.h>
15#include "rate.h" 15#include "rate.h"
16#include "ieee80211_i.h" 16#include "ieee80211_i.h"
17#include "debugfs.h" 17#include "debugfs.h"
@@ -87,11 +87,10 @@ ieee80211_try_rate_control_ops_get(const char *name)
87 87
88 mutex_lock(&rate_ctrl_mutex); 88 mutex_lock(&rate_ctrl_mutex);
89 list_for_each_entry(alg, &rate_ctrl_algs, list) { 89 list_for_each_entry(alg, &rate_ctrl_algs, list) {
90 if (!strcmp(alg->ops->name, name)) 90 if (!strcmp(alg->ops->name, name)) {
91 if (try_module_get(alg->ops->module)) { 91 ops = alg->ops;
92 ops = alg->ops; 92 break;
93 break; 93 }
94 }
95 } 94 }
96 mutex_unlock(&rate_ctrl_mutex); 95 mutex_unlock(&rate_ctrl_mutex);
97 return ops; 96 return ops;
@@ -111,10 +110,6 @@ ieee80211_rate_control_ops_get(const char *name)
111 alg_name = name; 110 alg_name = name;
112 111
113 ops = ieee80211_try_rate_control_ops_get(alg_name); 112 ops = ieee80211_try_rate_control_ops_get(alg_name);
114 if (!ops) {
115 request_module("rc80211_%s", alg_name);
116 ops = ieee80211_try_rate_control_ops_get(alg_name);
117 }
118 if (!ops && name) 113 if (!ops && name)
119 /* try default if specific alg requested but not found */ 114 /* try default if specific alg requested but not found */
120 ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); 115 ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
@@ -127,11 +122,6 @@ ieee80211_rate_control_ops_get(const char *name)
127 return ops; 122 return ops;
128} 123}
129 124
130static void ieee80211_rate_control_ops_put(const struct rate_control_ops *ops)
131{
132 module_put(ops->module);
133}
134
135#ifdef CONFIG_MAC80211_DEBUGFS 125#ifdef CONFIG_MAC80211_DEBUGFS
136static ssize_t rcname_read(struct file *file, char __user *userbuf, 126static ssize_t rcname_read(struct file *file, char __user *userbuf,
137 size_t count, loff_t *ppos) 127 size_t count, loff_t *ppos)
@@ -158,11 +148,11 @@ static struct rate_control_ref *rate_control_alloc(const char *name,
158 148
159 ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); 149 ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL);
160 if (!ref) 150 if (!ref)
161 goto fail_ref; 151 return NULL;
162 ref->local = local; 152 ref->local = local;
163 ref->ops = ieee80211_rate_control_ops_get(name); 153 ref->ops = ieee80211_rate_control_ops_get(name);
164 if (!ref->ops) 154 if (!ref->ops)
165 goto fail_ops; 155 goto free;
166 156
167#ifdef CONFIG_MAC80211_DEBUGFS 157#ifdef CONFIG_MAC80211_DEBUGFS
168 debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); 158 debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
@@ -172,14 +162,11 @@ static struct rate_control_ref *rate_control_alloc(const char *name,
172 162
173 ref->priv = ref->ops->alloc(&local->hw, debugfsdir); 163 ref->priv = ref->ops->alloc(&local->hw, debugfsdir);
174 if (!ref->priv) 164 if (!ref->priv)
175 goto fail_priv; 165 goto free;
176 return ref; 166 return ref;
177 167
178fail_priv: 168free:
179 ieee80211_rate_control_ops_put(ref->ops);
180fail_ops:
181 kfree(ref); 169 kfree(ref);
182fail_ref:
183 return NULL; 170 return NULL;
184} 171}
185 172
@@ -192,7 +179,6 @@ static void rate_control_free(struct rate_control_ref *ctrl_ref)
192 ctrl_ref->local->debugfs.rcdir = NULL; 179 ctrl_ref->local->debugfs.rcdir = NULL;
193#endif 180#endif
194 181
195 ieee80211_rate_control_ops_put(ctrl_ref->ops);
196 kfree(ctrl_ref); 182 kfree(ctrl_ref);
197} 183}
198 184