Skip to contentSkip to conversation

Input: psmouse - clean up Cypress probe

PATCH In review Dmitry Torokhov 2 participants 2 messages Dec 3, 2015 – Dec 4, 2015

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: psmouse - clean up Cypress probe

When Cypress protocol support is disabled cypress_init() is a stub that always returns -ENOSYS, so there is not point in testing for CONFIG_MOUSE_PS2_CYPRESS after we decided that we are dealing with a Cypress device. Also, we should only be calling cypress_detect() when set_properties argument is "true", like with other protocols.

There is a slight change in behavior to make follow-up patches more
uniform: when we detect Cypress but its initialization fails, instead of immediately returning PSMOUSE_PS2 protocol we now continue trying IntelliMouse [Explorer]. Given that Cypress devices only have issue with Sentelic probes probing Imtellimouse should be safe.

---
 drivers/input/mouse/psmouse-base.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/input/mouse/psmouse-base.c +8 -12
index c2bd866..978ba0b 100644
@@ -836,19 +836,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
 	 * Trackpads.
 	 */
 	if (max_proto > PSMOUSE_IMEX &&
-			cypress_detect(psmouse, set_properties) == 0) {
-		if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
-			if (cypress_init(psmouse) == 0)
-				return PSMOUSE_CYPRESS;
-
-			/*
-			 * Finger Sensing Pad probe upsets some modules of
-			 * Cypress Trackpad, must avoid Finger Sensing Pad
-			 * probe if Cypress Trackpad device detected.
-			 */
-			return PSMOUSE_PS2;
-		}
+	    psmouse_do_detect(cypress_detect, psmouse, set_properties) == 0) {
+		if (!set_properties || cypress_init(psmouse) == 0)
+			return PSMOUSE_CYPRESS;
 
+		/*
+		 * Finger Sensing Pad probe upsets some modules of
+		 * Cypress Trackpad, must avoid Finger Sensing Pad
+		 * probe if Cypress Trackpad device detected.
+		 */
 		max_proto = PSMOUSE_IMEX;
 	}
 
Signature · 5 lines
2.6.0.rc2.230.g3dd15c0


-- 
Dmitry
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Dmitry Torokhov

When Cypress protocol support is disabled cypress_init() is a stub that always returns -ENOSYS, so there is not point in testing for CONFIG_MOUSE_PS2_CYPRESS after we decided that we are dealing with a Cypress device. Also, we should only be calling cypress_detect() when set_properties argument is "true", like with other protocols.

Quoted 7 lines

There is a slight change in behavior to make follow-up patches more
uniform: when we detect Cypress but its initialization fails, instead of immediately returning PSMOUSE_PS2 protocol we now continue trying IntelliMouse [Explorer]. Given that Cypress devices only have issue with Sentelic probes probing Imtellimouse should be safe.

Thanks, looks good to me:

Regards,

Hans

Quoted 37 lines
---
  drivers/input/mouse/psmouse-base.c | 20 ++++++++------------
  1 file changed, 8 insertions(+), 12 deletions(-)
drivers/input/mouse/psmouse-base.c +8 -12
index c2bd866..978ba0b 100644
@@ -836,19 +836,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
  	 * Trackpads.
  	 */
  	if (max_proto > PSMOUSE_IMEX &&
-			cypress_detect(psmouse, set_properties) == 0) {
-		if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
-			if (cypress_init(psmouse) == 0)
-				return PSMOUSE_CYPRESS;
-
-			/*
-			 * Finger Sensing Pad probe upsets some modules of
-			 * Cypress Trackpad, must avoid Finger Sensing Pad
-			 * probe if Cypress Trackpad device detected.
-			 */
-			return PSMOUSE_PS2;
-		}
+	    psmouse_do_detect(cypress_detect, psmouse, set_properties) == 0) {
+		if (!set_properties || cypress_init(psmouse) == 0)
+			return PSMOUSE_CYPRESS;
 
+		/*
+		 * Finger Sensing Pad probe upsets some modules of
+		 * Cypress Trackpad, must avoid Finger Sensing Pad
+		 * probe if Cypress Trackpad device detected.
+		 */
  		max_proto = PSMOUSE_IMEX;
  	}