Thread (23 messages) 23 messages, 2 authors, 2015-01-13

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

STALE4282d

From: Pali Rohár <hidden>
Date: 2014-11-14 19:41:08
Also in: lkml
Subsystem: alps ps/2 touchpad driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help