summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 18:29:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:33 -0400
commitc35f2e49f88e72ffcb0cc6af2f93fe153fa88dd8 (patch)
treed202ba0b1f7e07324a96fb9cb09fd0d107f5da0c /arch
parentd9dda78bad879595d8c4220a067fc029d6484a16 (diff)
downloadop-kernel-dev-c35f2e49f88e72ffcb0cc6af2f93fe153fa88dd8.zip
op-kernel-dev-c35f2e49f88e72ffcb0cc6af2f93fe153fa88dd8.tar.gz
srm_env: use proc_remove_subtree()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/srm_env.c64
1 files changed, 7 insertions, 57 deletions
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index ef8769b..97b4f3f 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -51,7 +51,6 @@ MODULE_LICENSE("GPL");
typedef struct _srm_env {
char *name;
unsigned long id;
- struct proc_dir_entry *proc_entry;
} srm_env_t;
static struct proc_dir_entry *base_dir;
@@ -149,52 +148,6 @@ static const struct file_operations srm_env_proc_fops = {
.write = srm_env_proc_write,
};
-static void
-srm_env_cleanup(void)
-{
- srm_env_t *entry;
- unsigned long var_num;
-
- if (base_dir) {
- /*
- * Remove named entries
- */
- if (named_dir) {
- entry = srm_named_entries;
- while (entry->name != NULL && entry->id != 0) {
- if (entry->proc_entry) {
- remove_proc_entry(entry->name,
- named_dir);
- entry->proc_entry = NULL;
- }
- entry++;
- }
- remove_proc_entry(NAMED_DIR, base_dir);
- }
-
- /*
- * Remove numbered entries
- */
- if (numbered_dir) {
- for (var_num = 0; var_num <= 255; var_num++) {
- entry = &srm_numbered_entries[var_num];
-
- if (entry->proc_entry) {
- remove_proc_entry(entry->name,
- numbered_dir);
- entry->proc_entry = NULL;
- entry->name = NULL;
- }
- }
- remove_proc_entry(NUMBERED_DIR, base_dir);
- }
-
- remove_proc_entry(BASE_DIR, NULL);
- }
-
- return;
-}
-
static int __init
srm_env_init(void)
{
@@ -225,7 +178,7 @@ srm_env_init(void)
if (!base_dir) {
printk(KERN_ERR "Couldn't create base dir /proc/%s\n",
BASE_DIR);
- goto cleanup;
+ return -ENOMEM;
}
/*
@@ -254,9 +207,8 @@ srm_env_init(void)
*/
entry = srm_named_entries;
while (entry->name && entry->id) {
- entry->proc_entry = proc_create_data(entry->name, 0644, named_dir,
- &srm_env_proc_fops, entry);
- if (!entry->proc_entry)
+ if (!proc_create_data(entry->name, 0644, named_dir,
+ &srm_env_proc_fops, entry))
goto cleanup;
entry++;
}
@@ -268,9 +220,8 @@ srm_env_init(void)
entry = &srm_numbered_entries[var_num];
entry->name = number[var_num];
- entry->proc_entry = proc_create_data(entry->name, 0644, numbered_dir,
- &srm_env_proc_fops, entry);
- if (!entry->proc_entry)
+ if (!proc_create_data(entry->name, 0644, numbered_dir,
+ &srm_env_proc_fops, entry))
goto cleanup;
entry->id = var_num;
@@ -282,15 +233,14 @@ srm_env_init(void)
return 0;
cleanup:
- srm_env_cleanup();
-
+ remove_proc_subtree(BASE_DIR, NULL);
return -ENOMEM;
}
static void __exit
srm_env_exit(void)
{
- srm_env_cleanup();
+ remove_proc_subtree(BASE_DIR, NULL);
printk(KERN_INFO "%s: unloaded successfully\n", NAME);
return;
OpenPOWER on IntegriCloud