From patchwork Thu Mar 29 18:59:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Suloev X-Patchwork-Id: 10316065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 105A76037E for ; Thu, 29 Mar 2018 18:59:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06B902A16D for ; Thu, 29 Mar 2018 18:59:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF12E2A3E6; Thu, 29 Mar 2018 18:59:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F6B62A357 for ; Thu, 29 Mar 2018 18:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qFLBs3LhUHoC6ySRnPLg+OALgkuvLCxNZmYDQXg4/cM=; b=E1tb7Xxn4pYdrzZfg1cZ7mFaDO u972ojWLs0ufz9fA5kIKlNfr7/euE1D6CQk6lN11SGdzwLc41uXJnt5MFKhaZ/FoR7yee0kqzN23e 2Qgb/Hbb+2bmbdR+JQTSfa3BjQpBOsNn2+P0EoqI17FbQuWBT8pNov8mGxgXmrm5kT1RHUtuajxvV xERdjDLpU04MaPCzAY1/wPjwsYCFqcAkhsYK4PiEV2hgknqR3f8yUn3OKBvKSUBLN3jiWJaMzl3vh VuJiBU5o0Y30LerK+K4DCTpP3Bv2Zl4Bl5fIC4e6O0lVbIxi8Kr/D7pYasY6i1uSs7R1ijrSNJwIc WuSqQA7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1clt-0006UX-Hv; Thu, 29 Mar 2018 18:59:37 +0000 Received: from smtp60.i.mail.ru ([217.69.128.40]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1clo-0006S6-15 for linux-arm-kernel@lists.infradead.org; Thu, 29 Mar 2018 18:59:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=orpaltech.com; s=mailru; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=rYgrFchEeott97N1b2w/sRT0dJKPvG0d5l3HmUZDmp0=; b=eM/JzneeN7wlc7CSpA6abQR4XEKHtJ1fV08N0fv50CkrxSrYy/a8FTG75dnOkK6o7xX8tN2CkikxUted/MR0FvrfLCkgNZer0fcF5176GGvT+ubaMsrNksgvMbmf3Kmap1aSblGU1BpZHislxXUSpKt79zeIG0x7mTQwyLzIsYE=; Received: by smtp60.i.mail.ru with esmtpa (envelope-from ) id 1f1clZ-0005P6-Dc; Thu, 29 Mar 2018 21:59:18 +0300 From: Sergey Suloev To: Mark Brown , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH 1/6] spi: core: handle timeout error from transfer_one() Date: Thu, 29 Mar 2018 21:59:02 +0300 Message-Id: <20180329185907.27281-2-ssuloev@orpaltech.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180329185907.27281-1-ssuloev@orpaltech.com> References: <20180329185907.27281-1-ssuloev@orpaltech.com> Authentication-Results: smtp60.i.mail.ru; auth=pass smtp.auth=ssuloev@orpaltech.com smtp.mailfrom=ssuloev@orpaltech.com X-7FA49CB5: 0D63561A33F958A580B087001892C764A67B693F76D0AEE7805F6469B87D5BC0725E5C173C3A84C37C6C241D99759064AE0A0621C6B81FEB3946EFC6A664F553C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: C5364AD02485212F3ACDC11E67D84917DA9421E42869FF8C6A3CB6A274E9D547069BFC61DABEEB110841D3AAAB1726C63DDE9B364B0DF289264D2CD8C2503E8C22A194DADEED8EEDCA01A23BA9CD1BE7ED14614B50AE0675 X-Mras: OK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180329_115932_402072_88215881 X-CRM114-Status: GOOD ( 10.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sergey Suloev , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As long as sun4i/sun6i SPI drivers have overriden the default "wait for completion" procedure then we need to properly handle -ETIMEDOUT error from transfer_one(). Signed-off-by: Sergey Suloev --- drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b33a727..2dcd4f6 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1028,7 +1028,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, reinit_completion(&ctlr->xfer_completion); ret = ctlr->transfer_one(ctlr, msg->spi, xfer); - if (ret < 0) { + if (ret < 0 && ret != -ETIMEDOUT) { SPI_STATISTICS_INCREMENT_FIELD(statm, errors); SPI_STATISTICS_INCREMENT_FIELD(stats, @@ -1051,7 +1051,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, msecs_to_jiffies(ms)); } - if (ms == 0) { + if (ms == 0 || ret == -ETIMEDOUT) { SPI_STATISTICS_INCREMENT_FIELD(statm, timedout); SPI_STATISTICS_INCREMENT_FIELD(stats, @@ -1059,6 +1059,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, dev_err(&msg->spi->dev, "SPI transfer timed out\n"); msg->status = -ETIMEDOUT; + ret = 0; } } else { if (xfer->len)