diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-06-25 17:54:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:24 -0400 |
commit | 3f5f7e2eeb539da95157d7fa8c94fb2f3284b9cc (patch) | |
tree | c3a454e0660ca8b3a2b30a7d1aa1c026ef7242c8 /drivers/char/toshiba.c | |
parent | 5cdb7b48d0d5963e40bb6621bfa7b2d5fddc4562 (diff) |
[PATCH] Toshiba driver cleanup
Toshiba legacy driver cleanup:
- use module_init/module_exit for initialization instead of using
#ifdef MODULE and calling tosh_init manually from drivers/char/misc.c
- do not explicitly initialize static variables
- some whitespace and formatting cleanups
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/toshiba.c')
-rw-r--r-- | drivers/char/toshiba.c | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 58e21fe44262..0c6f521abd0e 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -73,16 +73,20 @@ | |||
73 | 73 | ||
74 | #define TOSH_MINOR_DEV 181 | 74 | #define TOSH_MINOR_DEV 181 |
75 | 75 | ||
76 | static int tosh_id = 0x0000; | 76 | MODULE_LICENSE("GPL"); |
77 | static int tosh_bios = 0x0000; | 77 | MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>"); |
78 | static int tosh_date = 0x0000; | 78 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); |
79 | static int tosh_sci = 0x0000; | 79 | MODULE_SUPPORTED_DEVICE("toshiba"); |
80 | static int tosh_fan = 0; | ||
81 | |||
82 | static int tosh_fn = 0; | ||
83 | 80 | ||
84 | module_param(tosh_fn, int, 0); | 81 | static int tosh_fn; |
82 | module_param_named(fn, tosh_fn, int, 0); | ||
83 | MODULE_PARM_DESC(fn, "User specified Fn key detection port"); | ||
85 | 84 | ||
85 | static int tosh_id; | ||
86 | static int tosh_bios; | ||
87 | static int tosh_date; | ||
88 | static int tosh_sci; | ||
89 | static int tosh_fan; | ||
86 | 90 | ||
87 | static int tosh_ioctl(struct inode *, struct file *, unsigned int, | 91 | static int tosh_ioctl(struct inode *, struct file *, unsigned int, |
88 | unsigned long); | 92 | unsigned long); |
@@ -359,7 +363,7 @@ static int tosh_get_machine_id(void) | |||
359 | unsigned long address; | 363 | unsigned long address; |
360 | 364 | ||
361 | id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa)); | 365 | id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa)); |
362 | 366 | ||
363 | /* do we have a SCTTable machine identication number on our hands */ | 367 | /* do we have a SCTTable machine identication number on our hands */ |
364 | 368 | ||
365 | if (id==0xfc2f) { | 369 | if (id==0xfc2f) { |
@@ -424,7 +428,7 @@ static int tosh_probe(void) | |||
424 | } | 428 | } |
425 | 429 | ||
426 | /* call the Toshiba SCI support check routine */ | 430 | /* call the Toshiba SCI support check routine */ |
427 | 431 | ||
428 | regs.eax = 0xf0f0; | 432 | regs.eax = 0xf0f0; |
429 | regs.ebx = 0x0000; | 433 | regs.ebx = 0x0000; |
430 | regs.ecx = 0x0000; | 434 | regs.ecx = 0x0000; |
@@ -440,7 +444,7 @@ static int tosh_probe(void) | |||
440 | /* if we get this far then we are running on a Toshiba (probably)! */ | 444 | /* if we get this far then we are running on a Toshiba (probably)! */ |
441 | 445 | ||
442 | tosh_sci = regs.edx & 0xffff; | 446 | tosh_sci = regs.edx & 0xffff; |
443 | 447 | ||
444 | /* next get the machine ID of the current laptop */ | 448 | /* next get the machine ID of the current laptop */ |
445 | 449 | ||
446 | tosh_id = tosh_get_machine_id(); | 450 | tosh_id = tosh_get_machine_id(); |
@@ -475,16 +479,15 @@ static int tosh_probe(void) | |||
475 | return 0; | 479 | return 0; |
476 | } | 480 | } |
477 | 481 | ||
478 | int __init tosh_init(void) | 482 | static int __init toshiba_init(void) |
479 | { | 483 | { |
480 | int retval; | 484 | int retval; |
481 | /* are we running on a Toshiba laptop */ | 485 | /* are we running on a Toshiba laptop */ |
482 | 486 | ||
483 | if (tosh_probe()!=0) | 487 | if (tosh_probe()) |
484 | return -EIO; | 488 | return -ENODEV; |
485 | 489 | ||
486 | printk(KERN_INFO "Toshiba System Managment Mode driver v" | 490 | printk(KERN_INFO "Toshiba System Managment Mode driver v" TOSH_VERSION "\n"); |
487 | TOSH_VERSION"\n"); | ||
488 | 491 | ||
489 | /* set the port to use for Fn status if not specified as a parameter */ | 492 | /* set the port to use for Fn status if not specified as a parameter */ |
490 | if (tosh_fn==0x00) | 493 | if (tosh_fn==0x00) |
@@ -492,12 +495,12 @@ int __init tosh_init(void) | |||
492 | 495 | ||
493 | /* register the device file */ | 496 | /* register the device file */ |
494 | retval = misc_register(&tosh_device); | 497 | retval = misc_register(&tosh_device); |
495 | if(retval < 0) | 498 | if (retval < 0) |
496 | return retval; | 499 | return retval; |
497 | 500 | ||
498 | #ifdef CONFIG_PROC_FS | 501 | #ifdef CONFIG_PROC_FS |
499 | /* register the proc entry */ | 502 | /* register the proc entry */ |
500 | if(create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL){ | 503 | if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) { |
501 | misc_deregister(&tosh_device); | 504 | misc_deregister(&tosh_device); |
502 | return -ENOMEM; | 505 | return -ENOMEM; |
503 | } | 506 | } |
@@ -506,27 +509,12 @@ int __init tosh_init(void) | |||
506 | return 0; | 509 | return 0; |
507 | } | 510 | } |
508 | 511 | ||
509 | #ifdef MODULE | 512 | static void __exit toshiba_exit(void) |
510 | int init_module(void) | ||
511 | { | ||
512 | return tosh_init(); | ||
513 | } | ||
514 | |||
515 | void cleanup_module(void) | ||
516 | { | 513 | { |
517 | /* remove the proc entry */ | ||
518 | |||
519 | remove_proc_entry("toshiba", NULL); | 514 | remove_proc_entry("toshiba", NULL); |
520 | |||
521 | /* unregister the device file */ | ||
522 | |||
523 | misc_deregister(&tosh_device); | 515 | misc_deregister(&tosh_device); |
524 | } | 516 | } |
525 | #endif | ||
526 | 517 | ||
527 | MODULE_LICENSE("GPL"); | 518 | module_init(toshiba_init); |
528 | MODULE_PARM_DESC(tosh_fn, "User specified Fn key detection port"); | 519 | module_exit(toshiba_exit); |
529 | MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>"); | ||
530 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); | ||
531 | MODULE_SUPPORTED_DEVICE("toshiba"); | ||
532 | 520 | ||