Received: by 10.213.65.68 with SMTP id h4csp2132988imn; Sun, 8 Apr 2018 20:32:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49PcGnsv6+9mGhHJOsuHLYO4GzdvtonyDUOUvJbGNdfXbO5215/c2Mi0jhCXMJQXNr6kCSI X-Received: by 10.99.4.214 with SMTP id 205mr23589686pge.375.1523244746750; Sun, 08 Apr 2018 20:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523244746; cv=none; d=google.com; s=arc-20160816; b=M+TIgXQPv56CCDetAMx+EcN4QtwsLt/RFV1AUCvkK/jL3HHN0eKX5nq/ITFn6C0YXc QbkxSVxC2Y3gpJb7gT/EMeatiyyctm4Djs8PlUte4AHhDMIVTp3lOrrS11U7ltODhUGu hs6VCJuOhGnYSm/pjip0hIU4/qLwc16t/Zlqee0dwEd95WjL+khupTLisx9lUlWCWNQR r3s3syIpY8E9zJKp3mz7UhiKMhNjVp/ybBXbanDhJ/WK0mjJPXW9UZZohusQr9DIoksA IlmjOW1OhlwZ82/SZxEiU4iPoppAfTkO6J2ZfanAmnjWqP0BdWh9GQXBMWwiw/XvaMqP Mwew== 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=OqrwjmlJrwdhcRI+H8DZ6yoi0wdwPL50tK4W4u9a8qID+YxkaSe6IsVGS2eJJgmojL VUhjQSATZ6ksF27amNPpDaZ+YLHI44nEPwtfMPq7tGk/LHt8vScIZBEzNf/80rRYBHLz 1jFxC8OL5x/hj0J0g2EuMHwSa0wTx8j0zZYfLAK2AfuUzrJMxfrcrCRBNKQuLYPT/0/F VizPdAjGPcBfY4e9RmN8CZpAc+LkBKQYY0rmnk8wB2FMCV01oGjfPWMz3yb8voj5nzac E286aRFNOQvhpVhw3GY3xzQWZ2I2rmAR+ouuh0OxpCbJZN/vYKVxJ+wbABM/5/DZt6ow yB1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=CBGRq5/D; 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 60-v6si15399024plb.679.2018.04.08.20.31.49; Sun, 08 Apr 2018 20:32:26 -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=CBGRq5/D; 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 S1752454AbeDID1A (ORCPT + 99 others); Sun, 8 Apr 2018 23:27:00 -0400 Received: from mail-sn1nam01on0118.outbound.protection.outlook.com ([104.47.32.118]:31261 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754625AbeDIAWI (ORCPT ); Sun, 8 Apr 2018 20:22: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=CBGRq5/DEhaKcoCmSEyIKylK+m6dB1faL71dZ3bVhaSf82fzj2c04nF8fW0Y/lcMepynCDZd6EJWo9OzRFMy5W+mpPmuBbmheWt1rIoSLMCrOP/VFwIiWeB685BLB4sXy4BJ60+03X4/UozT37owjtakAWxnHlez1gu1QOIWC9E= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0966.namprd21.prod.outlook.com (52.132.133.24) 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:22:06 +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:22:05 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dmitry Torokhov , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 018/161] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Topic: [PATCH AUTOSEL for 4.14 018/161] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Index: AQHTz5h8P0MbVBwJQkCmiUz/qb/6sg== Date: Mon, 9 Apr 2018 00:19:56 +0000 Message-ID: <20180409001936.162706-18-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-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;DM5PR2101MB0966;7:DTjhbC6EmoFWqeVBmjpwB22VrzFWYTHkBmWu8lYFe12v+2TaqhnyjMwVnY9luNXlJWWy4phAOPTvAYzoD6uUNe9iqA3P2pHoIuQrghWUjxD00KRQvhpPS52NbaNWCT8jg1aT4l6TmWGnyC+H68wWRHQPKNOh/cPJWG2SFu6sWdMPPcZUnw4648k5S3raKINhKg+ec2IzZ1qZ6fLwa6GyQT0KIOTItO8CQ1u/kKhu0nqRgbYuplSsqWV5VfRCxBBD;20:/lmlPcGGi2WWkahWjlfeCLPzTAWYxSuKoD+p5uhqSxLITIC4qEU6h7X7OIaJAVE1+LoCwYR39aeMIauxaQbMC48B/JAez3UADUKM/mZpFKN6E5BUEV+A9PKeMjx60omDwx/bb5zgudxNeY4EyzAqVp8vxW5K7mY9pTWo6eKBIIs= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 49e7f1e9-0efd-4a33-38a9-08d59dafecc1 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0966; x-ms-traffictypediagnostic: DM5PR2101MB0966: 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)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0966;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0966; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(39860400002)(39380400002)(396003)(366004)(199004)(189003)(6512007)(316002)(59450400001)(6436002)(186003)(6666003)(2900100001)(8936002)(486006)(6486002)(6506007)(10290500003)(81166006)(22452003)(25786009)(1076002)(81156014)(53936002)(106356001)(10090500001)(5250100002)(39060400002)(107886003)(102836004)(76176011)(8676002)(66066001)(2501003)(446003)(476003)(36756003)(99286004)(575784001)(478600001)(86362001)(72206003)(2616005)(68736007)(5660300001)(305945005)(3846002)(6116002)(26005)(86612001)(14454004)(97736004)(3660700001)(4326008)(2906002)(110136005)(54906003)(3280700002)(105586002)(7736002)(11346002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0966;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: iAUhXUFhotouPcNvgeTlMGT3yvQUXC/1d3inKS2pAUsZ+2F2qCMwa6PQi3OuLBx98FoHzr4X7dFuuCYvcMINIAb0+4HzTcIYcjfMsQjfALqolun1y0UfY3S+UK4hxgNi3U8oiwI3qYYvBwo4LPs1sDtJ/fbL5q58epJ2uVZytR48NJNqc2WMKT3mMcbxsjsgzEz0nC0O2WyVty43m3AKscmsmw864bDzst9N3/ys/J+XjLacGNHhM0VaanNIjFAwP9cvfwqDEj0BoXBkunYr2H8ugByxGggxlKnsBzVKBI3KTwR76ktbxiQINhqZRYA+hfeyYPp8wPgS6ag3b3LZSQDhwazYLVcBjyLXWKvhQ84nhPD/VmV6QkmIk9jKs8fB7XNVzee3fxTzxt+/L+OSfg0dGe3w8jBK6NqopaigokA= 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: 49e7f1e9-0efd-4a33-38a9-08d59dafecc1 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:19:56.0668 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0966 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