mac80211: remove module handling from rate control ops
authorJohannes Berg <johannes.berg@intel.com>
Wed, 22 Jan 2014 09:36:59 +0000 (10:36 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 4 Feb 2014 20:48:26 +0000 (21:48 +0100)
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>
drivers/net/wireless/ath/ath9k/rc.c
drivers/net/wireless/iwlegacy/3945-rs.c
drivers/net/wireless/iwlegacy/4965-rs.c
drivers/net/wireless/iwlwifi/dvm/rs.c
drivers/net/wireless/iwlwifi/mvm/rs.c
drivers/net/wireless/rtlwifi/rc.c
include/net/mac80211.h
net/mac80211/rate.c

index 1219532e908afabd278360b98c0f69bfae0d97e7..7b5afee141dacecab4af81b90d543b3a57d822bf 100644 (file)
@@ -1467,7 +1467,6 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
 }
 
 static const struct rate_control_ops ath_rate_ops = {
-       .module = NULL,
        .name = "ath9k_rate_control",
        .tx_status = ath_tx_status,
        .get_rate = ath_get_rate,
index 7088c6a89455192e416bdb3066b474670e956635..76b0729ade17ee2d18cc42df934f286762c2c155 100644 (file)
@@ -892,7 +892,6 @@ il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
 }
 
 static const struct rate_control_ops rs_ops = {
-       .module = NULL,
        .name = RS_NAME,
        .tx_status = il3945_rs_tx_status,
        .get_rate = il3945_rs_get_rate,
index cdbfc1d30b982a70f3cba4c44c82608c32e40978..eaaeea19d8c5bcc99d887ee7b3fd9c592b897045 100644 (file)
@@ -2808,7 +2808,6 @@ il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
 }
 
 static const struct rate_control_ops rs_4965_ops = {
-       .module = NULL,
        .name = IL4965_RS_NAME,
        .tx_status = il4965_rs_tx_status,
        .get_rate = il4965_rs_get_rate,
index c4dded8d8091d9bebea154802d15b9dc8c097a86..592365ae46b6d0299060f8b35e2c860f2cf3cf09 100644 (file)
@@ -3321,7 +3321,6 @@ static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sba
 }
 
 static const struct rate_control_ops rs_ops = {
-       .module = NULL,
        .name = RS_NAME,
        .tx_status = rs_tx_status,
        .get_rate = rs_get_rate,
index 22f1953880b629222e1fde314baafe0b62dff37c..c49e3a4c63ed4a370bd9e700b53256858cdada1c 100644 (file)
@@ -2817,7 +2817,6 @@ static void rs_rate_init_stub(void *mvm_r,
 }
 
 static const struct rate_control_ops rs_mvm_ops = {
-       .module = NULL,
        .name = RS_NAME,
        .tx_status = rs_tx_status,
        .get_rate = rs_get_rate,
index 1503d9e5bc9f04713153568ba9d4ad7bb76d1297..ee28a1a3d0100deeb0b3a50296109e814528a85e 100644 (file)
@@ -261,7 +261,6 @@ static void rtl_rate_free_sta(void *rtlpriv,
 }
 
 static const struct rate_control_ops rtl_rate_ops = {
-       .module = NULL,
        .name = "rtl_rc",
        .alloc = rtl_rate_alloc,
        .free = rtl_rate_free,
index 0c2676e2a1f8c123467c1a1c6d4383064bfa326b..f844770b7fd4360bd1a11bcec3b2975e06390f22 100644 (file)
@@ -4453,7 +4453,6 @@ struct ieee80211_tx_rate_control {
 };
 
 struct rate_control_ops {
-       struct module *module;
        const char *name;
        void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
        void (*free)(void *priv);
index 255b59e616d00937a7fdd2ee12e35f79b67cd711..8fdadfd94ba8576ae8bc0ee2e99e8c656c2f6a5b 100644 (file)
@@ -10,8 +10,8 @@
 
 #include <linux/kernel.h>
 #include <linux/rtnetlink.h>
-#include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include "rate.h"
 #include "ieee80211_i.h"
 #include "debugfs.h"
@@ -87,11 +87,10 @@ ieee80211_try_rate_control_ops_get(const char *name)
 
        mutex_lock(&rate_ctrl_mutex);
        list_for_each_entry(alg, &rate_ctrl_algs, list) {
-               if (!strcmp(alg->ops->name, name))
-                       if (try_module_get(alg->ops->module)) {
-                               ops = alg->ops;
-                               break;
-                       }
+               if (!strcmp(alg->ops->name, name)) {
+                       ops = alg->ops;
+                       break;
+               }
        }
        mutex_unlock(&rate_ctrl_mutex);
        return ops;
@@ -111,10 +110,6 @@ ieee80211_rate_control_ops_get(const char *name)
                alg_name = name;
 
        ops = ieee80211_try_rate_control_ops_get(alg_name);
-       if (!ops) {
-               request_module("rc80211_%s", alg_name);
-               ops = ieee80211_try_rate_control_ops_get(alg_name);
-       }
        if (!ops && name)
                /* try default if specific alg requested but not found */
                ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
@@ -127,11 +122,6 @@ ieee80211_rate_control_ops_get(const char *name)
        return ops;
 }
 
-static void ieee80211_rate_control_ops_put(const struct rate_control_ops *ops)
-{
-       module_put(ops->module);
-}
-
 #ifdef CONFIG_MAC80211_DEBUGFS
 static ssize_t rcname_read(struct file *file, char __user *userbuf,
                           size_t count, loff_t *ppos)
@@ -158,11 +148,11 @@ static struct rate_control_ref *rate_control_alloc(const char *name,
 
        ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL);
        if (!ref)
-               goto fail_ref;
+               return NULL;
        ref->local = local;
        ref->ops = ieee80211_rate_control_ops_get(name);
        if (!ref->ops)
-               goto fail_ops;
+               goto free;
 
 #ifdef CONFIG_MAC80211_DEBUGFS
        debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
@@ -172,14 +162,11 @@ static struct rate_control_ref *rate_control_alloc(const char *name,
 
        ref->priv = ref->ops->alloc(&local->hw, debugfsdir);
        if (!ref->priv)
-               goto fail_priv;
+               goto free;
        return ref;
 
-fail_priv:
-       ieee80211_rate_control_ops_put(ref->ops);
-fail_ops:
+free:
        kfree(ref);
-fail_ref:
        return NULL;
 }
 
@@ -192,7 +179,6 @@ static void rate_control_free(struct rate_control_ref *ctrl_ref)
        ctrl_ref->local->debugfs.rcdir = NULL;
 #endif
 
-       ieee80211_rate_control_ops_put(ctrl_ref->ops);
        kfree(ctrl_ref);
 }