Received: by 10.192.165.148 with SMTP id m20csp565148imm; Wed, 25 Apr 2018 04:21:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49m6umxyK0+DNxuGscbv2+I/yzbu2C1Gh9CP1Dgq9ompN4vSfi+T3taG+MKdFaFH4rG9Lkw X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr28741931plv.52.1524655300707; Wed, 25 Apr 2018 04:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524655300; cv=none; d=google.com; s=arc-20160816; b=RBu30NqZbUUyxiyeQ24naGMe6t2RMDDGJPs5X2xZKyJD2j4mbGIFpPKeuKa3v2CeQp fbt+EwcPk3ulDjqf4ie5reEKdIOh7bJGJ9DAWNedSoEoSoQn4HKoqz5PYWz4N60m+mzp 6J47ntWKPaPgh5wEwwkG+9AgtqU5BtB3AgGtbffQ/yL+J9BlIFCOZWd4Sv/ppLLXYhZZ y5fJI7HRjOkL5mowKp57qQjYvTejLCL3Tc1htmyetQ9dWu0WA5ems90RIl4TdqbCaxez Jnc+E3jtJwH3vMx6iAMCLx2miGhb+e3v7jXOy0mw3G4Xh8RwYzqrYqHBL9aNjH9rue/E bpNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+yNKivOylB1rTU2y3P6cyKwrAij68d4d4ZmZz6NPBpo=; b=UpzCrsfJrHWKcQaMpHR4Kqg/EjTKSaqL5pYLsxmLGbLjL578mlqoSopOvKV2NHooKF 9NowdiffB/S8B0X584u5T9D78j0vcEjSI94FXDP6VIlK44nhASomMXcdfa1R94dI84kR zzql9Ijwl89d6LTFspL+oXKgdtj1jYhJrCkWQtIFj97fUyFU+/iCHS6Hu637pjVmnDYY OVCu222wLvu/bYT3/5LU9tl2P1sxOduYVbtiy/mY2x2nFDslYmJLltWsL3UbhAk8+skj 5JhPkQ1V5C+bUDEkyq6v3luFkpt8ozBGqCB8OWRMbpiWeDFx1unzwhKW6T7jLRRWNaaH lLXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11si9489769pgf.542.2018.04.25.04.21.26; Wed, 25 Apr 2018 04:21:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753716AbeDYKjz (ORCPT + 99 others); Wed, 25 Apr 2018 06:39:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51952 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752953AbeDYKjs (ORCPT ); Wed, 25 Apr 2018 06:39:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7DBE7272; Wed, 25 Apr 2018 10:39:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matteo Croce , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 032/183] Input: psmouse - fix Synaptics detection when protocol is disabled Date: Wed, 25 Apr 2018 12:34:12 +0200 Message-Id: <20180425103243.875543069@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit 2bc4298f59d2f15175bb568e2d356b5912d0cdd9 ] When Synaptics protocol is disabled, we still need to try and detect the hardware, so we can switch to SMBus device if SMbus is detected, or we know that it is Synaptics device and reset it properly for the bare PS/2 protocol. Fixes: c378b5119eb0 ("Input: psmouse - factor out common protocol probing code") Reported-by: Matteo Croce Tested-by: Matteo Croce Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/psmouse-base.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struc psmouse->pt_deactivate = NULL; } +static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), + struct psmouse *psmouse, bool allow_passthrough, + bool set_properties) +{ + if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && + !allow_passthrough) { + return false; + } + + if (set_properties) + psmouse_apply_defaults(psmouse); + + return detect(psmouse, set_properties) == 0; +} + static bool psmouse_try_protocol(struct psmouse *psmouse, enum psmouse_type type, unsigned int *max_proto, @@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct if (!proto) return false; - if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && - !proto->try_passthru) { - return false; - } - - if (set_properties) - psmouse_apply_defaults(psmouse); - - if (proto->detect(psmouse, set_properties) != 0) + if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, + set_properties)) return false; if (set_properties && proto->init && init_allowed) { @@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psm * Always check for focaltech, this is safe as it uses pnp-id * matching. */ - if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, - &max_proto, set_properties, false)) { + if (psmouse_do_detect(focaltech_detect, + psmouse, false, set_properties)) { if (max_proto > PSMOUSE_IMEX && IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && (!set_properties || focaltech_init(psmouse) == 0)) { @@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psm * probing for IntelliMouse. */ if (max_proto > PSMOUSE_PS2 && - psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, - set_properties, false)) { + psmouse_do_detect(synaptics_detect, + psmouse, false, set_properties)) { synaptics_hardware = true; if (max_proto > PSMOUSE_IMEX) {