git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
char
/
nvram.c
diff --git
a/drivers/char/nvram.c
b/drivers/char/nvram.c
index
b5f32d6
..
a39f19c
100644
(file)
--- a/
drivers/char/nvram.c
+++ b/
drivers/char/nvram.c
@@
-37,7
+37,6
@@
#define NVRAM_VERSION "1.2"
#include <linux/module.h>
#define NVRAM_VERSION "1.2"
#include <linux/module.h>
-#include <linux/config.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/nvram.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/nvram.h>
@@
-133,7
+132,7
@@
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/system.h>
-static
spinlock_t nvram_state_lock = SPIN_LOCK_UNLOCKED
;
+static
DEFINE_SPINLOCK(nvram_state_lock)
;
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
#define NVRAM_WRITE 1 /* opened for writing (exclusive) */
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
#define NVRAM_WRITE 1 /* opened for writing (exclusive) */
@@
-211,12
+210,13
@@
nvram_check_checksum(void)
return rv;
}
return rv;
}
-void
+
static
void
__nvram_set_checksum(void)
{
mach_set_checksum();
}
__nvram_set_checksum(void)
{
mach_set_checksum();
}
+#if 0
void
nvram_set_checksum(void)
{
void
nvram_set_checksum(void)
{
@@
-226,6
+226,7
@@
nvram_set_checksum(void)
__nvram_set_checksum();
spin_unlock_irqrestore(&rtc_lock, flags);
}
__nvram_set_checksum();
spin_unlock_irqrestore(&rtc_lock, flags);
}
+#endif /* 0 */
/*
* The are the file operation function for user access to /dev/nvram
/*
* The are the file operation function for user access to /dev/nvram
@@
-436,7
+437,7
@@
nvram_read_proc(char *buffer, char **start, off_t offset,
#endif /* CONFIG_PROC_FS */
#endif /* CONFIG_PROC_FS */
-static struct file_operations nvram_fops = {
+static
const
struct file_operations nvram_fops = {
.owner = THIS_MODULE,
.llseek = nvram_llseek,
.read = nvram_read,
.owner = THIS_MODULE,
.llseek = nvram_llseek,
.read = nvram_read,
@@
-467,7
+468,7
@@
nvram_init(void)
NVRAM_MINOR);
goto out;
}
NVRAM_MINOR);
goto out;
}
- if (!create_proc_read_entry("driver/nvram", 0,
0
, nvram_read_proc,
+ if (!create_proc_read_entry("driver/nvram", 0,
NULL
, nvram_read_proc,
NULL)) {
printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n");
ret = -ENOMEM;
NULL)) {
printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n");
ret = -ENOMEM;
@@
-485,7
+486,7
@@
nvram_init(void)
static void __exit
nvram_cleanup_module(void)
{
static void __exit
nvram_cleanup_module(void)
{
- remove_proc_entry("driver/nvram",
0
);
+ remove_proc_entry("driver/nvram",
NULL
);
misc_deregister(&nvram_dev);
}
misc_deregister(&nvram_dev);
}
@@
-555,13
+556,13
@@
pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
(nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
PRINT_PROC("Floppy 0 type : ");
type = nvram[2] >> 4;
(nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
PRINT_PROC("Floppy 0 type : ");
type = nvram[2] >> 4;
- if (type <
sizeof (floppy_types) / sizeof (*
floppy_types))
+ if (type <
ARRAY_SIZE(
floppy_types))
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
PRINT_PROC("Floppy 1 type : ");
type = nvram[2] & 0x0f;
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
PRINT_PROC("Floppy 1 type : ");
type = nvram[2] & 0x0f;
- if (type <
sizeof (floppy_types) / sizeof (*
floppy_types))
+ if (type <
ARRAY_SIZE(
floppy_types))
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
PRINT_PROC("%s\n", floppy_types[type]);
else
PRINT_PROC("%d (unknown)\n", type);
@@
-841,8
+842,6
@@
static char *colors[] = {
"2", "4", "16", "256", "65536", "??", "??", "??"
};
"2", "4", "16", "256", "65536", "??", "??", "??"
};
-#define fieldsize(a) (sizeof(a)/sizeof(*a))
-
static int
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
off_t *begin, off_t offset, int size)
static int
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
off_t *begin, off_t offset, int size)
@@
-854,7
+853,7
@@
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");
PRINT_PROC("Boot preference : ");
PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");
PRINT_PROC("Boot preference : ");
- for (i =
fieldsize
(boot_prefs) - 1; i >= 0; --i) {
+ for (i =
ARRAY_SIZE
(boot_prefs) - 1; i >= 0; --i) {
if (nvram[1] == boot_prefs[i].val) {
PRINT_PROC("%s\n", boot_prefs[i].name);
break;
if (nvram[1] == boot_prefs[i].val) {
PRINT_PROC("%s\n", boot_prefs[i].name);
break;
@@
-876,12
+875,12
@@
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
return 1;
PRINT_PROC("OS language : ");
return 1;
PRINT_PROC("OS language : ");
- if (nvram[6] <
fieldsize
(languages))
+ if (nvram[6] <
ARRAY_SIZE
(languages))
PRINT_PROC("%s\n", languages[nvram[6]]);
else
PRINT_PROC("%u (undefined)\n", nvram[6]);
PRINT_PROC("Keyboard language: ");
PRINT_PROC("%s\n", languages[nvram[6]]);
else
PRINT_PROC("%u (undefined)\n", nvram[6]);
PRINT_PROC("Keyboard language: ");
- if (nvram[7] <
fieldsize
(languages))
+ if (nvram[7] <
ARRAY_SIZE
(languages))
PRINT_PROC("%s\n", languages[nvram[7]]);
else
PRINT_PROC("%u (undefined)\n", nvram[7]);
PRINT_PROC("%s\n", languages[nvram[7]]);
else
PRINT_PROC("%u (undefined)\n", nvram[7]);
@@
-921,6
+920,4
@@
EXPORT_SYMBOL(__nvram_write_byte);
EXPORT_SYMBOL(nvram_write_byte);
EXPORT_SYMBOL(__nvram_check_checksum);
EXPORT_SYMBOL(nvram_check_checksum);
EXPORT_SYMBOL(nvram_write_byte);
EXPORT_SYMBOL(__nvram_check_checksum);
EXPORT_SYMBOL(nvram_check_checksum);
-EXPORT_SYMBOL(__nvram_set_checksum);
-EXPORT_SYMBOL(nvram_set_checksum);
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);