* [PATCH] Input: psmouse - clean up Cypress probe
@ 2015-12-03 23:56 Dmitry Torokhov
2015-12-04 7:16 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2015-12-03 23:56 UTC (permalink / raw)
To: linux-input, Hans de Goede; +Cc: linux-kernel
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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/mouse/psmouse-base.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index c2bd866..978ba0b 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -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;
}
--
2.6.0.rc2.230.g3dd15c0
--
Dmitry
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: psmouse - clean up Cypress probe
2015-12-03 23:56 [PATCH] Input: psmouse - clean up Cypress probe Dmitry Torokhov
@ 2015-12-04 7:16 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2015-12-04 7:16 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel
Hi,
On 04-12-15 00:56, Dmitry Torokhov wrote:
> 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.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks, looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/input/mouse/psmouse-base.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
> index c2bd866..978ba0b 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -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;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-04 7:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 23:56 [PATCH] Input: psmouse - clean up Cypress probe Dmitry Torokhov
2015-12-04 7:16 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.