airo: Use remove_proc_subtree()

Use remove_proc_subtree() to remove the airo device subdir and all its
children instead of doing it manually.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-wireless@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
David Howells 2013-04-12 03:05:20 +01:00 committed by Al Viro
parent cc87e0fff1
commit b25f774d88
1 changed files with 13 additions and 36 deletions

View File

@ -4506,98 +4506,75 @@ static int setup_proc_entry( struct net_device *dev,
apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
airo_entry); airo_entry);
if (!apriv->proc_entry) if (!apriv->proc_entry)
goto fail; return -ENOMEM;
proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid); proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
/* Setup the StatsDelta */ /* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev); apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry) if (!entry)
goto fail_stats_delta; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Stats */ /* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm, entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev); apriv->proc_entry, &proc_stats_ops, dev);
if (!entry) if (!entry)
goto fail_stats; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Status */ /* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm, entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev); apriv->proc_entry, &proc_status_ops, dev);
if (!entry) if (!entry)
goto fail_status; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Config */ /* Setup the Config */
entry = proc_create_data("Config", proc_perm, entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev); apriv->proc_entry, &proc_config_ops, dev);
if (!entry) if (!entry)
goto fail_config; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the SSID */ /* Setup the SSID */
entry = proc_create_data("SSID", proc_perm, entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev); apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry) if (!entry)
goto fail_ssid; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the APList */ /* Setup the APList */
entry = proc_create_data("APList", proc_perm, entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev); apriv->proc_entry, &proc_APList_ops, dev);
if (!entry) if (!entry)
goto fail_aplist; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the BSSList */ /* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm, entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev); apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry) if (!entry)
goto fail_bsslist; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the WepKey */ /* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm, entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev); apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry) if (!entry)
goto fail_wepkey; goto fail;
proc_set_user(entry, proc_kuid, proc_kgid); proc_set_user(entry, proc_kuid, proc_kgid);
return 0; return 0;
fail_wepkey:
remove_proc_entry("BSSList", apriv->proc_entry);
fail_bsslist:
remove_proc_entry("APList", apriv->proc_entry);
fail_aplist:
remove_proc_entry("SSID", apriv->proc_entry);
fail_ssid:
remove_proc_entry("Config", apriv->proc_entry);
fail_config:
remove_proc_entry("Status", apriv->proc_entry);
fail_status:
remove_proc_entry("Stats", apriv->proc_entry);
fail_stats:
remove_proc_entry("StatsDelta", apriv->proc_entry);
fail_stats_delta:
remove_proc_entry(apriv->proc_name, airo_entry);
fail: fail:
remove_proc_subtree(apriv->proc_name, airo_entry);
return -ENOMEM; return -ENOMEM;
} }
static int takedown_proc_entry( struct net_device *dev, static int takedown_proc_entry( struct net_device *dev,
struct airo_info *apriv ) { struct airo_info *apriv )
if ( !apriv->proc_entry->namelen ) return 0; {
remove_proc_entry("Stats",apriv->proc_entry); remove_proc_subtree(apriv->proc_name, airo_entry);
remove_proc_entry("StatsDelta",apriv->proc_entry);
remove_proc_entry("Status",apriv->proc_entry);
remove_proc_entry("Config",apriv->proc_entry);
remove_proc_entry("SSID",apriv->proc_entry);
remove_proc_entry("APList",apriv->proc_entry);
remove_proc_entry("BSSList",apriv->proc_entry);
remove_proc_entry("WepKey",apriv->proc_entry);
remove_proc_entry(apriv->proc_name,airo_entry);
return 0; return 0;
} }