Commit 3f5f7e2e authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Torvalds

[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: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5cdb7b48
...@@ -66,7 +66,6 @@ static unsigned char misc_minors[DYNAMIC_MINORS / 8]; ...@@ -66,7 +66,6 @@ static unsigned char misc_minors[DYNAMIC_MINORS / 8];
extern int rtc_DP8570A_init(void); extern int rtc_DP8570A_init(void);
extern int rtc_MK48T08_init(void); extern int rtc_MK48T08_init(void);
extern int pmu_device_init(void); extern int pmu_device_init(void);
extern int tosh_init(void);
extern int i8k_init(void); extern int i8k_init(void);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -314,9 +313,6 @@ static int __init misc_init(void) ...@@ -314,9 +313,6 @@ static int __init misc_init(void)
#ifdef CONFIG_PMAC_PBOOK #ifdef CONFIG_PMAC_PBOOK
pmu_device_init(); pmu_device_init();
#endif #endif
#ifdef CONFIG_TOSHIBA
tosh_init();
#endif
#ifdef CONFIG_I8K #ifdef CONFIG_I8K
i8k_init(); i8k_init();
#endif #endif
......
...@@ -73,16 +73,20 @@ ...@@ -73,16 +73,20 @@
#define TOSH_MINOR_DEV 181 #define TOSH_MINOR_DEV 181
static int tosh_id = 0x0000; MODULE_LICENSE("GPL");
static int tosh_bios = 0x0000; MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
static int tosh_date = 0x0000; MODULE_DESCRIPTION("Toshiba laptop SMM driver");
static int tosh_sci = 0x0000; MODULE_SUPPORTED_DEVICE("toshiba");
static int tosh_fan = 0;
static int tosh_fn = 0;
module_param(tosh_fn, int, 0); static int tosh_fn;
module_param_named(fn, tosh_fn, int, 0);
MODULE_PARM_DESC(fn, "User specified Fn key detection port");
static int tosh_id;
static int tosh_bios;
static int tosh_date;
static int tosh_sci;
static int tosh_fan;
static int tosh_ioctl(struct inode *, struct file *, unsigned int, static int tosh_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
...@@ -475,16 +479,15 @@ static int tosh_probe(void) ...@@ -475,16 +479,15 @@ static int tosh_probe(void)
return 0; return 0;
} }
int __init tosh_init(void) static int __init toshiba_init(void)
{ {
int retval; int retval;
/* are we running on a Toshiba laptop */ /* are we running on a Toshiba laptop */
if (tosh_probe()!=0) if (tosh_probe())
return -EIO; return -ENODEV;
printk(KERN_INFO "Toshiba System Managment Mode driver v" printk(KERN_INFO "Toshiba System Managment Mode driver v" TOSH_VERSION "\n");
TOSH_VERSION"\n");
/* set the port to use for Fn status if not specified as a parameter */ /* set the port to use for Fn status if not specified as a parameter */
if (tosh_fn==0x00) if (tosh_fn==0x00)
...@@ -492,12 +495,12 @@ int __init tosh_init(void) ...@@ -492,12 +495,12 @@ int __init tosh_init(void)
/* register the device file */ /* register the device file */
retval = misc_register(&tosh_device); retval = misc_register(&tosh_device);
if(retval < 0) if (retval < 0)
return retval; return retval;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* register the proc entry */ /* register the proc entry */
if(create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL){ if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) {
misc_deregister(&tosh_device); misc_deregister(&tosh_device);
return -ENOMEM; return -ENOMEM;
} }
...@@ -506,27 +509,12 @@ int __init tosh_init(void) ...@@ -506,27 +509,12 @@ int __init tosh_init(void)
return 0; return 0;
} }
#ifdef MODULE static void __exit toshiba_exit(void)
int init_module(void)
{
return tosh_init();
}
void cleanup_module(void)
{ {
/* remove the proc entry */
remove_proc_entry("toshiba", NULL); remove_proc_entry("toshiba", NULL);
/* unregister the device file */
misc_deregister(&tosh_device); misc_deregister(&tosh_device);
} }
#endif
MODULE_LICENSE("GPL"); module_init(toshiba_init);
MODULE_PARM_DESC(tosh_fn, "User specified Fn key detection port"); module_exit(toshiba_exit);
MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
MODULE_DESCRIPTION("Toshiba laptop SMM driver");
MODULE_SUPPORTED_DEVICE("toshiba");
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