From 7705d548cbe33f18ea7713b9a07aa11047aaeca4 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 3 Dec 2009 23:21:14 -0800 Subject: [PATCH] Input: psmouse - do not carry DMI data around DMI tables use considerable amount of memory. Mark them as __initconst so they will be discarded once module is loaded. Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/lifebook.c | 20 ++++++++++++++------ drivers/input/mouse/lifebook.h | 4 ++++ drivers/input/mouse/psmouse-base.c | 3 +++ drivers/input/mouse/synaptics.c | 23 ++++++++++++++++------- drivers/input/mouse/synaptics.h | 1 + 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 54b7f64d6e6..cd81cefdc1c 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c @@ -25,11 +25,13 @@ struct lifebook_data { char phys[32]; }; +static bool lifebook_present; + static const char *desired_serio_phys; -static int lifebook_set_serio_phys(const struct dmi_system_id *d) +static int lifebook_limit_serio3(const struct dmi_system_id *d) { - desired_serio_phys = d->driver_data; + desired_serio_phys = "isa0060/serio3"; return 0; } @@ -41,7 +43,8 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) return 0; } -static const struct dmi_system_id lifebook_dmi_table[] = { +static const struct dmi_system_id __initconst lifebook_dmi_table[] = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) { .ident = "FLORA-ie 55mi", .matches = { @@ -83,8 +86,7 @@ static const struct dmi_system_id lifebook_dmi_table[] = { .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), }, - .callback = lifebook_set_serio_phys, - .driver_data = "isa0060/serio3", + .callback = lifebook_limit_serio3, }, { .ident = "Panasonic CF-28", @@ -116,8 +118,14 @@ static const struct dmi_system_id lifebook_dmi_table[] = { }, }, { } +#endif }; +void __init lifebook_module_init(void) +{ + lifebook_present = dmi_check_system(lifebook_dmi_table); +} + static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) { struct lifebook_data *priv = psmouse->private; @@ -243,7 +251,7 @@ static void lifebook_disconnect(struct psmouse *psmouse) int lifebook_detect(struct psmouse *psmouse, bool set_properties) { - if (!dmi_check_system(lifebook_dmi_table)) + if (!lifebook_present) return -1; if (desired_serio_phys && diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h index 407cb226bc0..4c4326c6f50 100644 --- a/drivers/input/mouse/lifebook.h +++ b/drivers/input/mouse/lifebook.h @@ -12,9 +12,13 @@ #define _LIFEBOOK_H #ifdef CONFIG_MOUSE_PS2_LIFEBOOK +void lifebook_module_init(void); int lifebook_detect(struct psmouse *psmouse, bool set_properties); int lifebook_init(struct psmouse *psmouse); #else +inline void lifebook_module_init(void) +{ +} inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) { return -ENOSYS; diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index acd16707696..fd0bc094616 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -1696,6 +1696,9 @@ static int __init psmouse_init(void) { int err; + lifebook_module_init(); + synaptics_module_init(); + kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); if (!kpsmoused_wq) { printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index f4a61252bcc..36d6df4c0a7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -24,6 +24,7 @@ */ #include +#include #include #include #include @@ -629,9 +630,10 @@ static int synaptics_reconnect(struct psmouse *psmouse) return 0; } -#if defined(__i386__) -#include -static const struct dmi_system_id toshiba_dmi_table[] = { +static bool impaired_toshiba_kbc; + +static const struct dmi_system_id __initconst toshiba_dmi_table[] = { +#if defined(CONFIG_DMI) && defined(CONFIG_X86) { .ident = "Toshiba Satellite", .matches = { @@ -664,8 +666,13 @@ static const struct dmi_system_id toshiba_dmi_table[] = { }, { } -}; #endif +}; + +void __init synaptics_module_init(void) +{ + impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); +} int synaptics_init(struct psmouse *psmouse) { @@ -718,18 +725,16 @@ int synaptics_init(struct psmouse *psmouse) if (SYN_CAP_PASS_THROUGH(priv->capabilities)) synaptics_pt_create(psmouse); -#if defined(__i386__) /* * Toshiba's KBC seems to have trouble handling data from * Synaptics as full rate, switch to lower rate which is roughly * thye same as rate of standard PS/2 mouse. */ - if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { + if (psmouse->rate >= 80 && impaired_toshiba_kbc) { printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", dmi_get_system_info(DMI_PRODUCT_NAME)); psmouse->rate = 40; } -#endif return 0; @@ -740,6 +745,10 @@ int synaptics_init(struct psmouse *psmouse) #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ +void __init synaptics_module_init(void) +{ +} + int synaptics_init(struct psmouse *psmouse) { return -ENOSYS; diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 871f6fe377f..838e7f2c9b3 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -105,6 +105,7 @@ struct synaptics_data { int scroll; }; +void synaptics_module_init(void); int synaptics_detect(struct psmouse *psmouse, bool set_properties); int synaptics_init(struct psmouse *psmouse); void synaptics_reset(struct psmouse *psmouse); -- 2.39.5