Commit 631ad703 authored by Johannes Berg's avatar Johannes Berg

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent c1cf6d4e
...@@ -1466,7 +1466,7 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta, ...@@ -1466,7 +1466,7 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
kfree(rate_priv); kfree(rate_priv);
} }
static struct rate_control_ops ath_rate_ops = { static const struct rate_control_ops ath_rate_ops = {
.module = NULL, .module = NULL,
.name = "ath9k_rate_control", .name = "ath9k_rate_control",
.tx_status = ath_tx_status, .tx_status = ath_tx_status,
......
...@@ -891,7 +891,7 @@ il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, ...@@ -891,7 +891,7 @@ il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
{ {
} }
static struct rate_control_ops rs_ops = { static const struct rate_control_ops rs_ops = {
.module = NULL, .module = NULL,
.name = RS_NAME, .name = RS_NAME,
.tx_status = il3945_rs_tx_status, .tx_status = il3945_rs_tx_status,
......
...@@ -2807,7 +2807,7 @@ il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, ...@@ -2807,7 +2807,7 @@ il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
{ {
} }
static struct rate_control_ops rs_4965_ops = { static const struct rate_control_ops rs_4965_ops = {
.module = NULL, .module = NULL,
.name = IL4965_RS_NAME, .name = IL4965_RS_NAME,
.tx_status = il4965_rs_tx_status, .tx_status = il4965_rs_tx_status,
......
...@@ -3319,7 +3319,8 @@ static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sba ...@@ -3319,7 +3319,8 @@ static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sba
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
} }
static struct rate_control_ops rs_ops = {
static const struct rate_control_ops rs_ops = {
.module = NULL, .module = NULL,
.name = RS_NAME, .name = RS_NAME,
.tx_status = rs_tx_status, .tx_status = rs_tx_status,
......
...@@ -2815,7 +2815,8 @@ static void rs_rate_init_stub(void *mvm_r, ...@@ -2815,7 +2815,8 @@ static void rs_rate_init_stub(void *mvm_r,
struct ieee80211_sta *sta, void *mvm_sta) struct ieee80211_sta *sta, void *mvm_sta)
{ {
} }
static struct rate_control_ops rs_mvm_ops = {
static const struct rate_control_ops rs_mvm_ops = {
.module = NULL, .module = NULL,
.name = RS_NAME, .name = RS_NAME,
.tx_status = rs_tx_status, .tx_status = rs_tx_status,
......
...@@ -260,7 +260,7 @@ static void rtl_rate_free_sta(void *rtlpriv, ...@@ -260,7 +260,7 @@ static void rtl_rate_free_sta(void *rtlpriv,
kfree(rate_priv); kfree(rate_priv);
} }
static struct rate_control_ops rtl_rate_ops = { static const struct rate_control_ops rtl_rate_ops = {
.module = NULL, .module = NULL,
.name = "rtl_rc", .name = "rtl_rc",
.alloc = rtl_rate_alloc, .alloc = rtl_rate_alloc,
......
...@@ -4555,8 +4555,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw, ...@@ -4555,8 +4555,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta, struct ieee80211_sta *pubsta,
struct ieee80211_sta_rates *rates); struct ieee80211_sta_rates *rates);
int ieee80211_rate_control_register(struct rate_control_ops *ops); int ieee80211_rate_control_register(const struct rate_control_ops *ops);
void ieee80211_rate_control_unregister(struct rate_control_ops *ops); void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
static inline bool static inline bool
conf_is_ht20(struct ieee80211_conf *conf) conf_is_ht20(struct ieee80211_conf *conf)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
struct rate_control_alg { struct rate_control_alg {
struct list_head list; struct list_head list;
struct rate_control_ops *ops; const struct rate_control_ops *ops;
}; };
static LIST_HEAD(rate_ctrl_algs); static LIST_HEAD(rate_ctrl_algs);
...@@ -29,7 +29,7 @@ module_param(ieee80211_default_rc_algo, charp, 0644); ...@@ -29,7 +29,7 @@ module_param(ieee80211_default_rc_algo, charp, 0644);
MODULE_PARM_DESC(ieee80211_default_rc_algo, MODULE_PARM_DESC(ieee80211_default_rc_algo,
"Default rate control algorithm for mac80211 to use"); "Default rate control algorithm for mac80211 to use");
int ieee80211_rate_control_register(struct rate_control_ops *ops) int ieee80211_rate_control_register(const struct rate_control_ops *ops)
{ {
struct rate_control_alg *alg; struct rate_control_alg *alg;
...@@ -60,7 +60,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops) ...@@ -60,7 +60,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
} }
EXPORT_SYMBOL(ieee80211_rate_control_register); EXPORT_SYMBOL(ieee80211_rate_control_register);
void ieee80211_rate_control_unregister(struct rate_control_ops *ops) void ieee80211_rate_control_unregister(const struct rate_control_ops *ops)
{ {
struct rate_control_alg *alg; struct rate_control_alg *alg;
...@@ -76,11 +76,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops) ...@@ -76,11 +76,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
} }
EXPORT_SYMBOL(ieee80211_rate_control_unregister); EXPORT_SYMBOL(ieee80211_rate_control_unregister);
static struct rate_control_ops * static const struct rate_control_ops *
ieee80211_try_rate_control_ops_get(const char *name) ieee80211_try_rate_control_ops_get(const char *name)
{ {
struct rate_control_alg *alg; struct rate_control_alg *alg;
struct rate_control_ops *ops = NULL; const struct rate_control_ops *ops = NULL;
if (!name) if (!name)
return NULL; return NULL;
...@@ -98,10 +98,10 @@ ieee80211_try_rate_control_ops_get(const char *name) ...@@ -98,10 +98,10 @@ ieee80211_try_rate_control_ops_get(const char *name)
} }
/* Get the rate control algorithm. */ /* Get the rate control algorithm. */
static struct rate_control_ops * static const struct rate_control_ops *
ieee80211_rate_control_ops_get(const char *name) ieee80211_rate_control_ops_get(const char *name)
{ {
struct rate_control_ops *ops; const struct rate_control_ops *ops;
const char *alg_name; const char *alg_name;
kparam_block_sysfs_write(ieee80211_default_rc_algo); kparam_block_sysfs_write(ieee80211_default_rc_algo);
...@@ -127,7 +127,7 @@ ieee80211_rate_control_ops_get(const char *name) ...@@ -127,7 +127,7 @@ ieee80211_rate_control_ops_get(const char *name)
return ops; return ops;
} }
static void ieee80211_rate_control_ops_put(struct rate_control_ops *ops) static void ieee80211_rate_control_ops_put(const struct rate_control_ops *ops)
{ {
module_put(ops->module); module_put(ops->module);
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
struct rate_control_ref { struct rate_control_ref {
struct ieee80211_local *local; struct ieee80211_local *local;
struct rate_control_ops *ops; const struct rate_control_ops *ops;
void *priv; void *priv;
}; };
......
...@@ -657,7 +657,7 @@ minstrel_free(void *priv) ...@@ -657,7 +657,7 @@ minstrel_free(void *priv)
kfree(priv); kfree(priv);
} }
struct rate_control_ops mac80211_minstrel = { const struct rate_control_ops mac80211_minstrel = {
.name = "minstrel", .name = "minstrel",
.tx_status = minstrel_tx_status, .tx_status = minstrel_tx_status,
.get_rate = minstrel_get_rate, .get_rate = minstrel_get_rate,
......
...@@ -123,7 +123,7 @@ struct minstrel_debugfs_info { ...@@ -123,7 +123,7 @@ struct minstrel_debugfs_info {
char buf[]; char buf[];
}; };
extern struct rate_control_ops mac80211_minstrel; extern const struct rate_control_ops mac80211_minstrel;
void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
......
...@@ -1031,7 +1031,7 @@ minstrel_ht_free(void *priv) ...@@ -1031,7 +1031,7 @@ minstrel_ht_free(void *priv)
mac80211_minstrel.free(priv); mac80211_minstrel.free(priv);
} }
static struct rate_control_ops mac80211_minstrel_ht = { static const struct rate_control_ops mac80211_minstrel_ht = {
.name = "minstrel_ht", .name = "minstrel_ht",
.tx_status = minstrel_ht_tx_status, .tx_status = minstrel_ht_tx_status,
.get_rate = minstrel_ht_get_rate, .get_rate = minstrel_ht_get_rate,
......
...@@ -452,7 +452,7 @@ static void rate_control_pid_free_sta(void *priv, struct ieee80211_sta *sta, ...@@ -452,7 +452,7 @@ static void rate_control_pid_free_sta(void *priv, struct ieee80211_sta *sta,
kfree(priv_sta); kfree(priv_sta);
} }
static struct rate_control_ops mac80211_rcpid = { static const struct rate_control_ops mac80211_rcpid = {
.name = "pid", .name = "pid",
.tx_status = rate_control_pid_tx_status, .tx_status = rate_control_pid_tx_status,
.get_rate = rate_control_pid_get_rate, .get_rate = rate_control_pid_get_rate,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment