diff options
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r-- | net/mac80211/rate.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index b33efc4fc267..b9007f80cb92 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -163,8 +163,7 @@ struct rate_control_ref *rate_control_alloc(const char *name, | |||
163 | #ifdef CONFIG_MAC80211_DEBUGFS | 163 | #ifdef CONFIG_MAC80211_DEBUGFS |
164 | debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); | 164 | debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); |
165 | local->debugfs.rcdir = debugfsdir; | 165 | local->debugfs.rcdir = debugfsdir; |
166 | local->debugfs.rcname = debugfs_create_file("name", 0400, debugfsdir, | 166 | debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); |
167 | ref, &rcname_ops); | ||
168 | #endif | 167 | #endif |
169 | 168 | ||
170 | ref->priv = ref->ops->alloc(&local->hw, debugfsdir); | 169 | ref->priv = ref->ops->alloc(&local->hw, debugfsdir); |
@@ -188,9 +187,7 @@ static void rate_control_release(struct kref *kref) | |||
188 | ctrl_ref->ops->free(ctrl_ref->priv); | 187 | ctrl_ref->ops->free(ctrl_ref->priv); |
189 | 188 | ||
190 | #ifdef CONFIG_MAC80211_DEBUGFS | 189 | #ifdef CONFIG_MAC80211_DEBUGFS |
191 | debugfs_remove(ctrl_ref->local->debugfs.rcname); | 190 | debugfs_remove_recursive(ctrl_ref->local->debugfs.rcdir); |
192 | ctrl_ref->local->debugfs.rcname = NULL; | ||
193 | debugfs_remove(ctrl_ref->local->debugfs.rcdir); | ||
194 | ctrl_ref->local->debugfs.rcdir = NULL; | 191 | ctrl_ref->local->debugfs.rcdir = NULL; |
195 | #endif | 192 | #endif |
196 | 193 | ||
@@ -287,9 +284,16 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
287 | struct rate_control_ref *ref, *old; | 284 | struct rate_control_ref *ref, *old; |
288 | 285 | ||
289 | ASSERT_RTNL(); | 286 | ASSERT_RTNL(); |
287 | |||
290 | if (local->open_count) | 288 | if (local->open_count) |
291 | return -EBUSY; | 289 | return -EBUSY; |
292 | 290 | ||
291 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { | ||
292 | if (WARN_ON(!local->ops->set_rts_threshold)) | ||
293 | return -EINVAL; | ||
294 | return 0; | ||
295 | } | ||
296 | |||
293 | ref = rate_control_alloc(name, local); | 297 | ref = rate_control_alloc(name, local); |
294 | if (!ref) { | 298 | if (!ref) { |
295 | printk(KERN_WARNING "%s: Failed to select rate control " | 299 | printk(KERN_WARNING "%s: Failed to select rate control " |
@@ -308,7 +312,6 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
308 | "algorithm '%s'\n", wiphy_name(local->hw.wiphy), | 312 | "algorithm '%s'\n", wiphy_name(local->hw.wiphy), |
309 | ref->ops->name); | 313 | ref->ops->name); |
310 | 314 | ||
311 | |||
312 | return 0; | 315 | return 0; |
313 | } | 316 | } |
314 | 317 | ||
@@ -317,6 +320,10 @@ void rate_control_deinitialize(struct ieee80211_local *local) | |||
317 | struct rate_control_ref *ref; | 320 | struct rate_control_ref *ref; |
318 | 321 | ||
319 | ref = local->rate_ctrl; | 322 | ref = local->rate_ctrl; |
323 | |||
324 | if (!ref) | ||
325 | return; | ||
326 | |||
320 | local->rate_ctrl = NULL; | 327 | local->rate_ctrl = NULL; |
321 | rate_control_put(ref); | 328 | rate_control_put(ref); |
322 | } | 329 | } |