Skip to content

Commit

Permalink
Input: psmouse - do not carry DMI data around
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Torokhov committed Dec 4, 2009
1 parent f72a28a commit 7705d54
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
20 changes: 14 additions & 6 deletions drivers/input/mouse/lifebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 = {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 &&
Expand Down
4 changes: 4 additions & 0 deletions drivers/input/mouse/lifebook.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/input/mouse/psmouse-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
23 changes: 16 additions & 7 deletions drivers/input/mouse/synaptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/libps2.h>
Expand Down Expand Up @@ -629,9 +630,10 @@ static int synaptics_reconnect(struct psmouse *psmouse)
return 0;
}

#if defined(__i386__)
#include <linux/dmi.h>
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 = {
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/input/mouse/synaptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7705d54

Please sign in to comment.