Commit 0aa5d94a authored by Tim Hockin's avatar Tim Hockin

clean up 'return (x);' style stuff into 'return x' in nvram.c

parent a23d9f9b
...@@ -136,7 +136,7 @@ static int mach_proc_infos(unsigned char *contents, char *buffer, int *len, ...@@ -136,7 +136,7 @@ static int mach_proc_infos(unsigned char *contents, char *buffer, int *len,
static __inline__ unsigned char static __inline__ unsigned char
nvram_read_int(int i) nvram_read_int(int i)
{ {
return (CMOS_READ(RTC_FIRST_BYTE + i)); return CMOS_READ(RTC_FIRST_BYTE + i);
} }
static __inline__ void static __inline__ void
...@@ -148,7 +148,7 @@ nvram_write_int(unsigned char c, int i) ...@@ -148,7 +148,7 @@ nvram_write_int(unsigned char c, int i)
static __inline__ int static __inline__ int
nvram_check_checksum_int(void) nvram_check_checksum_int(void)
{ {
return (mach_check_checksum()); return mach_check_checksum();
} }
static __inline__ void static __inline__ void
...@@ -179,7 +179,7 @@ nvram_read_byte(int i) ...@@ -179,7 +179,7 @@ nvram_read_byte(int i)
spin_lock_irqsave(&rtc_lock, flags); spin_lock_irqsave(&rtc_lock, flags);
c = nvram_read_int(i); c = nvram_read_int(i);
spin_unlock_irqrestore(&rtc_lock, flags); spin_unlock_irqrestore(&rtc_lock, flags);
return (c); return c;
} }
/* This races nicely with trying to read with checksum checking (nvram_read) */ /* This races nicely with trying to read with checksum checking (nvram_read) */
...@@ -202,7 +202,7 @@ nvram_check_checksum(void) ...@@ -202,7 +202,7 @@ nvram_check_checksum(void)
spin_lock_irqsave(&rtc_lock, flags); spin_lock_irqsave(&rtc_lock, flags);
rv = nvram_check_checksum_int(); rv = nvram_check_checksum_int();
spin_unlock_irqrestore(&rtc_lock, flags); spin_unlock_irqrestore(&rtc_lock, flags);
return (rv); return rv;
} }
void void
...@@ -237,7 +237,7 @@ nvram_llseek(struct file *file, loff_t offset, int origin) ...@@ -237,7 +237,7 @@ nvram_llseek(struct file *file, loff_t offset, int origin)
break; break;
} }
unlock_kernel(); unlock_kernel();
return ((offset >= 0) ? (file->f_pos = offset) : -EINVAL); return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
} }
static ssize_t static ssize_t
...@@ -262,7 +262,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) ...@@ -262,7 +262,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
*ppos = i; *ppos = i;
return (tmp - contents); return tmp - contents;
checksum_err: checksum_err:
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
...@@ -294,7 +294,7 @@ nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -294,7 +294,7 @@ nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
*ppos = i; *ppos = i;
return (tmp - contents); return tmp - contents;
checksum_err: checksum_err:
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
...@@ -311,7 +311,7 @@ nvram_ioctl(struct inode *inode, struct file *file, ...@@ -311,7 +311,7 @@ nvram_ioctl(struct inode *inode, struct file *file,
case NVRAM_INIT: /* initialize NVRAM contents and checksum */ case NVRAM_INIT: /* initialize NVRAM contents and checksum */
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return (-EACCES); return -EACCES;
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
...@@ -320,21 +320,21 @@ nvram_ioctl(struct inode *inode, struct file *file, ...@@ -320,21 +320,21 @@ nvram_ioctl(struct inode *inode, struct file *file,
nvram_set_checksum_int(); nvram_set_checksum_int();
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
return (0); return 0;
case NVRAM_SETCKS: /* just set checksum, contents unchanged case NVRAM_SETCKS: /* just set checksum, contents unchanged
* (maybe useful after checksum garbaged * (maybe useful after checksum garbaged
* somehow...) */ * somehow...) */
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return (-EACCES); return -EACCES;
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
nvram_set_checksum_int(); nvram_set_checksum_int();
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
return (0); return 0;
default: default:
return (-ENOTTY); return -ENOTTY;
} }
} }
...@@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file) ...@@ -346,7 +346,7 @@ nvram_open(struct inode *inode, struct file *file)
(nvram_open_mode & NVRAM_EXCL) || (nvram_open_mode & NVRAM_EXCL) ||
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) { ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
spin_unlock(&nvram_open_lock); spin_unlock(&nvram_open_lock);
return (-EBUSY); return -EBUSY;
} }
if (file->f_flags & O_EXCL) if (file->f_flags & O_EXCL)
...@@ -355,7 +355,7 @@ nvram_open(struct inode *inode, struct file *file) ...@@ -355,7 +355,7 @@ nvram_open(struct inode *inode, struct file *file)
nvram_open_mode |= NVRAM_WRITE; nvram_open_mode |= NVRAM_WRITE;
nvram_open_cnt++; nvram_open_cnt++;
spin_unlock(&nvram_open_lock); spin_unlock(&nvram_open_lock);
return (0); return 0;
} }
static int static int
...@@ -368,7 +368,7 @@ nvram_release(struct inode *inode, struct file *file) ...@@ -368,7 +368,7 @@ nvram_release(struct inode *inode, struct file *file)
if (file->f_mode & 2) if (file->f_mode & 2)
nvram_open_mode &= ~NVRAM_WRITE; nvram_open_mode &= ~NVRAM_WRITE;
spin_unlock(&nvram_open_lock); spin_unlock(&nvram_open_lock);
return (0); return 0;
} }
#ifndef CONFIG_PROC_FS #ifndef CONFIG_PROC_FS
...@@ -396,9 +396,9 @@ nvram_read_proc(char *buffer, char **start, off_t offset, ...@@ -396,9 +396,9 @@ nvram_read_proc(char *buffer, char **start, off_t offset,
*eof = mach_proc_infos(contents, buffer, &len, &begin, offset, size); *eof = mach_proc_infos(contents, buffer, &len, &begin, offset, size);
if (offset >= begin + len) if (offset >= begin + len)
return (0); return 0;
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
return (size < begin + len - offset ? size : begin + len - offset); return (size < begin + len - offset) ? size : begin + len - offset;
} }
...@@ -406,9 +406,9 @@ nvram_read_proc(char *buffer, char **start, off_t offset, ...@@ -406,9 +406,9 @@ nvram_read_proc(char *buffer, char **start, off_t offset,
* this like that... */ * this like that... */
#define PRINT_PROC(fmt,args...) \ #define PRINT_PROC(fmt,args...) \
do { \ do { \
*len += sprintf( buffer+*len, fmt, ##args ); \ *len += sprintf(buffer+*len, fmt, ##args); \
if (*begin + *len > offset + size) \ if (*begin + *len > offset + size) \
return( 0 ); \ return 0; \
if (*begin + *len < offset) { \ if (*begin + *len < offset) { \
*begin += *len; \ *begin += *len; \
*len = 0; \ *len = 0; \
...@@ -440,7 +440,7 @@ nvram_init(void) ...@@ -440,7 +440,7 @@ nvram_init(void)
/* First test whether the driver should init at all */ /* First test whether the driver should init at all */
if (!CHECK_DRIVER_INIT()) if (!CHECK_DRIVER_INIT())
return (-ENXIO); return -ENXIO;
ret = misc_register(&nvram_dev); ret = misc_register(&nvram_dev);
if (ret) { if (ret) {
...@@ -457,7 +457,7 @@ nvram_init(void) ...@@ -457,7 +457,7 @@ nvram_init(void)
ret = 0; ret = 0;
printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n"); printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n");
out: out:
return (ret); return ret;
outmisc: outmisc:
misc_deregister(&nvram_dev); misc_deregister(&nvram_dev);
goto out; goto out;
...@@ -488,8 +488,7 @@ pc_check_checksum(void) ...@@ -488,8 +488,7 @@ pc_check_checksum(void)
for (i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i) for (i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i)
sum += nvram_read_int(i); sum += nvram_read_int(i);
return ((sum & 0xffff) == return ((sum & 0xffff) ==
((nvram_read_int(PC_CKS_LOC) << 8) | ((nvram_read_int(PC_CKS_LOC)<<8) | nvram_read_int(PC_CKS_LOC+1)));
nvram_read_int(PC_CKS_LOC + 1)));
} }
static void static void
...@@ -578,7 +577,7 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len, ...@@ -578,7 +577,7 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
PRINT_PROC("FPU : %sinstalled\n", PRINT_PROC("FPU : %sinstalled\n",
(nvram[6] & 2) ? "" : "not "); (nvram[6] & 2) ? "" : "not ");
return (1); return 1;
} }
#endif #endif
...@@ -716,7 +715,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len, ...@@ -716,7 +715,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
vmode & 256 ? vmode & 256 ?
(vmode & 16 ? ", line doubling" : ", half screen") : ""); (vmode & 16 ? ", line doubling" : ", half screen") : "");
return (1); return 1;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment