From patchwork Thu Dec 3 23:56:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 7764281 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D1B06BEEE1 for ; Thu, 3 Dec 2015 23:56:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F19B3205B4 for ; Thu, 3 Dec 2015 23:56:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CF6720465 for ; Thu, 3 Dec 2015 23:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751141AbbLCX4x (ORCPT ); Thu, 3 Dec 2015 18:56:53 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36826 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbbLCX4w (ORCPT ); Thu, 3 Dec 2015 18:56:52 -0500 Received: by pacdm15 with SMTP id dm15so76824618pac.3; Thu, 03 Dec 2015 15:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=EVk1J2eCvYKBdghIhCcCNiR+rBvz9A4Q5obvwEGhdQ0=; b=gmzzcj3frSzWI+uKaupb4ODnp64C8qUn1BUG0yqGIyFjs7xIhORrjHqEys+66VPL8I UM93I6MLO2XnDLnTREINi2hcrVLCikKTcH0MPo/lS60mk/hwWVbqAbMM+A7P9NwmwKfA ZPaS+3dzZTa7A4J5qnZTOSz0yZuCxVl6CBhx0+QWWRkJh5A7vsBh6hzibK+rUQ3ao/1B EBTKFugrdJoEizInun2TjJADQeIh7eE55kf78RiGeUuq942TRQtxIu5V20eVQ7pWgba6 W9Pnw3skfPGYUo1WRkRRHdEXEW3qjKrHPic1MKz1W8d6LFt6wE0r4OnYxIWY05wHSMtQ nScg== X-Received: by 10.66.159.38 with SMTP id wz6mr17476103pab.12.1449187011673; Thu, 03 Dec 2015 15:56:51 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:553b:71be:6d59:8900]) by smtp.gmail.com with ESMTPSA id 24sm12893345pfm.75.2015.12.03.15.56.50 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 03 Dec 2015 15:56:50 -0800 (PST) Date: Thu, 3 Dec 2015 15:56:48 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org, Hans de Goede Cc: linux-kernel@vger.kernel.org Subject: [PATCH] Input: psmouse - clean up Cypress probe Message-ID: <20151203235648.GA29409@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Hans de Goede --- 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; }