Received: by 10.223.185.116 with SMTP id b49csp5964320wrg; Wed, 7 Mar 2018 22:47:39 -0800 (PST) X-Google-Smtp-Source: AG47ELuApXAI42YtaxWJAHk48+qUhiYHczxBkbXpWL0fd61XBaUjsRZM8zDPsfRQLLXmi9suYU9C X-Received: by 2002:a17:902:6bc2:: with SMTP id m2-v6mr22207531plt.432.1520491659336; Wed, 07 Mar 2018 22:47:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491659; cv=none; d=google.com; s=arc-20160816; b=STjLiBLdCISI8upXGen132xz+w7ZCy/9sr7WCBXskpIDiuIo4Y+6/0WrW/wsBYnKIM IQuvIm6zpxUuR7MC3wPVKWneD7PFDSXUoZbeNl/X9VLsYdQD+2XfvhE5Ikdf2QEuli86 4Hgbi63Rpcb3xE83cq1cw8lQg8T+Cv/QjBQ4zSpt/jlaLdjNbi6gyCksdvc209qgYYJn VKi8w6aZlwEuIjsXVTEcJe0PHHZxOWKaMlKnuK+/CmkWKI9kPtwPqTYOC/zR6eK4PmOj ATpMKdmNFn0MtKLeo0CMv/b8/HgiNLr179nopxcXnWqg/rNMN9dZYe1DshynEx0TjEz8 liOA== 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=2KxfKlZebUKZlqETGMyqlEjLWxucAFjWLTsPobu9dl8=; b=OBBvMIz/xzkRM3k//38/B9A4+2Ts20WBN+soAup5LmwhBUYM1ootHlmhQ67q7wSw5N YTUvOi6QIMJDMQPEIlxDbv3IT5qgMW/b1/5F7iJHoNkYCC27QuQ3gAZk1qchcXNT22Yk b1BsKOrJ9tCmG1CjeGIyySXFSNu+rueDCNPfnson7pqNE5p3+TCA4bnxO525TrJORlGN CBS7kAul1Yu+B7AkdC6vywPC/e5WXC1ptGswjQc4cBwsxCTS1gnTaVcSVJc7TPaZR4C4 9YtMAjAJc150/nyvUVLAC78RJlTRaU0QJk06CZSS7F58vvhmfPFcjBur5Myk/xV8wY5b OV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=eUsW2qaz; 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 x1si12520627pgp.89.2018.03.07.22.47.25; Wed, 07 Mar 2018 22:47:39 -0800 (PST) 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=eUsW2qaz; 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 S965196AbeCHGqg (ORCPT + 99 others); Thu, 8 Mar 2018 01:46:36 -0500 Received: from mail-by2nam03on0101.outbound.protection.outlook.com ([104.47.42.101]:17968 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965118AbeCHE6X (ORCPT ); Wed, 7 Mar 2018 23:58:23 -0500 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=2KxfKlZebUKZlqETGMyqlEjLWxucAFjWLTsPobu9dl8=; b=eUsW2qazlhlqnqUmFzfsUtPN5LD52t2OTD4djWQk78YbrxnCPvzRI17YAgC0f88r8bJn6YR4E5WvTaGoLSZVsRmM1npCHx3XfD2dyfSqba1P6ngh9q3eU5XIAG9cVRP5trHVa64SYxI3dvEv4fSbey0AxE5oAYPPpF1oKFQhA1M= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0808.namprd21.prod.outlook.com (10.167.110.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Thu, 8 Mar 2018 04:58:16 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:58:16 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Shawn Nematbakhsh , Brian Norris , Benson Leung , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 25/67] platform/chrome: Use proper protocol transfer function Thread-Topic: [PATCH AUTOSEL for 4.14 25/67] platform/chrome: Use proper protocol transfer function Thread-Index: AQHTtpn9439yy/X5bECspoKYD4+EAw== Date: Thu, 8 Mar 2018 04:57:42 +0000 Message-ID: <20180308045641.7814-25-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-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;DM5PR2101MB0808;20:qamQXtzwnBgMaJeGf8nv+2G1QxYsydHbu78GqoiC7OQgZAoDNzI7MhjpzY77gdmCVqxsV/yZp6jZ+roIkIkqd+p/4z+vsMtkGSbEKz0PPtqa+nvgEBiA8RNZ0LDw2+C1qR9NhC4bctssVbuwpMawOADuJBzzIjEwmVST752q6HE= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a50a3402-1ceb-4ce5-ff96-08d584b1340e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0808; x-ms-traffictypediagnostic: DM5PR2101MB0808: 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)(7411616537696); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0808;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0808; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(22452003)(99286004)(76176011)(2906002)(105586002)(3846002)(86612001)(478600001)(72206003)(14454004)(2900100001)(8676002)(102836004)(68736007)(5660300001)(316002)(6116002)(54906003)(26005)(6506007)(575784001)(1076002)(86362001)(36756003)(186003)(10090500001)(110136005)(106356001)(4326008)(6512007)(6486002)(7736002)(5250100002)(3280700002)(3660700001)(2501003)(6666003)(81166006)(2950100002)(305945005)(53936002)(107886003)(8936002)(6436002)(81156014)(66066001)(25786009)(10290500003)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0808;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: WyBFqcaFqZ5aenEHOuCx5FxT76IeLzhXj0KG/+7xSKmcmb5+7PRDhA3Rcr5kVuchNK++UHyRhz/YcQ7VutngHlVcQp/EwpdkATOco2Ief9t+TSazVtojVx3tqZBi7K8sKez8x9IybQH1jSBNXqDyu2PlTal27WvtZKQmH0boy1vg4oudlGngwbpt9OoEEzrHlMF4I4Vh5gd16jkeVo9vFjT1ElsBuFJFfDRSEAyIg58wdajIdIICfe3IaU4NA2bEIq8fjADXNIFp7PWarN7yUwEfz8XgM9bJaTr2R4zmfwssLNnwxfj2rxyQC/qw9u4mzLq1XyoRV+fdFY7lJz6SLw== 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: a50a3402-1ceb-4ce5-ff96-08d584b1340e X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:42.3984 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0808 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shawn Nematbakhsh [ Upstream commit d48b8c58c57f6edbe2965f0a5f62c5cf9593ca96 ] pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had one instance of these functions correct, but not the second, fall-back case. We use the fall-back only when the first command returns an IN_PROGRESS status, which is only used on some EC firmwares where we don't want to constantly poll the bus, but instead back off and sleep/retry for a little while. Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton") Signed-off-by: Shawn Nematbakhsh Signed-off-by: Brian Norris Reviewed-by: Javier Martinez Canillas Signed-off-by: Benson Leung Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_proto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chr= ome/cros_ec_proto.c index 8dfa7fcb1248..e7bbdf947bbc 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev, struct cros_ec_command *msg) { int ret; + int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); =20 if (ec_dev->proto_version > 2) - ret =3D ec_dev->pkt_xfer(ec_dev, msg); + xfer_fxn =3D ec_dev->pkt_xfer; else - ret =3D ec_dev->cmd_xfer(ec_dev, msg); + xfer_fxn =3D ec_dev->cmd_xfer; =20 + ret =3D (*xfer_fxn)(ec_dev, msg); if (msg->result =3D=3D EC_RES_IN_PROGRESS) { int i; struct cros_ec_command *status_msg; @@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev, for (i =3D 0; i < EC_COMMAND_RETRIES; i++) { usleep_range(10000, 11000); =20 - ret =3D ec_dev->cmd_xfer(ec_dev, status_msg); + ret =3D (*xfer_fxn)(ec_dev, status_msg); if (ret < 0) break; =20 --=20 2.14.1