Skip to content

Commit

Permalink
Input: psmouse - use psmouse_[de]activate() from sentelic and hgpk dr…
Browse files Browse the repository at this point in the history
…ivers

Make use of psmouse_activate() and psmouse_deactivate() from psmouse-base.c

Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Paul Fox authored and Dmitry Torokhov committed Feb 24, 2012
1 parent bd26f3d commit c35c0e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
9 changes: 2 additions & 7 deletions drivers/input/mouse/hgpk.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@ static int hgpk_reset_device(struct psmouse *psmouse, bool recalibrate)

static int hgpk_force_recalibrate(struct psmouse *psmouse)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
struct hgpk_data *priv = psmouse->private;
int err;

Expand Down Expand Up @@ -669,12 +668,9 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
* we don't have a good way to deal with it. The 2s window stuff
* (below) is our best option for now.
*/

if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE))
if (psmouse_activate(psmouse))
return -1;

psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);

if (tpdebug)
psmouse_dbg(psmouse, "touchpad reactivated\n");

Expand Down Expand Up @@ -733,8 +729,7 @@ static int hgpk_toggle_powersave(struct psmouse *psmouse, int enable)
}

/* should be all set, enable the touchpad */
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
psmouse_activate(psmouse);
psmouse_dbg(psmouse, "Touchpad powered up.\n");
} else {
psmouse_dbg(psmouse, "Powering off touchpad.\n");
Expand Down
12 changes: 4 additions & 8 deletions drivers/input/mouse/sentelic.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)
* to do that for writes because sysfs set helper does this for
* us.
*/
ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE);
psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
psmouse_deactivate(psmouse);

ps2_begin_command(ps2dev);

Expand Down Expand Up @@ -128,8 +127,7 @@ static int fsp_reg_read(struct psmouse *psmouse, int reg_addr, int *reg_val)

out:
ps2_end_command(ps2dev);
ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
psmouse_activate(psmouse);
dev_dbg(&ps2dev->serio->dev, "READ REG: 0x%02x is 0x%02x (rc = %d)\n",
reg_addr, *reg_val, rc);
return rc;
Expand Down Expand Up @@ -213,8 +211,7 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val)
unsigned char param[3];
int rc = -1;

ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE);
psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
psmouse_deactivate(psmouse);

ps2_begin_command(ps2dev);

Expand All @@ -239,8 +236,7 @@ static int fsp_page_reg_read(struct psmouse *psmouse, int *reg_val)

out:
ps2_end_command(ps2dev);
ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE);
psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
psmouse_activate(psmouse);
dev_dbg(&ps2dev->serio->dev, "READ PAGE REG: 0x%02x (rc = %d)\n",
*reg_val, rc);
return rc;
Expand Down

0 comments on commit c35c0e7

Please sign in to comment.