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 <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov 2009-12-03 23:21:14 -08:00
parent f72a28aba9
commit 7705d548cb
5 changed files with 38 additions and 13 deletions

View file

@ -25,11 +25,13 @@ struct lifebook_data {
char phys[32]; char phys[32];
}; };
static bool lifebook_present;
static const char *desired_serio_phys; 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; return 0;
} }
@ -41,7 +43,8 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
return 0; 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", .ident = "FLORA-ie 55mi",
.matches = { .matches = {
@ -83,8 +86,7 @@ static const struct dmi_system_id lifebook_dmi_table[] = {
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
}, },
.callback = lifebook_set_serio_phys, .callback = lifebook_limit_serio3,
.driver_data = "isa0060/serio3",
}, },
{ {
.ident = "Panasonic CF-28", .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) static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
{ {
struct lifebook_data *priv = psmouse->private; 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) int lifebook_detect(struct psmouse *psmouse, bool set_properties)
{ {
if (!dmi_check_system(lifebook_dmi_table)) if (!lifebook_present)
return -1; return -1;
if (desired_serio_phys && if (desired_serio_phys &&

View file

@ -12,9 +12,13 @@
#define _LIFEBOOK_H #define _LIFEBOOK_H
#ifdef CONFIG_MOUSE_PS2_LIFEBOOK #ifdef CONFIG_MOUSE_PS2_LIFEBOOK
void lifebook_module_init(void);
int lifebook_detect(struct psmouse *psmouse, bool set_properties); int lifebook_detect(struct psmouse *psmouse, bool set_properties);
int lifebook_init(struct psmouse *psmouse); int lifebook_init(struct psmouse *psmouse);
#else #else
inline void lifebook_module_init(void)
{
}
inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) inline int lifebook_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;

View file

@ -1696,6 +1696,9 @@ static int __init psmouse_init(void)
{ {
int err; int err;
lifebook_module_init();
synaptics_module_init();
kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); kpsmoused_wq = create_singlethread_workqueue("kpsmoused");
if (!kpsmoused_wq) { if (!kpsmoused_wq) {
printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n");

View file

@ -24,6 +24,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/dmi.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/libps2.h> #include <linux/libps2.h>
@ -629,9 +630,10 @@ static int synaptics_reconnect(struct psmouse *psmouse)
return 0; return 0;
} }
#if defined(__i386__) static bool impaired_toshiba_kbc;
#include <linux/dmi.h>
static const struct dmi_system_id toshiba_dmi_table[] = { static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{ {
.ident = "Toshiba Satellite", .ident = "Toshiba Satellite",
.matches = { .matches = {
@ -664,8 +666,13 @@ static const struct dmi_system_id toshiba_dmi_table[] = {
}, },
{ } { }
};
#endif #endif
};
void __init synaptics_module_init(void)
{
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
}
int synaptics_init(struct psmouse *psmouse) int synaptics_init(struct psmouse *psmouse)
{ {
@ -718,18 +725,16 @@ int synaptics_init(struct psmouse *psmouse)
if (SYN_CAP_PASS_THROUGH(priv->capabilities)) if (SYN_CAP_PASS_THROUGH(priv->capabilities))
synaptics_pt_create(psmouse); synaptics_pt_create(psmouse);
#if defined(__i386__)
/* /*
* Toshiba's KBC seems to have trouble handling data from * Toshiba's KBC seems to have trouble handling data from
* Synaptics as full rate, switch to lower rate which is roughly * Synaptics as full rate, switch to lower rate which is roughly
* thye same as rate of standard PS/2 mouse. * 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", printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n",
dmi_get_system_info(DMI_PRODUCT_NAME)); dmi_get_system_info(DMI_PRODUCT_NAME));
psmouse->rate = 40; psmouse->rate = 40;
} }
#endif
return 0; return 0;
@ -740,6 +745,10 @@ int synaptics_init(struct psmouse *psmouse)
#else /* CONFIG_MOUSE_PS2_SYNAPTICS */ #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
void __init synaptics_module_init(void)
{
}
int synaptics_init(struct psmouse *psmouse) int synaptics_init(struct psmouse *psmouse)
{ {
return -ENOSYS; return -ENOSYS;

View file

@ -105,6 +105,7 @@ struct synaptics_data {
int scroll; int scroll;
}; };
void synaptics_module_init(void);
int synaptics_detect(struct psmouse *psmouse, bool set_properties); int synaptics_detect(struct psmouse *psmouse, bool set_properties);
int synaptics_init(struct psmouse *psmouse); int synaptics_init(struct psmouse *psmouse);
void synaptics_reset(struct psmouse *psmouse); void synaptics_reset(struct psmouse *psmouse);