patch-2.3.25 linux/drivers/char/nvram.c

Next file: linux/drivers/char/ppdev.c
Previous file: linux/drivers/char/misc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.24/linux/drivers/char/nvram.c linux/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 @@
 }
 
 
-#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 @@
 		}												\
 	} while(0)
 
-#endif
+#endif /* CONFIG_PROC_FS */
 
 static struct file_operations nvram_fops = {
 	nvram_llseek,
@@ -413,7 +412,7 @@
 };
 
 
-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 @@
 
 	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);
 
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)