Received: by 10.213.65.68 with SMTP id h4csp2158901imn; Sun, 8 Apr 2018 21:14:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx48gSNnYbJ2Dp0JGfKBLegzCSMkFcMg/mKb7EainQWE5i6PWwFaaQO8gNWLkS7BWRQLF5v7X X-Received: by 10.98.153.204 with SMTP id t73mr27952348pfk.121.1523247269232; Sun, 08 Apr 2018 21:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523247269; cv=none; d=google.com; s=arc-20160816; b=nCYskc5Dl4H9UwFj7Q4B/nP2Gy2/rtxLqRB5jPuMiHIgKH4kGNdTtPhs3NuuSaDc1f Pd8WimpMYz34IZoqw2UDyAMlr3kP6GH52meq/w3n5DW5hy0595BlG1TNdcAz/v48dE01 5wWY0PcmqZ++fBnLpeeAOWi0tYqb/8UKBk3jORTRRy6Z8/fQ8UjgqQJrsRXmBSJDNPbP TsWpPRz/2EoIWz9s+CnZ2qhC3d1Pi9uI5raEm+iyFLC2i52VYGJhRSda8IFRtuH7sZeK LibgOYlab3XBT61sJ8r67TCPkWh371GR9TxVfLDFR4y2NKsse34ZdPE9lzZymwi9KN4V Vdrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ov7i5M7KW4Po0Ci3WBv4x4o4ezVtx1SgIxXaQtz9zQw=; b=NHGjMrxCP2PEMkQ8oPV+GN5KcP2wDEJz2hyxKW88VJGapcx+jNUcCD6B6i4gEHr5A1 mWOmzhEfle4f4SZ8+RFg8B9v6vAvktXn3YNw8064Q2mtkN6Qy9DEWx4SeI2CwkoATes+ rMtKFmeQqevWGVOT1XG+FAtxjFLC5Jo9eJi9r17kajh88PAj9PP9pkQvQPY/9C+5UGqS PAd/65+0l7niMNkuS7XjY/Z7ODfFLC1DabSiJYVoOL/4RbAUpP/KnA4lyUBnDqpnCZUY 053jDxBnCfB/EJKO2OOeiB/mKLE3Us4fKSdH0E9zR/vZg5xgV2WbrNn0SWdYc7nWNpHz Do1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=k0eNBbK3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si10418628pgc.818.2018.04.08.21.13.52; Sun, 08 Apr 2018 21:14:29 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=k0eNBbK3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754287AbeDIEIg (ORCPT + 99 others); Mon, 9 Apr 2018 00:08:36 -0400 Received: from mail-co1nam03on0101.outbound.protection.outlook.com ([104.47.40.101]:48974 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753062AbeDIARI (ORCPT ); Sun, 8 Apr 2018 20:17:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ov7i5M7KW4Po0Ci3WBv4x4o4ezVtx1SgIxXaQtz9zQw=; b=k0eNBbK3BlVDnjS6wu78ouRUZd0K/v3owolTL+ieYQU31spzPbYzNVt4NidqLntz7z3z0n+horolAtKEmiF2UGIUSrmeYu9k1CjBjhYY6CWj5XHrlqS6IlbeLu5xjqJ2/P2EgAbSDme4l4C888OcFKl7gSsDQl9PLcmGWsuLlBI= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1127.namprd21.prod.outlook.com (52.132.132.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:17:03 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:17:03 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dmitry Torokhov , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 022/189] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Topic: [PATCH AUTOSEL for 4.15 022/189] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Index: AQHTz5gVVSFn6Oet/Uy8rTmzwT/49Q== Date: Mon, 9 Apr 2018 00:17:03 +0000 Message-ID: <20180409001637.162453-22-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1127;7:A0tl0+aXuHSEAYBCAAbloyZHkUdnxy0SQopdVg3YBc/lXufulM7L9ZvwYc50OTK0srMcDCSshi0rXE/TgsnoyUimwkwPXXF2OZJ/nmZceubJvtPAe/p76jeFHFSHP2Ndt31psEyRqJo3TOKd91f3fBysI0+IDtEKv8YX0PJtJqhQUtkAaUmLtO4YsCwte8LCc/wSBfDypJ4NtXGfbBm33sW+RboK10kIhdltYs8R+093PFNZ5SFttu9KabROWsZK;20:TihgRiFvLGTuWmq33wBLzoo/bhrQMuoJE+Tsn1/mYXP7HRy+Nbd0n9XUvg7QzF5mQaa5g9ao1XmEMpUVsHVq7zBo4ehcQv2Id/JmvYx/AzMtIe9zpZo+gNtChgLjrUN1h1eWmyVsCpYOkwMKHZQYuuc99EK8l+VWm9cUxXelNxo= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 2cac6dff-9bb2-470e-10c5-08d59daf3851 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1127; x-ms-traffictypediagnostic: DM5PR2101MB1127: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1127;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1127; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39380400002)(39860400002)(376002)(346002)(366004)(189003)(199004)(105586002)(186003)(66066001)(6486002)(54906003)(7736002)(26005)(575784001)(86362001)(316002)(305945005)(110136005)(478600001)(3280700002)(86612001)(10290500003)(25786009)(5250100002)(2616005)(99286004)(22452003)(5660300001)(3660700001)(2900100001)(81166006)(3846002)(2906002)(106356001)(6506007)(59450400001)(107886003)(486006)(39060400002)(8676002)(81156014)(14454004)(10090500001)(68736007)(4326008)(6116002)(1076002)(72206003)(102836004)(97736004)(11346002)(8936002)(476003)(2501003)(6436002)(6512007)(446003)(76176011)(36756003)(53936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1127;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XPuxTALreogYztTkqZSWKwqz1rXutaT0yvgpvMeENtYtrQWGAhwB0mfGoIM2Bg1iiL4YwhM0aovgQSIceoLwVzkkYqxOQoWLkNgxgaRSGnGlBTrrIQandxS/FYK4aIFxoar1ls17yDxeMoBJWsnQ5dsQl5Rr38rS1OVYeF2FArlbmk08/L6zvlhgOup3ABlJzon7TH3da7Pa9ondZWuQyt8kx2y6vPe9QNeum28CjR8RPGo4H3FDBCbgwlOxI3jOki370S8j2xZNQFei2A9vLvoPx9cTQ3WKSZiaCdiVQz8HlmaVbWewlpSeJe14KLgKc7t7PH7/EKSEEJmbdq7DQWpwzl80YGbi9F5mNSr0jxLk1AllV1fYvDAZQEbAHqBgWxZuc7Ng4iJ4CApE53SVTha43eg9R5ADuJ27Bq7e2Bk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cac6dff-9bb2-470e-10c5-08d59daf3851 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:03.0905 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 c= ode") Reported-by: Matteo Croce Tested-by: Matteo Croce Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/mouse/psmouse-base.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmou= se-base.c index 6a5649e52eed..8ac9e03c05b4 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psm= ouse) psmouse->pt_deactivate =3D NULL; } =20 +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 =3D=3D SERIO_PS_PSTHRU && + !allow_passthrough) { + return false; + } + + if (set_properties) + psmouse_apply_defaults(psmouse); + + return detect(psmouse, set_properties) =3D=3D 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 psmouse *psmo= use, if (!proto) return false; =20 - if (psmouse->ps2dev.serio->id.type =3D=3D SERIO_PS_PSTHRU && - !proto->try_passthru) { - return false; - } - - if (set_properties) - psmouse_apply_defaults(psmouse); - - if (proto->detect(psmouse, set_properties) !=3D 0) + if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, + set_properties)) return false; =20 if (set_properties && proto->init && init_allowed) { @@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse= , * 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) =3D=3D 0)) { @@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse= , * 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 =3D true; =20 if (max_proto > PSMOUSE_IMEX) { --=20 2.15.1