aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-01-20 17:29:34 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-02-04 15:48:21 -0500
commit631ad703ba3a585e96acbfd2ac8c0f0fee1ad99b (patch)
tree8c65d36d787a5ef4e2aa6e9ac7306e22349dfcb2 /net
parentc1cf6d4e6f17406c4fd7b0f4fae779fa61666cc3 (diff)
mac80211: make rate control ops const
Change the code to allow making all the rate control ops const, nothing ever needs to change them. Also change all drivers to make use of this and mark the ops const. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/rate.c16
-rw-r--r--net/mac80211/rate.h2
-rw-r--r--net/mac80211/rc80211_minstrel.c2
-rw-r--r--net/mac80211/rc80211_minstrel.h2
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c2
-rw-r--r--net/mac80211/rc80211_pid_algo.c2
6 files changed, 13 insertions, 13 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 22b223f13c9f..255b59e616d0 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -18,7 +18,7 @@
18 18
19struct rate_control_alg { 19struct rate_control_alg {
20 struct list_head list; 20 struct list_head list;
21 struct rate_control_ops *ops; 21 const struct rate_control_ops *ops;
22}; 22};
23 23
24static LIST_HEAD(rate_ctrl_algs); 24static LIST_HEAD(rate_ctrl_algs);
@@ -29,7 +29,7 @@ module_param(ieee80211_default_rc_algo, charp, 0644);
29MODULE_PARM_DESC(ieee80211_default_rc_algo, 29MODULE_PARM_DESC(ieee80211_default_rc_algo,
30 "Default rate control algorithm for mac80211 to use"); 30 "Default rate control algorithm for mac80211 to use");
31 31
32int ieee80211_rate_control_register(struct rate_control_ops *ops) 32int ieee80211_rate_control_register(const struct rate_control_ops *ops)
33{ 33{
34 struct rate_control_alg *alg; 34 struct rate_control_alg *alg;
35 35
@@ -60,7 +60,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
60} 60}
61EXPORT_SYMBOL(ieee80211_rate_control_register); 61EXPORT_SYMBOL(ieee80211_rate_control_register);
62 62
63void ieee80211_rate_control_unregister(struct rate_control_ops *ops) 63void ieee80211_rate_control_unregister(const struct rate_control_ops *ops)
64{ 64{
65 struct rate_control_alg *alg; 65 struct rate_control_alg *alg;
66 66
@@ -76,11 +76,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
76} 76}
77EXPORT_SYMBOL(ieee80211_rate_control_unregister); 77EXPORT_SYMBOL(ieee80211_rate_control_unregister);
78 78
79static struct rate_control_ops * 79static const struct rate_control_ops *
80ieee80211_try_rate_control_ops_get(const char *name) 80ieee80211_try_rate_control_ops_get(const char *name)
81{ 81{
82 struct rate_control_alg *alg; 82 struct rate_control_alg *alg;
83 struct rate_control_ops *ops = NULL; 83 const struct rate_control_ops *ops = NULL;
84 84
85 if (!name) 85 if (!name)
86 return NULL; 86 return NULL;
@@ -98,10 +98,10 @@ ieee80211_try_rate_control_ops_get(const char *name)
98} 98}
99 99
100/* Get the rate control algorithm. */ 100/* Get the rate control algorithm. */
101static struct rate_control_ops * 101static const struct rate_control_ops *
102ieee80211_rate_control_ops_get(const char *name) 102ieee80211_rate_control_ops_get(const char *name)
103{ 103{
104 struct rate_control_ops *ops; 104 const struct rate_control_ops *ops;
105 const char *alg_name; 105 const char *alg_name;
106 106
107 kparam_block_sysfs_write(ieee80211_default_rc_algo); 107 kparam_block_sysfs_write(ieee80211_default_rc_algo);
@@ -127,7 +127,7 @@ ieee80211_rate_control_ops_get(const char *name)
127 return ops; 127 return ops;
128} 128}
129 129
130static void ieee80211_rate_control_ops_put(struct rate_control_ops *ops) 130static void ieee80211_rate_control_ops_put(const struct rate_control_ops *ops)
131{ 131{
132 module_put(ops->module); 132 module_put(ops->module);
133} 133}
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index b95e16c07081..9aa2a1190a86 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -21,7 +21,7 @@
21 21
22struct rate_control_ref { 22struct rate_control_ref {
23 struct ieee80211_local *local; 23 struct ieee80211_local *local;
24 struct rate_control_ops *ops; 24 const struct rate_control_ops *ops;
25 void *priv; 25 void *priv;
26}; 26};
27 27
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index f3d88b0c054c..26fd94fa0aed 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -657,7 +657,7 @@ minstrel_free(void *priv)
657 kfree(priv); 657 kfree(priv);
658} 658}
659 659
660struct rate_control_ops mac80211_minstrel = { 660const struct rate_control_ops mac80211_minstrel = {
661 .name = "minstrel", 661 .name = "minstrel",
662 .tx_status = minstrel_tx_status, 662 .tx_status = minstrel_tx_status,
663 .get_rate = minstrel_get_rate, 663 .get_rate = minstrel_get_rate,
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h
index f4301f4b2e41..046d1bd598a8 100644
--- a/net/mac80211/rc80211_minstrel.h
+++ b/net/mac80211/rc80211_minstrel.h
@@ -123,7 +123,7 @@ struct minstrel_debugfs_info {
123 char buf[]; 123 char buf[];
124}; 124};
125 125
126extern struct rate_control_ops mac80211_minstrel; 126extern const struct rate_control_ops mac80211_minstrel;
127void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); 127void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
128void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); 128void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
129 129
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index c1b5b73c5b91..a6d6cc5c3db4 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1031,7 +1031,7 @@ minstrel_ht_free(void *priv)
1031 mac80211_minstrel.free(priv); 1031 mac80211_minstrel.free(priv);
1032} 1032}
1033 1033
1034static struct rate_control_ops mac80211_minstrel_ht = { 1034static const struct rate_control_ops mac80211_minstrel_ht = {
1035 .name = "minstrel_ht", 1035 .name = "minstrel_ht",
1036 .tx_status = minstrel_ht_tx_status, 1036 .tx_status = minstrel_ht_tx_status,
1037 .get_rate = minstrel_ht_get_rate, 1037 .get_rate = minstrel_ht_get_rate,
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 958fad07b54c..d0da2a70fe68 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -452,7 +452,7 @@ static void rate_control_pid_free_sta(void *priv, struct ieee80211_sta *sta,
452 kfree(priv_sta); 452 kfree(priv_sta);
453} 453}
454 454
455static struct rate_control_ops mac80211_rcpid = { 455static const struct rate_control_ops mac80211_rcpid = {
456 .name = "pid", 456 .name = "pid",
457 .tx_status = rate_control_pid_tx_status, 457 .tx_status = rate_control_pid_tx_status,
458 .get_rate = rate_control_pid_get_rate, 458 .get_rate = rate_control_pid_get_rate,