Received: by 10.213.65.68 with SMTP id h4csp240932imn; Fri, 23 Mar 2018 03:42:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELtlz/2hT79f0W7P4NGCs/5IdczlEsKphQO9X7n6/aLDMrKllX7Z1pfGRqCoNc/YLJejdinB X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr29128501pla.150.1521801730437; Fri, 23 Mar 2018 03:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521801730; cv=none; d=google.com; s=arc-20160816; b=S/ivbwz9LCL7RnRl1LA0b1p7GSiP0PS/Mudq4wNKi2uNBJvRA6uoaLl17y1cpbhFUN +zRSpSChF2XlWilzktHqPbgnoV0tL6Ev+YEKfwWXzstynz0DpHpXoKebpYsFbZk7TSyB 9HlAxO2fXpEwjcWvR2w2EP5H/nt5NkUPBa2tIJ0jF2+SnRgDUrpB15B8H/gXXnR8UZKx 1kpfq7gEuNja9CKnDkpu5cqI7S+NvpyTHh4KvIIR07ndyXz/EKZqmASGAxY2KVvNi2su yE4c8SJJlGWlQGWJqeFJeGQl9S8XMHD34K0cazs4KmJsCJT1JUlkHCDHPdUY851mRzEJ YZnw== 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=ejGYLbkaR4FJk4Piy32I4pGbPohNdyyD53xXAFvAf8U=; b=Ro9cAdBWWs7rog8rAfm8B/zAGVAIgyMT/9/GOx8/x38FmfbVgmSQBMoZFIqXMHDWDU Ns3GKtKSz+puZHKL82Re1z3nhnogjmc4ufvuqioFEFL5JLLuAp8CxMvy5AkdzRiVm2QU vkVFZBeqlpYTeHCX/6lMybob2IV7Bm7BRQgIV3J0PYBDK7UvGcjBo3FI2PmaKZAEabva BsVIjtX3soU9m8g9XLL6IcR3GkKkcwN2nDVWntn1ny66pbZnxG9HMHHPGbYKgSRnqFZ5 TQ+nZFhhIV5OxVya7Xs/SyB/cy9YNQHRagodoFaaQS2KC8ZQr7vsQ9tidFY3TWroYgX2 WYYA== 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 bi10-v6si8042229plb.105.2018.03.23.03.41.56; Fri, 23 Mar 2018 03:42:10 -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 S1756393AbeCWKlI (ORCPT + 99 others); Fri, 23 Mar 2018 06:41:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46712 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933650AbeCWKQc (ORCPT ); Fri, 23 Mar 2018 06:16:32 -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 B9E66C7B; Fri, 23 Mar 2018 10:16:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shawn Nematbakhsh , Brian Norris , Javier Martinez Canillas , Benson Leung , Sasha Levin Subject: [PATCH 4.4 81/97] platform/chrome: Use proper protocol transfer function Date: Fri, 23 Mar 2018 10:55:08 +0100 Message-Id: <20180323094202.082457097@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_proto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -59,12 +59,14 @@ static int send_command(struct cros_ec_d struct cros_ec_command *msg) { int ret; + int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); if (ec_dev->proto_version > 2) - ret = ec_dev->pkt_xfer(ec_dev, msg); + xfer_fxn = ec_dev->pkt_xfer; else - ret = ec_dev->cmd_xfer(ec_dev, msg); + xfer_fxn = ec_dev->cmd_xfer; + ret = (*xfer_fxn)(ec_dev, msg); if (msg->result == EC_RES_IN_PROGRESS) { int i; struct cros_ec_command *status_msg; @@ -87,7 +89,7 @@ static int send_command(struct cros_ec_d for (i = 0; i < EC_COMMAND_RETRIES; i++) { usleep_range(10000, 11000); - ret = ec_dev->cmd_xfer(ec_dev, status_msg); + ret = (*xfer_fxn)(ec_dev, status_msg); if (ret < 0) break;