Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752411AbdI0WTO (ORCPT ); Wed, 27 Sep 2017 18:19:14 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:57062 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752028AbdI0WTN (ORCPT ); Wed, 27 Sep 2017 18:19:13 -0400 X-Google-Smtp-Source: AOwi7QBICXsGyghdxhx+XWYc7JqnixfaTitMdudmxcor8CpQOgUPcRsS69cLMEhY7aXxIB7IQeoEmA== Date: Wed, 27 Sep 2017 15:19:09 -0700 From: Brian Norris To: Shawn Nematbakhsh Cc: linux-kernel@vger.kernel.org, lee.jones@linaro.org, jonathanh@nvidia.com, Benson Leung Subject: Re: [PATCH] mfd: cros ec: spi: Fix "in progress" error signaling Message-ID: <20170927221908.GA7699@google.com> References: <20170927213527.31416-1-shawnn@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170927213527.31416-1-shawnn@chromium.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1465 Lines: 29 On Wed, Sep 27, 2017 at 02:35:27PM -0700, Shawn Nematbakhsh wrote: > For host commands that take a long time to process, cros ec can return > early by signaling a EC_RES_IN_PROGRESS result. The host must then poll > status with EC_CMD_GET_COMMS_STATUS until completion of the command. > > None of the above applies when data link errors are encountered. When > errors such as EC_SPI_PAST_END are encountered during command > transmission, it usually means the command was not received by the EC. > Treating such errors as if they were 'EC_RES_IN_PROGRESS' results is > almost always the wrong decision, and can result in host commands > silently being lost. > > Reported-and-tested-by: Jon Hunter > Signed-off-by: Shawn Nematbakhsh > --- > drivers/mfd/cros_ec_spi.c | 52 ++++++++++++++++++++++------------------------- > 1 file changed, 24 insertions(+), 28 deletions(-) I'm still not sure I understand the full extent of the originally-reported error (it's still likely a SPI transport issue?), but I believe this patch is good anyway: Reviewed-by: Brian Norris I wonder if we should tone down the BUG_ON()'s in drivers/mfd/cros_ec* and drivers/platform/chrome/* too. That's basically a no-no these days, as all of these type of things should be able to gracefully propagate errors, no matter how "unlikely" it should be to see a crazy protocol version number or a bad message length.