]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/input/mouse/synaptics.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[mv-sheeva.git] / drivers / input / mouse / synaptics.c
index 0293094224098b1b2aa46c71609fddad1b0239f3..392108c436baca504abd345b4013ae90799e41e5 100644 (file)
@@ -247,14 +247,12 @@ static void synaptics_pt_create(struct psmouse *psmouse)
 {
        struct serio *serio;
 
-       serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
+       serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
        if (!serio) {
                printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n");
                return;
        }
 
-       memset(serio, 0, sizeof(struct serio));
-
        serio->id.type = SERIO_PS_PSTHRU;
        strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name));
        strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name));
@@ -342,7 +340,7 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
  */
 static void synaptics_process_packet(struct psmouse *psmouse)
 {
-       struct input_dev *dev = &psmouse->dev;
+       struct input_dev *dev = psmouse->dev;
        struct synaptics_data *priv = psmouse->private;
        struct synaptics_hw_state hw;
        int num_fingers;
@@ -432,11 +430,11 @@ static void synaptics_process_packet(struct psmouse *psmouse)
 
 static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type)
 {
-       static unsigned char newabs_mask[]      = { 0xC8, 0x00, 0x00, 0xC8, 0x00 };
-       static unsigned char newabs_rel_mask[]  = { 0xC0, 0x00, 0x00, 0xC0, 0x00 };
-       static unsigned char newabs_rslt[]      = { 0x80, 0x00, 0x00, 0xC0, 0x00 };
-       static unsigned char oldabs_mask[]      = { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
-       static unsigned char oldabs_rslt[]      = { 0xC0, 0x00, 0x00, 0x80, 0x00 };
+       static const unsigned char newabs_mask[]        = { 0xC8, 0x00, 0x00, 0xC8, 0x00 };
+       static const unsigned char newabs_rel_mask[]    = { 0xC0, 0x00, 0x00, 0xC0, 0x00 };
+       static const unsigned char newabs_rslt[]        = { 0x80, 0x00, 0x00, 0xC0, 0x00 };
+       static const unsigned char oldabs_mask[]        = { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
+       static const unsigned char oldabs_rslt[]        = { 0xC0, 0x00, 0x00, 0x80, 0x00 };
 
        if (idx < 0 || idx > 4)
                return 0;
@@ -473,7 +471,7 @@ static unsigned char synaptics_detect_pkt_type(struct psmouse *psmouse)
 
 static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
 {
-       struct input_dev *dev = &psmouse->dev;
+       struct input_dev *dev = psmouse->dev;
        struct synaptics_data *priv = psmouse->private;
 
        input_regs(dev, regs);
@@ -605,14 +603,21 @@ static struct dmi_system_id toshiba_dmi_table[] = {
                .ident = "Toshiba Satellite",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"),
                },
        },
        {
                .ident = "Toshiba Dynabook",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME , "dynabook"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"),
+               },
+       },
+       {
+               .ident = "Toshiba Portege M300",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"),
                },
        },
        { }
@@ -623,10 +628,9 @@ int synaptics_init(struct psmouse *psmouse)
 {
        struct synaptics_data *priv;
 
-       psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL);
+       psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL);
        if (!priv)
                return -1;
-       memset(priv, 0, sizeof(struct synaptics_data));
 
        if (synaptics_query_hardware(psmouse)) {
                printk(KERN_ERR "Unable to query Synaptics hardware.\n");
@@ -645,13 +649,15 @@ int synaptics_init(struct psmouse *psmouse)
                SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
                priv->model_id, priv->capabilities, priv->ext_cap);
 
-       set_input_params(&psmouse->dev, priv);
+       set_input_params(psmouse->dev, priv);
 
        psmouse->protocol_handler = synaptics_process_byte;
        psmouse->set_rate = synaptics_set_rate;
        psmouse->disconnect = synaptics_disconnect;
        psmouse->reconnect = synaptics_reconnect;
        psmouse->pktsize = 6;
+       /* Synaptics can usually stay in sync without extra help */
+       psmouse->resync_time = 0;
 
        if (SYN_CAP_PASS_THROUGH(priv->capabilities))
                synaptics_pt_create(psmouse);