Patchwork [Raring,07/13] Input: ALPS - move {addr, nibble}_command settings into alps_set_defaults()

login
register
mail settings
Submitter James M. Leddy
Date March 19, 2013, 4:27 p.m.
Message ID <1363710432-6172-8-git-send-email-james.leddy@canonical.com>
Download mbox | patch
Permalink /patch/229129/
State New
Headers show

Comments

James M. Leddy - March 19, 2013, 4:27 p.m.
From: Kevin Cernekee <cernekee@gmail.com>

This allows alps_identify() to override these settings based on the
device characteristics, if it is ever necessary.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Tested-by: Dave Turvene <dturvene@dahetral.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
(cherry picked from commit 50e8b2162feb851f5af1372ba996640ad8d66fc9)
---
 drivers/input/mouse/alps.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Patch

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index fe45687..2221a00 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1190,14 +1190,10 @@  static int alps_absolute_mode_v3(struct psmouse *psmouse)
 
 static int alps_hw_init_v3(struct psmouse *psmouse)
 {
-	struct alps_data *priv = psmouse->private;
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	int reg_val;
 	unsigned char param[4];
 
-	priv->nibble_commands = alps_v3_nibble_commands;
-	priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
-
 	if (alps_enter_command_mode(psmouse, NULL))
 		goto error;
 
@@ -1343,13 +1339,9 @@  static int alps_absolute_mode_v4(struct psmouse *psmouse)
 
 static int alps_hw_init_v4(struct psmouse *psmouse)
 {
-	struct alps_data *priv = psmouse->private;
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	unsigned char param[4];
 
-	priv->nibble_commands = alps_v4_nibble_commands;
-	priv->addr_command = PSMOUSE_CMD_DISABLE;
-
 	if (alps_enter_command_mode(psmouse, NULL))
 		goto error;
 
@@ -1431,11 +1423,15 @@  static void alps_set_defaults(struct alps_data *priv)
 		priv->hw_init = alps_hw_init_v3;
 		priv->process_packet = alps_process_packet_v3;
 		priv->set_abs_params = alps_set_abs_params_mt;
+		priv->nibble_commands = alps_v3_nibble_commands;
+		priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
 		break;
 	case ALPS_PROTO_V4:
 		priv->hw_init = alps_hw_init_v4;
 		priv->process_packet = alps_process_packet_v4;
 		priv->set_abs_params = alps_set_abs_params_mt;
+		priv->nibble_commands = alps_v4_nibble_commands;
+		priv->addr_command = PSMOUSE_CMD_DISABLE;
 		break;
 	}
 }