80e48d0
From: Daniel Martin <consume.noise@gmail.com>
80e48d0
Date: Sun, 8 Mar 2015 22:27:37 -0700
80e48d0
Subject: [PATCH] Input: synaptics - split synaptics_resolution(), query first
80e48d0
80e48d0
Split the function synaptics_resolution() into synaptics_resolution() and
80e48d0
synaptics_quirks().  synaptics_resolution() will be called before
80e48d0
synaptics_quirks() to query dimensions and resolutions before overwriting
80e48d0
them with quirks.
80e48d0
80e48d0
Cc: stable@vger.kernel.org
80e48d0
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
80e48d0
Acked-by: Hans de Goede <hdegoede@redhat.com>
80e48d0
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
80e48d0
---
80e48d0
 drivers/input/mouse/synaptics.c | 35 +++++++++++++++++++++++------------
80e48d0
 1 file changed, 23 insertions(+), 12 deletions(-)
80e48d0
80e48d0
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
80e48d0
index f2cceb6493a0..fc7e1db7530e 100644
80e48d0
--- a/drivers/input/mouse/synaptics.c
80e48d0
+++ b/drivers/input/mouse/synaptics.c
80e48d0
@@ -346,7 +346,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
80e48d0
 {
80e48d0
 	struct synaptics_data *priv = psmouse->private;
80e48d0
 	unsigned char resp[3];
80e48d0
-	int i;
80e48d0
 
80e48d0
 	if (SYN_ID_MAJOR(priv->identity) < 4)
80e48d0
 		return 0;
80e48d0
@@ -358,17 +357,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
80e48d0
 		}
80e48d0
 	}
80e48d0
 
80e48d0
-	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
80e48d0
-		if (psmouse_matches_pnp_id(psmouse,
80e48d0
-					   min_max_pnpid_table[i].pnp_ids)) {
80e48d0
-			priv->x_min = min_max_pnpid_table[i].x_min;
80e48d0
-			priv->x_max = min_max_pnpid_table[i].x_max;
80e48d0
-			priv->y_min = min_max_pnpid_table[i].y_min;
80e48d0
-			priv->y_max = min_max_pnpid_table[i].y_max;
80e48d0
-			return 0;
80e48d0
-		}
80e48d0
-	}
80e48d0
-
80e48d0
 	if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
80e48d0
 	    SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
80e48d0
 		if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
80e48d0
@@ -394,6 +382,27 @@ static int synaptics_resolution(struct psmouse *psmouse)
80e48d0
 	return 0;
80e48d0
 }
80e48d0
 
80e48d0
+/*
80e48d0
+ * Apply quirk(s) if the hardware matches
80e48d0
+ */
80e48d0
+
80e48d0
+static void synaptics_apply_quirks(struct psmouse *psmouse)
80e48d0
+{
80e48d0
+	struct synaptics_data *priv = psmouse->private;
80e48d0
+	int i;
80e48d0
+
80e48d0
+	for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
80e48d0
+		if (psmouse_matches_pnp_id(psmouse,
80e48d0
+					   min_max_pnpid_table[i].pnp_ids)) {
80e48d0
+			priv->x_min = min_max_pnpid_table[i].x_min;
80e48d0
+			priv->x_max = min_max_pnpid_table[i].x_max;
80e48d0
+			priv->y_min = min_max_pnpid_table[i].y_min;
80e48d0
+			priv->y_max = min_max_pnpid_table[i].y_max;
80e48d0
+			break;
80e48d0
+		}
80e48d0
+	}
80e48d0
+}
80e48d0
+
80e48d0
 static int synaptics_query_hardware(struct psmouse *psmouse)
80e48d0
 {
80e48d0
 	if (synaptics_identify(psmouse))
80e48d0
@@ -409,6 +418,8 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
80e48d0
 	if (synaptics_resolution(psmouse))
80e48d0
 		return -1;
80e48d0
 
80e48d0
+	synaptics_apply_quirks(psmouse);
80e48d0
+
80e48d0
 	return 0;
80e48d0
 }
80e48d0
 
80e48d0
-- 
80e48d0
2.1.0
80e48d0