Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+38 -13
+14 -6
drivers/input/mouse/lifebook.c
··· 25 25 char phys[32]; 26 26 }; 27 27 28 + static bool lifebook_present; 29 + 28 30 static const char *desired_serio_phys; 29 31 30 - static int lifebook_set_serio_phys(const struct dmi_system_id *d) 32 + static int lifebook_limit_serio3(const struct dmi_system_id *d) 31 33 { 32 - desired_serio_phys = d->driver_data; 34 + desired_serio_phys = "isa0060/serio3"; 33 35 return 0; 34 36 } 35 37 ··· 43 41 return 0; 44 42 } 45 43 46 - static const struct dmi_system_id lifebook_dmi_table[] = { 44 + static const struct dmi_system_id __initconst lifebook_dmi_table[] = { 45 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 47 46 { 48 47 .ident = "FLORA-ie 55mi", 49 48 .matches = { ··· 86 83 .matches = { 87 84 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), 88 85 }, 89 - .callback = lifebook_set_serio_phys, 90 - .driver_data = "isa0060/serio3", 86 + .callback = lifebook_limit_serio3, 91 87 }, 92 88 { 93 89 .ident = "Panasonic CF-28", ··· 118 116 }, 119 117 }, 120 118 { } 119 + #endif 121 120 }; 121 + 122 + void __init lifebook_module_init(void) 123 + { 124 + lifebook_present = dmi_check_system(lifebook_dmi_table); 125 + } 122 126 123 127 static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) 124 128 { ··· 251 243 252 244 int lifebook_detect(struct psmouse *psmouse, bool set_properties) 253 245 { 254 - if (!dmi_check_system(lifebook_dmi_table)) 246 + if (!lifebook_present) 255 247 return -1; 256 248 257 249 if (desired_serio_phys &&
+4
drivers/input/mouse/lifebook.h
··· 12 12 #define _LIFEBOOK_H 13 13 14 14 #ifdef CONFIG_MOUSE_PS2_LIFEBOOK 15 + void lifebook_module_init(void); 15 16 int lifebook_detect(struct psmouse *psmouse, bool set_properties); 16 17 int lifebook_init(struct psmouse *psmouse); 17 18 #else 19 + inline void lifebook_module_init(void) 20 + { 21 + } 18 22 inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) 19 23 { 20 24 return -ENOSYS;
+3
drivers/input/mouse/psmouse-base.c
··· 1696 1696 { 1697 1697 int err; 1698 1698 1699 + lifebook_module_init(); 1700 + synaptics_module_init(); 1701 + 1699 1702 kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); 1700 1703 if (!kpsmoused_wq) { 1701 1704 printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n");
+16 -7
drivers/input/mouse/synaptics.c
··· 24 24 */ 25 25 26 26 #include <linux/module.h> 27 + #include <linux/dmi.h> 27 28 #include <linux/input.h> 28 29 #include <linux/serio.h> 29 30 #include <linux/libps2.h> ··· 630 629 return 0; 631 630 } 632 631 633 - #if defined(__i386__) 634 - #include <linux/dmi.h> 635 - static const struct dmi_system_id toshiba_dmi_table[] = { 632 + static bool impaired_toshiba_kbc; 633 + 634 + static const struct dmi_system_id __initconst toshiba_dmi_table[] = { 635 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 636 636 { 637 637 .ident = "Toshiba Satellite", 638 638 .matches = { ··· 666 664 667 665 }, 668 666 { } 669 - }; 670 667 #endif 668 + }; 669 + 670 + void __init synaptics_module_init(void) 671 + { 672 + impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); 673 + } 671 674 672 675 int synaptics_init(struct psmouse *psmouse) 673 676 { ··· 725 718 if (SYN_CAP_PASS_THROUGH(priv->capabilities)) 726 719 synaptics_pt_create(psmouse); 727 720 728 - #if defined(__i386__) 729 721 /* 730 722 * Toshiba's KBC seems to have trouble handling data from 731 723 * Synaptics as full rate, switch to lower rate which is roughly 732 724 * thye same as rate of standard PS/2 mouse. 733 725 */ 734 - if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { 726 + if (psmouse->rate >= 80 && impaired_toshiba_kbc) { 735 727 printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", 736 728 dmi_get_system_info(DMI_PRODUCT_NAME)); 737 729 psmouse->rate = 40; 738 730 } 739 - #endif 740 731 741 732 return 0; 742 733 ··· 744 739 } 745 740 746 741 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 742 + 743 + void __init synaptics_module_init(void) 744 + { 745 + } 747 746 748 747 int synaptics_init(struct psmouse *psmouse) 749 748 {
+1
drivers/input/mouse/synaptics.h
··· 105 105 int scroll; 106 106 }; 107 107 108 + void synaptics_module_init(void); 108 109 int synaptics_detect(struct psmouse *psmouse, bool set_properties); 109 110 int synaptics_init(struct psmouse *psmouse); 110 111 void synaptics_reset(struct psmouse *psmouse);