Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] nvram - CodingStyle

Bring drivers/char/nvram.c in line with the Coding Style.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

+52 -74
+52 -74
drivers/char/nvram.c
··· 46 46 /* select machine configuration */ 47 47 #if defined(CONFIG_ATARI) 48 48 # define MACH ATARI 49 - #elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and others?? */ 49 + #elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) /* and ?? */ 50 50 # define MACH PC 51 51 #else 52 52 # error Cannot build nvram driver for this machine configuration. ··· 107 107 #include <linux/init.h> 108 108 #include <linux/proc_fs.h> 109 109 #include <linux/spinlock.h> 110 + #include <linux/io.h> 111 + #include <linux/uaccess.h> 110 112 111 - #include <asm/io.h> 112 - #include <asm/uaccess.h> 113 113 #include <asm/system.h> 114 114 115 115 static DEFINE_SPINLOCK(nvram_state_lock); ··· 123 123 124 124 #ifdef CONFIG_PROC_FS 125 125 static int mach_proc_infos(unsigned char *contents, char *buffer, int *len, 126 - off_t *begin, off_t offset, int size); 126 + off_t *begin, off_t offset, int size); 127 127 #endif 128 128 129 129 /* ··· 133 133 * 134 134 * It is worth noting that these functions all access bytes of general 135 135 * purpose memory in the NVRAM - that is to say, they all add the 136 - * NVRAM_FIRST_BYTE offset. Pass them offsets into NVRAM as if you did not 136 + * NVRAM_FIRST_BYTE offset. Pass them offsets into NVRAM as if you did not 137 137 * know about the RTC cruft. 138 138 */ 139 139 140 - unsigned char 141 - __nvram_read_byte(int i) 140 + unsigned char __nvram_read_byte(int i) 142 141 { 143 142 return CMOS_READ(NVRAM_FIRST_BYTE + i); 144 143 } 144 + EXPORT_SYMBOL(__nvram_read_byte); 145 145 146 - unsigned char 147 - nvram_read_byte(int i) 146 + unsigned char nvram_read_byte(int i) 148 147 { 149 148 unsigned long flags; 150 149 unsigned char c; ··· 153 154 spin_unlock_irqrestore(&rtc_lock, flags); 154 155 return c; 155 156 } 157 + EXPORT_SYMBOL(nvram_read_byte); 156 158 157 159 /* This races nicely with trying to read with checksum checking (nvram_read) */ 158 - void 159 - __nvram_write_byte(unsigned char c, int i) 160 + void __nvram_write_byte(unsigned char c, int i) 160 161 { 161 162 CMOS_WRITE(c, NVRAM_FIRST_BYTE + i); 162 163 } 164 + EXPORT_SYMBOL(__nvram_write_byte); 163 165 164 - void 165 - nvram_write_byte(unsigned char c, int i) 166 + void nvram_write_byte(unsigned char c, int i) 166 167 { 167 168 unsigned long flags; 168 169 ··· 170 171 __nvram_write_byte(c, i); 171 172 spin_unlock_irqrestore(&rtc_lock, flags); 172 173 } 174 + EXPORT_SYMBOL(nvram_write_byte); 173 175 174 - int 175 - __nvram_check_checksum(void) 176 + int __nvram_check_checksum(void) 176 177 { 177 178 return mach_check_checksum(); 178 179 } 180 + EXPORT_SYMBOL(__nvram_check_checksum); 179 181 180 - int 181 - nvram_check_checksum(void) 182 + int nvram_check_checksum(void) 182 183 { 183 184 unsigned long flags; 184 185 int rv; ··· 188 189 spin_unlock_irqrestore(&rtc_lock, flags); 189 190 return rv; 190 191 } 192 + EXPORT_SYMBOL(nvram_check_checksum); 191 193 192 - static void 193 - __nvram_set_checksum(void) 194 + static void __nvram_set_checksum(void) 194 195 { 195 196 mach_set_checksum(); 196 197 } 197 198 198 199 #if 0 199 - void 200 - nvram_set_checksum(void) 200 + void nvram_set_checksum(void) 201 201 { 202 202 unsigned long flags; 203 203 ··· 210 212 * The are the file operation function for user access to /dev/nvram 211 213 */ 212 214 213 - static loff_t nvram_llseek(struct file *file,loff_t offset, int origin ) 215 + static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) 214 216 { 215 217 lock_kernel(); 216 218 switch (origin) { ··· 228 230 return (offset >= 0) ? (file->f_pos = offset) : -EINVAL; 229 231 } 230 232 231 - static ssize_t 232 - nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 233 + static ssize_t nvram_read(struct file *file, char __user *buf, 234 + size_t count, loff_t *ppos) 233 235 { 234 236 unsigned char contents[NVRAM_BYTES]; 235 237 unsigned i = *ppos; ··· 252 254 253 255 return tmp - contents; 254 256 255 - checksum_err: 257 + checksum_err: 256 258 spin_unlock_irq(&rtc_lock); 257 259 return -EIO; 258 260 } 259 261 260 - static ssize_t 261 - nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 262 + static ssize_t nvram_write(struct file *file, const char __user *buf, 263 + size_t count, loff_t *ppos) 262 264 { 263 265 unsigned char contents[NVRAM_BYTES]; 264 266 unsigned i = *ppos; ··· 285 287 286 288 return tmp - contents; 287 289 288 - checksum_err: 290 + checksum_err: 289 291 spin_unlock_irq(&rtc_lock); 290 292 return -EIO; 291 293 } 292 294 293 - static int 294 - nvram_ioctl(struct inode *inode, struct file *file, 295 - unsigned int cmd, unsigned long arg) 295 + static int nvram_ioctl(struct inode *inode, struct file *file, 296 + unsigned int cmd, unsigned long arg) 296 297 { 297 298 int i; 298 299 ··· 312 315 return 0; 313 316 314 317 case NVRAM_SETCKS: 315 - /* just set checksum, contents unchanged (maybe useful after 318 + /* just set checksum, contents unchanged (maybe useful after 316 319 * checksum garbaged somehow...) */ 317 320 if (!capable(CAP_SYS_ADMIN)) 318 321 return -EACCES; ··· 327 330 } 328 331 } 329 332 330 - static int 331 - nvram_open(struct inode *inode, struct file *file) 333 + static int nvram_open(struct inode *inode, struct file *file) 332 334 { 333 335 lock_kernel(); 334 336 spin_lock(&nvram_state_lock); ··· 352 356 return 0; 353 357 } 354 358 355 - static int 356 - nvram_release(struct inode *inode, struct file *file) 359 + static int nvram_release(struct inode *inode, struct file *file) 357 360 { 358 361 spin_lock(&nvram_state_lock); 359 362 ··· 370 375 } 371 376 372 377 #ifndef CONFIG_PROC_FS 373 - static int 374 - nvram_read_proc(char *buffer, char **start, off_t offset, 375 - int size, int *eof, void *data) 378 + static int nvram_read_proc(char *buffer, char **start, off_t offset, 379 + int size, int *eof, void *data) 376 380 { 377 381 return 0; 378 382 } 379 383 #else 380 384 381 - static int 382 - nvram_read_proc(char *buffer, char **start, off_t offset, 383 - int size, int *eof, void *data) 385 + static int nvram_read_proc(char *buffer, char **start, off_t offset, 386 + int size, int *eof, void *data) 384 387 { 385 388 unsigned char contents[NVRAM_BYTES]; 386 389 int i, len = 0; ··· 402 409 * this like that... */ 403 410 #define PRINT_PROC(fmt,args...) \ 404 411 do { \ 405 - *len += sprintf(buffer+*len, fmt, ##args); \ 412 + *len += sprintf(buffer + *len, fmt, ##args); \ 406 413 if (*begin + *len > offset + size) \ 407 414 return 0; \ 408 415 if (*begin + *len < offset) { \ 409 416 *begin += *len; \ 410 417 *len = 0; \ 411 418 } \ 412 - } while(0) 419 + } while (0) 413 420 414 421 #endif /* CONFIG_PROC_FS */ 415 422 ··· 429 436 &nvram_fops 430 437 }; 431 438 432 - static int __init 433 - nvram_init(void) 439 + static int __init nvram_init(void) 434 440 { 435 441 int ret; 436 442 ··· 451 459 } 452 460 ret = 0; 453 461 printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n"); 454 - out: 462 + out: 455 463 return ret; 456 - outmisc: 464 + outmisc: 457 465 misc_deregister(&nvram_dev); 458 466 goto out; 459 467 } 460 468 461 - static void __exit 462 - nvram_cleanup_module(void) 469 + static void __exit nvram_cleanup_module(void) 463 470 { 464 471 remove_proc_entry("driver/nvram", NULL); 465 472 misc_deregister(&nvram_dev); ··· 473 482 474 483 #if MACH == PC 475 484 476 - static int 477 - pc_check_checksum(void) 485 + static int pc_check_checksum(void) 478 486 { 479 487 int i; 480 488 unsigned short sum = 0; ··· 483 493 sum += __nvram_read_byte(i); 484 494 expect = __nvram_read_byte(PC_CKS_LOC)<<8 | 485 495 __nvram_read_byte(PC_CKS_LOC+1); 486 - return ((sum & 0xffff) == expect); 496 + return (sum & 0xffff) == expect; 487 497 } 488 498 489 - static void 490 - pc_set_checksum(void) 499 + static void pc_set_checksum(void) 491 500 { 492 501 int i; 493 502 unsigned short sum = 0; ··· 511 522 "monochrome", 512 523 }; 513 524 514 - static int 515 - pc_proc_infos(unsigned char *nvram, char *buffer, int *len, 516 - off_t *begin, off_t offset, int size) 525 + static int pc_proc_infos(unsigned char *nvram, char *buffer, int *len, 526 + off_t *begin, off_t offset, int size) 517 527 { 518 528 int checksum; 519 529 int type; ··· 578 590 579 591 #if MACH == ATARI 580 592 581 - static int 582 - atari_check_checksum(void) 593 + static int atari_check_checksum(void) 583 594 { 584 595 int i; 585 596 unsigned char sum = 0; 586 597 587 598 for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i) 588 599 sum += __nvram_read_byte(i); 589 - return (__nvram_read_byte(ATARI_CKS_LOC) == (~sum & 0xff) && 590 - __nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff)); 600 + return (__nvram_read_byte(ATARI_CKS_LOC) == (~sum & 0xff)) && 601 + (__nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff)); 591 602 } 592 603 593 - static void 594 - atari_set_checksum(void) 604 + static void atari_set_checksum(void) 595 605 { 596 606 int i; 597 607 unsigned char sum = 0; ··· 640 654 "2", "4", "16", "256", "65536", "??", "??", "??" 641 655 }; 642 656 643 - static int 644 - atari_proc_infos(unsigned char *nvram, char *buffer, int *len, 645 - off_t *begin, off_t offset, int size) 657 + static int atari_proc_infos(unsigned char *nvram, char *buffer, int *len, 658 + off_t *begin, off_t offset, int size) 646 659 { 647 660 int checksum = nvram_check_checksum(); 648 661 int i; ··· 710 725 #endif /* MACH == ATARI */ 711 726 712 727 MODULE_LICENSE("GPL"); 713 - 714 - EXPORT_SYMBOL(__nvram_read_byte); 715 - EXPORT_SYMBOL(nvram_read_byte); 716 - EXPORT_SYMBOL(__nvram_write_byte); 717 - EXPORT_SYMBOL(nvram_write_byte); 718 - EXPORT_SYMBOL(__nvram_check_checksum); 719 - EXPORT_SYMBOL(nvram_check_checksum); 720 728 MODULE_ALIAS_MISCDEV(NVRAM_MINOR);