summaryrefslogtreecommitdiffstats
path: root/drivers/char/nvram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/nvram.c')
-rw-r--r--drivers/char/nvram.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index dde61fe77..60ee17688 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -95,9 +95,7 @@
#include <linux/mc146818rtc.h>
#include <linux/nvram.h>
#include <linux/init.h>
-#ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h>
-#endif
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -351,9 +349,10 @@ static int nvram_release( struct inode *inode, struct file *file )
}
-#ifdef CONFIG_PROC_FS
-
-struct proc_dir_entry *proc_nvram;
+#ifndef CONFIG_PROC_FS
+static int nvram_read_proc( char *buffer, char **start, off_t offset,
+ int size, int *eof, void *data) { return 0; }
+#else
static int nvram_read_proc( char *buffer, char **start, off_t offset,
int size, int *eof, void *data )
@@ -391,7 +390,7 @@ static int nvram_read_proc( char *buffer, char **start, off_t offset,
} \
} while(0)
-#endif
+#endif /* CONFIG_PROC_FS */
static struct file_operations nvram_fops = {
nvram_llseek,
@@ -413,7 +412,7 @@ static struct miscdevice nvram_dev = {
};
-int __init nvram_init(void)
+static int __init nvram_init(void)
{
/* First test whether the driver should init at all */
if (!CHECK_DRIVER_INIT())
@@ -421,29 +420,18 @@ int __init nvram_init(void)
printk(KERN_INFO "Non-volatile memory driver v%s\n", NVRAM_VERSION );
misc_register( &nvram_dev );
-#ifdef CONFIG_PROC_FS
- if ((proc_nvram = create_proc_entry( "nvram", 0, 0 )))
- proc_nvram->read_proc = nvram_read_proc;
-#endif
-
+ create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL);
return( 0 );
}
-#ifdef MODULE
-int init_module (void)
-{
- return( nvram_init() );
-}
-
-void cleanup_module (void)
+static void __exit nvram_cleanup_module (void)
{
-#ifdef CONFIG_PROC_FS
- if (proc_nvram)
- remove_proc_entry( "nvram", 0 );
-#endif
+ remove_proc_entry( "driver/nvram", 0 );
misc_deregister( &nvram_dev );
}
-#endif
+
+module_init(nvram_init);
+module_exit(nvram_cleanup_module);
/*