Received: by 10.213.65.68 with SMTP id h4csp2114139imn; Sun, 8 Apr 2018 20:04:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Reolbf5qsVG35c0ZI7AKFLxE3m8SdR+zNGs8CTHpm8LJTgjJSqdosl8f4QBNyFRHom74I X-Received: by 2002:a17:902:444:: with SMTP id 62-v6mr37779089ple.127.1523243059704; Sun, 08 Apr 2018 20:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243059; cv=none; d=google.com; s=arc-20160816; b=Dli47WTgFZk9IXr+aEDR4/gnxDsVaGEgb+lhK5TP+tpA2aCebp75/uNuM23O1/h/kq iUUvjH7T8vRxjbc1AgJ9v+MhQj9D363DssJi9MSVxbo/zzhifWEmD5eoxbfw6s2vTZgZ ugTld1PCvlIq4T+uQmsu/XzUlk0TfCgKXqZh0zVjnXxIxIjeKjhFhKo4pG8Xa9EnSQkM +lXqbYspa3EKcLHkAmv+L06SHeTSd/yu36hYvlYzpuVwOsDKJLPybbSGlfUNaPzruEkW NWCfx4lllDB6Sfal5PFy1oLPyt+rVFBkWEmem6n9S+HDloG5KqPqMPKd8WxYLaA0GcK/ pkpw== 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=kgC9c5RX2/JGT9GMqAVb6hnpjWzsykCdhxXnzHM3DOs=; b=YjRkvamwSEizh2tr6Zfva3SFCvBJ3Q5TrbLnri8lCetzmEcYspQ+COMksJrwB//Byd 1QjrwR2WRdNbxjgLzYR9jHkdXdUeMhRpIiw5qIezgeOF1L5BWhW8NPwxcAwbOdj4XWUV UHYgQWGvcEaGlmmEtwgW2hvJhBWz18SOogI47b1CrOXlAH+XAIiRsT8uRs89QevG85+N DeFw1MHKnAxGSseU+0dxd0spEEEBbUc+vdIAzr01ASJC757EFxi9H8dZ8Zx//hqv4ayx BL7A3JD+Wrg4hqeNNCrMDiYdJYWDxEhrlwz1ZmaArSrIKEi+mRFedbgqihAVHY2HRyhf 2QgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=nOImUMh8; 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 e63-v6si13724120plb.91.2018.04.08.20.03.42; Sun, 08 Apr 2018 20:04:19 -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=nOImUMh8; 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 S932182AbeDIAc6 (ORCPT + 99 others); Sun, 8 Apr 2018 20:32:58 -0400 Received: from mail-by2nam01on0100.outbound.protection.outlook.com ([104.47.34.100]:61248 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932160AbeDIAcy (ORCPT ); Sun, 8 Apr 2018 20:32:54 -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=kgC9c5RX2/JGT9GMqAVb6hnpjWzsykCdhxXnzHM3DOs=; b=nOImUMh8WpKWKF/LX+pv/chfuQ1T3fxjqwdoGgr5LwtR/DAYGuuwt5MoTdRPcibVjZqMWChvOTFagzdmPApPUwfk4Y1K3EY+8GfDlsLx9IocJo+OT7zXvViw6cqDwa3NXPGoId/fmM67fj71zbr/RsLQ+bBwaNXDmAHqLotobfg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.0; Mon, 9 Apr 2018 00:32:51 +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:32:51 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dmitry Torokhov , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 219/293] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Topic: [PATCH AUTOSEL for 4.9 219/293] Input: psmouse - fix Synaptics detection when protocol is disabled Thread-Index: AQHTz5lMMi/2AmdbsUG41q6YFQs5AQ== Date: Mon, 9 Apr 2018 00:25:45 +0000 Message-ID: <20180409002239.163177-219-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0998;7:RAlG2Ump7bYemDbzjJRQmUl852vtWFN7hVIV+9nAeL7NDBWmnZHossu++iBuDGcL7mp5WkH3bJX5EweGZtyEp2ldtqVjcTcgIEx7gD7H00FCT9rYfeXJKnd9UdXErb+FRJwb1lMG5DznB5ry2Yi4LsI3Mvi4iIhtIUb7RGTh0xRd5p2qhMnHqr/PdZOZfaihOilu69bClIXc8s4S5OIrqvx+COmy+OXHVI+pGXaccPfk6DlkC+lnnbABPFMzVDCy;20:FnYBYbWJEgwIVL0yMHJbKz0ukaTvnQMmEJ4sJAF1btQDGuQTbB2nBPB4TGF6ENcWrLFXa5oQVSUBc25HOjPSmvE6j23ebXMqzn3KNxbEj3mF0LGKGKFv7iKUgF9HgOcIdL3pBO7YLVr9FU06U4zyWrcRoZEB62VLxiYlEsDnVDM= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 2538aad6-41a7-458d-1f12-08d59db16d54 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: 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:DM5PR2101MB0998;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0998; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(376002)(396003)(366004)(39860400002)(189003)(199004)(25786009)(59450400001)(105586002)(14454004)(76176011)(68736007)(2906002)(316002)(97736004)(8676002)(39060400002)(86612001)(3660700001)(3280700002)(102836004)(6116002)(4326008)(8936002)(36756003)(22452003)(81166006)(81156014)(54906003)(6506007)(10090500001)(2501003)(6512007)(186003)(6666003)(3846002)(486006)(5660300001)(26005)(7736002)(5250100002)(305945005)(99286004)(2900100001)(110136005)(1076002)(6436002)(53936002)(106356001)(575784001)(107886003)(72206003)(86362001)(476003)(446003)(66066001)(11346002)(478600001)(10290500003)(2616005)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0998;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: urgBb7znhTGbzXD0zLC4Jvu1RT01DDmGrYKSrqKXB+OXFoeah7JGbhFws4Hj32RH8EPzltl50o2xUCZgEUvRY4fqkHz15+hUMj7oVipTXMEcss/tQE4BCmvaNjh5zgdzhLQXotFWKc0B928mlGeUNEPMO+0xTUuFEg+UsAt0e4KeMOHZKqumuXz+SRKOB5kf6jKB18hC0frUfpiJLG6IQVcmOEcfHRsMXSE8+W6yu9ZOpM6FggiBP98mqmsmyY4WHM8DP1HuHd3QfNWzEvJ3kfHfdtGReK3HKQBzlP53IA4qdMeNEjsZX070p3V9wdxfTf0Ou29J4xsBzT/OtX0lrIX0Oo1H5Xx8M+KrOylNl7gVqscz4Wzbalc6aSfjNRZPah4gJve6Fc43nO51zbbRzsW/Drn0Cvkhiatbf0SKDgw= 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: 2538aad6-41a7-458d-1f12-08d59db16d54 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:45.3160 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 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 bee267424972..5cbf17aa8443 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -937,6 +937,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, @@ -948,15 +963,8 @@ static bool psmouse_try_protocol(struct psmouse *psmou= se, 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) { @@ -988,8 +996,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)) { @@ -1035,8 +1043,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