patch-2.2.8 linux/drivers/macintosh/nvram.c
Next file: linux/drivers/macintosh/via-cuda.c
Previous file: linux/drivers/macintosh/macserial.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Thu Apr 29 12:53:48 1999
- Orig file:
v2.2.7/linux/drivers/macintosh/nvram.c
- Orig date:
Wed Aug 26 11:37:38 1998
diff -u --recursive --new-file v2.2.7/linux/drivers/macintosh/nvram.c linux/drivers/macintosh/nvram.c
@@ -1,6 +1,11 @@
/*
* /dev/nvram driver for Power Macintosh.
*/
+
+#define NVRAM_VERSION "1.0"
+
+#include <linux/module.h>
+
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fs.h>
@@ -9,11 +14,14 @@
#include <linux/nvram.h>
#include <linux/init.h>
#include <asm/uaccess.h>
-#include <asm/init.h>
#define NVRAM_SIZE 8192
+/* when building as a module, __openfirmware is both unavailable
+ * and unnecessary. */
+#ifndef MODULE
__openfirmware
+#endif
static long long nvram_llseek(struct file *file, loff_t offset, int origin)
{
@@ -70,6 +78,13 @@
static int nvram_open(struct inode *inode, struct file *file)
{
+ MOD_INC_USE_COUNT;
+ return 0;
+}
+
+static int nvram_release(struct inode *inode, struct file *file)
+{
+ MOD_DEC_USE_COUNT;
return 0;
}
@@ -83,7 +98,7 @@
NULL, /* nvram_mmap */
nvram_open,
NULL, /* flush */
- NULL, /* no special release code */
+ nvram_release,
NULL /* fsync */
};
@@ -95,6 +110,19 @@
__initfunc(int nvram_init(void))
{
+ printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n",
+ NVRAM_VERSION);
misc_register(&nvram_dev);
return 0;
}
+#ifdef MODULE
+int init_module (void)
+{
+ return( nvram_init() );
+}
+
+void cleanup_module (void)
+{
+ misc_deregister( &nvram_dev );
+}
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)