airo: Use remove_proc_subtree()
authorDavid Howells <dhowells@redhat.com>
Fri, 12 Apr 2013 02:05:20 +0000 (03:05 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 1 May 2013 21:29:42 +0000 (17:29 -0400)
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>
drivers/net/wireless/airo.c

index 21d0233..6125adb 100644 (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,
                                            airo_entry);
        if (!apriv->proc_entry)
-               goto fail;
+               return -ENOMEM;
        proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
 
        /* Setup the StatsDelta */
        entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
                                 apriv->proc_entry, &proc_statsdelta_ops, dev);
        if (!entry)
-               goto fail_stats_delta;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the Stats */
        entry = proc_create_data("Stats", S_IRUGO & proc_perm,
                                 apriv->proc_entry, &proc_stats_ops, dev);
        if (!entry)
-               goto fail_stats;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the Status */
        entry = proc_create_data("Status", S_IRUGO & proc_perm,
                                 apriv->proc_entry, &proc_status_ops, dev);
        if (!entry)
-               goto fail_status;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the Config */
        entry = proc_create_data("Config", proc_perm,
                                 apriv->proc_entry, &proc_config_ops, dev);
        if (!entry)
-               goto fail_config;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the SSID */
        entry = proc_create_data("SSID", proc_perm,
                                 apriv->proc_entry, &proc_SSID_ops, dev);
        if (!entry)
-               goto fail_ssid;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the APList */
        entry = proc_create_data("APList", proc_perm,
                                 apriv->proc_entry, &proc_APList_ops, dev);
        if (!entry)
-               goto fail_aplist;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the BSSList */
        entry = proc_create_data("BSSList", proc_perm,
                                 apriv->proc_entry, &proc_BSSList_ops, dev);
        if (!entry)
-               goto fail_bsslist;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
 
        /* Setup the WepKey */
        entry = proc_create_data("WepKey", proc_perm,
                                 apriv->proc_entry, &proc_wepkey_ops, dev);
        if (!entry)
-               goto fail_wepkey;
+               goto fail;
        proc_set_user(entry, proc_kuid, proc_kgid);
        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:
+       remove_proc_subtree(apriv->proc_name, airo_entry);
        return -ENOMEM;
 }
 
 static int takedown_proc_entry( struct net_device *dev,
-                               struct airo_info *apriv ) {
-       if ( !apriv->proc_entry->namelen ) return 0;
-       remove_proc_entry("Stats",apriv->proc_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);
+                               struct airo_info *apriv )
+{
+       remove_proc_subtree(apriv->proc_name, airo_entry);
        return 0;
 }