include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[linux-2.6.git] / drivers / input / mouse / sentelic.c
index 97b1e72..1242775 100644 (file)
@@ -2,7 +2,7 @@
  * Finger Sensing Pad PS/2 mouse driver.
  *
  * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd.
- * Copyright (C) 2005-2009 Tai-hwa Liang, Sentelic Corporation.
+ * Copyright (C) 2005-2010 Tai-hwa Liang, Sentelic Corporation.
  *
  *   This program is free software; you can redistribute it and/or
  *   modify it under the terms of the GNU General Public License
@@ -26,6 +26,7 @@
 #include <linux/libps2.h>
 #include <linux/serio.h>
 #include <linux/jiffies.h>
+#include <linux/slab.h>
 
 #include "psmouse.h"
 #include "sentelic.h"
@@ -92,7 +93,8 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)
         */
        ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE);
        psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
-       mutex_lock(&ps2dev->cmd_mutex);
+
+       ps2_begin_command(ps2dev);
 
        if (ps2_sendbyte(ps2dev, 0xf3, FSP_CMD_TIMEOUT) < 0)
                goto out;
@@ -126,7 +128,7 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)
        rc = 0;
 
  out:
-       mutex_unlock(&ps2dev->cmd_mutex);
+       ps2_end_command(ps2dev);
        ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
        psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
        dev_dbg(&ps2dev->serio->dev, "READ REG: 0x%02x is 0x%02x (rc = %d)\n",
@@ -140,7 +142,7 @@ static int fsp_reg_write(struct psmouse *psmouse, int reg_addr, int reg_val)
        unsigned char v;
        int rc = -1;
 
-       mutex_lock(&ps2dev->cmd_mutex);
+       ps2_begin_command(ps2dev);
 
        if (ps2_sendbyte(ps2dev, 0xf3, FSP_CMD_TIMEOUT) < 0)
                goto out;
@@ -179,7 +181,7 @@ static int fsp_reg_write(struct psmouse *psmouse, int reg_addr, int reg_val)
        rc = 0;
 
  out:
-       mutex_unlock(&ps2dev->cmd_mutex);
+       ps2_end_command(ps2dev);
        dev_dbg(&ps2dev->serio->dev, "WRITE REG: 0x%02x to 0x%02x (rc = %d)\n",
                reg_addr, reg_val, rc);
        return rc;
@@ -214,7 +216,8 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val)
 
        ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE);
        psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
-       mutex_lock(&ps2dev->cmd_mutex);
+
+       ps2_begin_command(ps2dev);
 
        if (ps2_sendbyte(ps2dev, 0xf3, FSP_CMD_TIMEOUT) < 0)
                goto out;
@@ -236,7 +239,7 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val)
        rc = 0;
 
  out:
-       mutex_unlock(&ps2dev->cmd_mutex);
+       ps2_end_command(ps2dev);
        ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
        psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
        dev_dbg(&ps2dev->serio->dev, "READ PAGE REG: 0x%02x (rc = %d)\n",
@@ -250,7 +253,7 @@ static int fsp_page_reg_write(struct psmouse *psmouse, int reg_val)
        unsigned char v;
        int rc = -1;
 
-       mutex_lock(&ps2dev->cmd_mutex);
+       ps2_begin_command(ps2dev);
 
        if (ps2_sendbyte(ps2dev, 0xf3, FSP_CMD_TIMEOUT) < 0)
                goto out;
@@ -275,7 +278,7 @@ static int fsp_page_reg_write(struct psmouse *psmouse, int reg_val)
        rc = 0;
 
  out:
-       mutex_unlock(&ps2dev->cmd_mutex);
+       ps2_end_command(ps2dev);
        dev_dbg(&ps2dev->serio->dev, "WRITE PAGE REG: to 0x%02x (rc = %d)\n",
                reg_val, rc);
        return rc;
@@ -656,9 +659,9 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
                        if (packet[3] & BIT(1))
                                button_status |= 0x0f;  /* wheel up */
                        if (packet[3] & BIT(2))
-                               button_status |= BIT(5);/* horizontal left */
+                               button_status |= BIT(4);/* horizontal left */
                        if (packet[3] & BIT(3))
-                               button_status |= BIT(4);/* horizontal right */
+                               button_status |= BIT(5);/* horizontal right */
                        /* push back to packet queue */
                        if (button_status != 0)
                                packet[3] = button_status;
@@ -756,7 +759,7 @@ static int fsp_activate_protocol(struct psmouse *psmouse)
        return 0;
 }
 
-int fsp_detect(struct psmouse *psmouse, int set_properties)
+int fsp_detect(struct psmouse *psmouse, bool set_properties)
 {
        int id;
 
@@ -834,6 +837,7 @@ int fsp_init(struct psmouse *psmouse)
        priv->flags |= FSPDRV_FLAG_EN_OPC;
 
        /* Set up various supported input event bits */
+       __set_bit(BTN_MIDDLE, psmouse->dev->keybit);
        __set_bit(BTN_BACK, psmouse->dev->keybit);
        __set_bit(BTN_FORWARD, psmouse->dev->keybit);
        __set_bit(REL_WHEEL, psmouse->dev->relbit);