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

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,
kfree(rate_priv);
}
static struct rate_control_ops ath_rate_ops = {
static const struct rate_control_ops ath_rate_ops = {
.module = NULL,
.name = "ath9k_rate_control",
.tx_status = ath_tx_status,
......
......@@ -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,
.name = RS_NAME,
.tx_status = il3945_rs_tx_status,
......
......@@ -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,
.name = IL4965_RS_NAME,
.tx_status = il4965_rs_tx_status,
......
......@@ -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)
{
}
static struct rate_control_ops rs_ops = {
static const struct rate_control_ops rs_ops = {
.module = NULL,
.name = RS_NAME,
.tx_status = rs_tx_status,
......
......@@ -2815,7 +2815,8 @@ static void rs_rate_init_stub(void *mvm_r,
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,
.name = RS_NAME,
.tx_status = rs_tx_status,
......
......@@ -260,7 +260,7 @@ static void rtl_rate_free_sta(void *rtlpriv,
kfree(rate_priv);
}
static struct rate_control_ops rtl_rate_ops = {
static const struct rate_control_ops rtl_rate_ops = {
.module = NULL,
.name = "rtl_rc",
.alloc = rtl_rate_alloc,
......
......@@ -4555,8 +4555,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta,
struct ieee80211_sta_rates *rates);
int ieee80211_rate_control_register(struct rate_control_ops *ops);
void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
int ieee80211_rate_control_register(const struct rate_control_ops *ops);
void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
static inline bool
conf_is_ht20(struct ieee80211_conf *conf)
......
......@@ -18,7 +18,7 @@
struct rate_control_alg {
struct list_head list;
struct rate_control_ops *ops;
const struct rate_control_ops *ops;
};
static LIST_HEAD(rate_ctrl_algs);
......@@ -29,7 +29,7 @@ module_param(ieee80211_default_rc_algo, charp, 0644);
MODULE_PARM_DESC(ieee80211_default_rc_algo,
"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;
......@@ -60,7 +60,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
}
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;
......@@ -76,11 +76,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
}
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)
{
struct rate_control_alg *alg;
struct rate_control_ops *ops = NULL;
const struct rate_control_ops *ops = NULL;
if (!name)
return NULL;
......@@ -98,10 +98,10 @@ ieee80211_try_rate_control_ops_get(const char *name)
}
/* Get the rate control algorithm. */
static struct rate_control_ops *
static const struct rate_control_ops *
ieee80211_rate_control_ops_get(const char *name)
{
struct rate_control_ops *ops;
const struct rate_control_ops *ops;
const char *alg_name;
kparam_block_sysfs_write(ieee80211_default_rc_algo);
......@@ -127,7 +127,7 @@ ieee80211_rate_control_ops_get(const char *name)
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);
}
......
......@@ -21,7 +21,7 @@
struct rate_control_ref {
struct ieee80211_local *local;
struct rate_control_ops *ops;
const struct rate_control_ops *ops;
void *priv;
};
......
......@@ -657,7 +657,7 @@ minstrel_free(void *priv)
kfree(priv);
}
struct rate_control_ops mac80211_minstrel = {
const struct rate_control_ops mac80211_minstrel = {
.name = "minstrel",
.tx_status = minstrel_tx_status,
.get_rate = minstrel_get_rate,
......
......@@ -123,7 +123,7 @@ struct minstrel_debugfs_info {
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_remove_sta_debugfs(void *priv, void *priv_sta);
......
......@@ -1031,7 +1031,7 @@ minstrel_ht_free(void *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",
.tx_status = minstrel_ht_tx_status,
.get_rate = minstrel_ht_get_rate,
......
......@@ -452,7 +452,7 @@ static void rate_control_pid_free_sta(void *priv, struct ieee80211_sta *sta,
kfree(priv_sta);
}
static struct rate_control_ops mac80211_rcpid = {
static const struct rate_control_ops mac80211_rcpid = {
.name = "pid",
.tx_status = rate_control_pid_tx_status,
.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