[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130416182643.27773.14779.stgit@warthog.procyon.org.uk>
Date: Tue, 16 Apr 2013 19:26:43 +0100
From: David Howells <dhowells@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, linux-wireless@...r.kernel.org,
viro@...iv.linux.org.uk
Subject: [PATCH 13/28] airo: Use remove_proc_subtree() [RFC]
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@...hat.com>
cc: linux-wireless@...r.kernel.org
---
drivers/net/wireless/airo.c | 49 +++++++++++--------------------------------
1 file changed, 13 insertions(+), 36 deletions(-)
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 21d0233..6125adb 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists