diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-10-27 07:59:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-30 16:49:18 -0400 |
commit | 7bcfaf2f431c09c51fe776fc06638b25d3b421c5 (patch) | |
tree | 27f767335566826f11f0134b97ee76b58d9bcf90 /net/mac80211/debugfs_key.c | |
parent | 2c0d6100da3ee9b0f0cc46add9bb8a8161299a92 (diff) |
cfg80211/mac80211: use debugfs_remove_recursive
We can save a lot of code and pointers in the structs
by using debugfs_remove_recursive().
First, change cfg80211 to use debugfs_remove_recursive()
so that drivers do not need to clean up any files they
added to the per-wiphy debugfs (if and only if they are
ok to be accessed until after wiphy_unregister!).
Then also make mac80211 use debugfs_remove_recursive()
where necessary -- it need not remove per-wiphy files
as cfg80211 now removes those, but netdev etc. files
still need to be handled but can now be removed without
needing struct dentry pointers to all of them.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/debugfs_key.c')
-rw-r--r-- | net/mac80211/debugfs_key.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 99c752588b30..e0f5224630da 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -225,8 +225,8 @@ static ssize_t key_key_read(struct file *file, char __user *userbuf, | |||
225 | KEY_OPS(key); | 225 | KEY_OPS(key); |
226 | 226 | ||
227 | #define DEBUGFS_ADD(name) \ | 227 | #define DEBUGFS_ADD(name) \ |
228 | key->debugfs.name = debugfs_create_file(#name, 0400,\ | 228 | debugfs_create_file(#name, 0400, key->debugfs.dir, \ |
229 | key->debugfs.dir, key, &key_##name##_ops); | 229 | key, &key_##name##_ops); |
230 | 230 | ||
231 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) | 231 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) |
232 | { | 232 | { |
@@ -271,30 +271,12 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
271 | DEBUGFS_ADD(ifindex); | 271 | DEBUGFS_ADD(ifindex); |
272 | }; | 272 | }; |
273 | 273 | ||
274 | #define DEBUGFS_DEL(name) \ | ||
275 | debugfs_remove(key->debugfs.name); key->debugfs.name = NULL; | ||
276 | |||
277 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key) | 274 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key) |
278 | { | 275 | { |
279 | if (!key) | 276 | if (!key) |
280 | return; | 277 | return; |
281 | 278 | ||
282 | DEBUGFS_DEL(keylen); | 279 | debugfs_remove_recursive(key->debugfs.dir); |
283 | DEBUGFS_DEL(flags); | ||
284 | DEBUGFS_DEL(keyidx); | ||
285 | DEBUGFS_DEL(hw_key_idx); | ||
286 | DEBUGFS_DEL(tx_rx_count); | ||
287 | DEBUGFS_DEL(algorithm); | ||
288 | DEBUGFS_DEL(tx_spec); | ||
289 | DEBUGFS_DEL(rx_spec); | ||
290 | DEBUGFS_DEL(replays); | ||
291 | DEBUGFS_DEL(icverrors); | ||
292 | DEBUGFS_DEL(key); | ||
293 | DEBUGFS_DEL(ifindex); | ||
294 | |||
295 | debugfs_remove(key->debugfs.stalink); | ||
296 | key->debugfs.stalink = NULL; | ||
297 | debugfs_remove(key->debugfs.dir); | ||
298 | key->debugfs.dir = NULL; | 280 | key->debugfs.dir = NULL; |
299 | } | 281 | } |
300 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | 282 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) |
@@ -302,7 +284,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
302 | char buf[50]; | 284 | char buf[50]; |
303 | struct ieee80211_key *key; | 285 | struct ieee80211_key *key; |
304 | 286 | ||
305 | if (!sdata->debugfsdir) | 287 | if (!sdata->debugfs.dir) |
306 | return; | 288 | return; |
307 | 289 | ||
308 | /* this is running under the key lock */ | 290 | /* this is running under the key lock */ |
@@ -310,9 +292,9 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
310 | key = sdata->default_key; | 292 | key = sdata->default_key; |
311 | if (key) { | 293 | if (key) { |
312 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 294 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
313 | sdata->common_debugfs.default_key = | 295 | sdata->debugfs.default_key = |
314 | debugfs_create_symlink("default_key", | 296 | debugfs_create_symlink("default_key", |
315 | sdata->debugfsdir, buf); | 297 | sdata->debugfs.dir, buf); |
316 | } else | 298 | } else |
317 | ieee80211_debugfs_key_remove_default(sdata); | 299 | ieee80211_debugfs_key_remove_default(sdata); |
318 | } | 300 | } |
@@ -322,8 +304,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) | |||
322 | if (!sdata) | 304 | if (!sdata) |
323 | return; | 305 | return; |
324 | 306 | ||
325 | debugfs_remove(sdata->common_debugfs.default_key); | 307 | debugfs_remove(sdata->debugfs.default_key); |
326 | sdata->common_debugfs.default_key = NULL; | 308 | sdata->debugfs.default_key = NULL; |
327 | } | 309 | } |
328 | 310 | ||
329 | void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | 311 | void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) |
@@ -331,7 +313,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | |||
331 | char buf[50]; | 313 | char buf[50]; |
332 | struct ieee80211_key *key; | 314 | struct ieee80211_key *key; |
333 | 315 | ||
334 | if (!sdata->debugfsdir) | 316 | if (!sdata->debugfs.dir) |
335 | return; | 317 | return; |
336 | 318 | ||
337 | /* this is running under the key lock */ | 319 | /* this is running under the key lock */ |
@@ -339,9 +321,9 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | |||
339 | key = sdata->default_mgmt_key; | 321 | key = sdata->default_mgmt_key; |
340 | if (key) { | 322 | if (key) { |
341 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 323 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
342 | sdata->common_debugfs.default_mgmt_key = | 324 | sdata->debugfs.default_mgmt_key = |
343 | debugfs_create_symlink("default_mgmt_key", | 325 | debugfs_create_symlink("default_mgmt_key", |
344 | sdata->debugfsdir, buf); | 326 | sdata->debugfs.dir, buf); |
345 | } else | 327 | } else |
346 | ieee80211_debugfs_key_remove_mgmt_default(sdata); | 328 | ieee80211_debugfs_key_remove_mgmt_default(sdata); |
347 | } | 329 | } |
@@ -351,8 +333,8 @@ void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sda | |||
351 | if (!sdata) | 333 | if (!sdata) |
352 | return; | 334 | return; |
353 | 335 | ||
354 | debugfs_remove(sdata->common_debugfs.default_mgmt_key); | 336 | debugfs_remove(sdata->debugfs.default_mgmt_key); |
355 | sdata->common_debugfs.default_mgmt_key = NULL; | 337 | sdata->debugfs.default_mgmt_key = NULL; |
356 | } | 338 | } |
357 | 339 | ||
358 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 340 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |