[PATCH] nvram - CodingStyle
Bring drivers/char/nvram.c in line with the Coding Style. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
3ad4f59705
commit
971ddcf8ad
|
@ -46,7 +46,7 @@
|
|||
/* select machine configuration */
|
||||
#if defined(CONFIG_ATARI)
|
||||
# define MACH ATARI
|
||||
#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and others?? */
|
||||
#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and ?? */
|
||||
# define MACH PC
|
||||
#else
|
||||
# error Cannot build nvram driver for this machine configuration.
|
||||
|
@ -107,9 +107,9 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
static DEFINE_SPINLOCK(nvram_state_lock);
|
||||
|
@ -137,14 +137,13 @@ static int mach_proc_infos(unsigned char *contents, char *buffer, int *len,
|
|||
* know about the RTC cruft.
|
||||
*/
|
||||
|
||||
unsigned char
|
||||
__nvram_read_byte(int i)
|
||||
unsigned char __nvram_read_byte(int i)
|
||||
{
|
||||
return CMOS_READ(NVRAM_FIRST_BYTE + i);
|
||||
}
|
||||
EXPORT_SYMBOL(__nvram_read_byte);
|
||||
|
||||
unsigned char
|
||||
nvram_read_byte(int i)
|
||||
unsigned char nvram_read_byte(int i)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned char c;
|
||||
|
@ -154,16 +153,16 @@ nvram_read_byte(int i)
|
|||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return c;
|
||||
}
|
||||
EXPORT_SYMBOL(nvram_read_byte);
|
||||
|
||||
/* This races nicely with trying to read with checksum checking (nvram_read) */
|
||||
void
|
||||
__nvram_write_byte(unsigned char c, int i)
|
||||
void __nvram_write_byte(unsigned char c, int i)
|
||||
{
|
||||
CMOS_WRITE(c, NVRAM_FIRST_BYTE + i);
|
||||
}
|
||||
EXPORT_SYMBOL(__nvram_write_byte);
|
||||
|
||||
void
|
||||
nvram_write_byte(unsigned char c, int i)
|
||||
void nvram_write_byte(unsigned char c, int i)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -171,15 +170,15 @@ nvram_write_byte(unsigned char c, int i)
|
|||
__nvram_write_byte(c, i);
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL(nvram_write_byte);
|
||||
|
||||
int
|
||||
__nvram_check_checksum(void)
|
||||
int __nvram_check_checksum(void)
|
||||
{
|
||||
return mach_check_checksum();
|
||||
}
|
||||
EXPORT_SYMBOL(__nvram_check_checksum);
|
||||
|
||||
int
|
||||
nvram_check_checksum(void)
|
||||
int nvram_check_checksum(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
int rv;
|
||||
|
@ -189,16 +188,15 @@ nvram_check_checksum(void)
|
|||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return rv;
|
||||
}
|
||||
EXPORT_SYMBOL(nvram_check_checksum);
|
||||
|
||||
static void
|
||||
__nvram_set_checksum(void)
|
||||
static void __nvram_set_checksum(void)
|
||||
{
|
||||
mach_set_checksum();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
nvram_set_checksum(void)
|
||||
void nvram_set_checksum(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -230,8 +228,8 @@ static loff_t nvram_llseek(struct file *file,loff_t offset, int origin )
|
|||
return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
static ssize_t nvram_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
unsigned char contents[NVRAM_BYTES];
|
||||
unsigned i = *ppos;
|
||||
|
@ -259,8 +257,8 @@ nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
|
||||
static ssize_t nvram_write(struct file *file, const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
unsigned char contents[NVRAM_BYTES];
|
||||
unsigned i = *ppos;
|
||||
|
@ -292,8 +290,7 @@ nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppo
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int
|
||||
nvram_ioctl(struct inode *inode, struct file *file,
|
||||
static int nvram_ioctl(struct inode *inode, struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int i;
|
||||
|
@ -330,8 +327,7 @@ nvram_ioctl(struct inode *inode, struct file *file,
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
nvram_open(struct inode *inode, struct file *file)
|
||||
static int nvram_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock(&nvram_state_lock);
|
||||
|
@ -356,8 +352,7 @@ nvram_open(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nvram_release(struct inode *inode, struct file *file)
|
||||
static int nvram_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
spin_lock(&nvram_state_lock);
|
||||
|
||||
|
@ -375,16 +370,14 @@ nvram_release(struct inode *inode, struct file *file)
|
|||
}
|
||||
|
||||
#ifndef CONFIG_PROC_FS
|
||||
static int
|
||||
nvram_read_proc(char *buffer, char **start, off_t offset,
|
||||
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,
|
||||
static int nvram_read_proc(char *buffer, char **start, off_t offset,
|
||||
int size, int *eof, void *data)
|
||||
{
|
||||
unsigned char contents[NVRAM_BYTES];
|
||||
|
@ -436,8 +429,7 @@ static struct miscdevice nvram_dev = {
|
|||
&nvram_fops
|
||||
};
|
||||
|
||||
static int __init
|
||||
nvram_init(void)
|
||||
static int __init nvram_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -466,8 +458,7 @@ nvram_init(void)
|
|||
goto out;
|
||||
}
|
||||
|
||||
static void __exit
|
||||
nvram_cleanup_module(void)
|
||||
static void __exit nvram_cleanup_module(void)
|
||||
{
|
||||
remove_proc_entry("driver/nvram", NULL);
|
||||
misc_deregister(&nvram_dev);
|
||||
|
@ -482,8 +473,7 @@ module_exit(nvram_cleanup_module);
|
|||
|
||||
#if MACH == PC
|
||||
|
||||
static int
|
||||
pc_check_checksum(void)
|
||||
static int pc_check_checksum(void)
|
||||
{
|
||||
int i;
|
||||
unsigned short sum = 0;
|
||||
|
@ -493,11 +483,10 @@ pc_check_checksum(void)
|
|||
sum += __nvram_read_byte(i);
|
||||
expect = __nvram_read_byte(PC_CKS_LOC)<<8 |
|
||||
__nvram_read_byte(PC_CKS_LOC+1);
|
||||
return ((sum & 0xffff) == expect);
|
||||
return (sum & 0xffff) == expect;
|
||||
}
|
||||
|
||||
static void
|
||||
pc_set_checksum(void)
|
||||
static void pc_set_checksum(void)
|
||||
{
|
||||
int i;
|
||||
unsigned short sum = 0;
|
||||
|
@ -522,8 +511,7 @@ static char *gfx_types[] = {
|
|||
"monochrome",
|
||||
};
|
||||
|
||||
static int
|
||||
pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
||||
static int pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
||||
off_t *begin, off_t offset, int size)
|
||||
{
|
||||
int checksum;
|
||||
|
@ -590,20 +578,18 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
|||
|
||||
#if MACH == ATARI
|
||||
|
||||
static int
|
||||
atari_check_checksum(void)
|
||||
static int atari_check_checksum(void)
|
||||
{
|
||||
int i;
|
||||
unsigned char sum = 0;
|
||||
|
||||
for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i)
|
||||
sum += __nvram_read_byte(i);
|
||||
return (__nvram_read_byte(ATARI_CKS_LOC) == (~sum & 0xff) &&
|
||||
__nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff));
|
||||
return (__nvram_read_byte(ATARI_CKS_LOC) == (~sum & 0xff)) &&
|
||||
(__nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff));
|
||||
}
|
||||
|
||||
static void
|
||||
atari_set_checksum(void)
|
||||
static void atari_set_checksum(void)
|
||||
{
|
||||
int i;
|
||||
unsigned char sum = 0;
|
||||
|
@ -654,8 +640,7 @@ static char *colors[] = {
|
|||
"2", "4", "16", "256", "65536", "??", "??", "??"
|
||||
};
|
||||
|
||||
static int
|
||||
atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
||||
static int atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
||||
off_t *begin, off_t offset, int size)
|
||||
{
|
||||
int checksum = nvram_check_checksum();
|
||||
|
@ -725,11 +710,4 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
|
|||
#endif /* MACH == ATARI */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
EXPORT_SYMBOL(__nvram_read_byte);
|
||||
EXPORT_SYMBOL(nvram_read_byte);
|
||||
EXPORT_SYMBOL(__nvram_write_byte);
|
||||
EXPORT_SYMBOL(nvram_write_byte);
|
||||
EXPORT_SYMBOL(__nvram_check_checksum);
|
||||
EXPORT_SYMBOL(nvram_check_checksum);
|
||||
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
|
||||
|
|
Loading…
Reference in a new issue