[PATCH 3/7] input: alps: Move alps_dolphin_get_device_area into alps_hw_init_dolphin_v1

Pali Rohár
2014-11-14T19:38:22Z

This patch moves function call alps_dolphin_get_device_area() from function
alps_identify() to alps_hw_init_dolphin_v1() so alps_identify() will not call
any other psmouse commands.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cbfdcfc..5603870 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1991,9 +1991,9 @@ error:
return -1;
}

-static int alps_dolphin_get_device_area(struct psmouse *psmouse,
- struct alps_data *priv)
+static int alps_dolphin_get_device_area(struct psmouse *psmouse)
{
+ struct alps_data *priv = psmouse->private;
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4] = {0};
int num_x_electrode, num_y_electrode;
@@ -2042,6 +2042,9 @@ static int alps_hw_init_dolphin_v1(struct psmouse *psmouse)
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2];

+ if (alps_dolphin_get_device_area(psmouse))
+ return -EIO;
+
/* This is dolphin "v1" as empirically defined by florin9doi */
param[0] = 0x64;
param[1] = 0x28;
@@ -2223,10 +2226,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) {
priv->proto_version = ALPS_PROTO_V5;
alps_set_defaults(priv);
- if (alps_dolphin_get_device_area(psmouse, priv))
- return -EIO;
- else
- return 0;
+
+ return 0;
} else if (ec[0] == 0x88 &&
((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) {
priv->proto_version = ALPS_PROTO_V7;
--
1.7.9.5