]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/mac80211/rate.c
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
[mv-sheeva.git] / net / mac80211 / rate.c
index b33efc4fc267d4aca2dc5cddead602314f4f36ff..b9007f80cb9231bb99bb9a726d3e286ccabfb8ff 100644 (file)
@@ -163,8 +163,7 @@ struct rate_control_ref *rate_control_alloc(const char *name,
 #ifdef CONFIG_MAC80211_DEBUGFS
        debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
        local->debugfs.rcdir = debugfsdir;
-       local->debugfs.rcname = debugfs_create_file("name", 0400, debugfsdir,
-                                                   ref, &rcname_ops);
+       debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops);
 #endif
 
        ref->priv = ref->ops->alloc(&local->hw, debugfsdir);
@@ -188,9 +187,7 @@ static void rate_control_release(struct kref *kref)
        ctrl_ref->ops->free(ctrl_ref->priv);
 
 #ifdef CONFIG_MAC80211_DEBUGFS
-       debugfs_remove(ctrl_ref->local->debugfs.rcname);
-       ctrl_ref->local->debugfs.rcname = NULL;
-       debugfs_remove(ctrl_ref->local->debugfs.rcdir);
+       debugfs_remove_recursive(ctrl_ref->local->debugfs.rcdir);
        ctrl_ref->local->debugfs.rcdir = NULL;
 #endif
 
@@ -287,9 +284,16 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
        struct rate_control_ref *ref, *old;
 
        ASSERT_RTNL();
+
        if (local->open_count)
                return -EBUSY;
 
+       if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+               if (WARN_ON(!local->ops->set_rts_threshold))
+                       return -EINVAL;
+               return 0;
+       }
+
        ref = rate_control_alloc(name, local);
        if (!ref) {
                printk(KERN_WARNING "%s: Failed to select rate control "
@@ -308,7 +312,6 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
               "algorithm '%s'\n", wiphy_name(local->hw.wiphy),
               ref->ops->name);
 
-
        return 0;
 }
 
@@ -317,6 +320,10 @@ void rate_control_deinitialize(struct ieee80211_local *local)
        struct rate_control_ref *ref;
 
        ref = local->rate_ctrl;
+
+       if (!ref)
+               return;
+
        local->rate_ctrl = NULL;
        rate_control_put(ref);
 }