From patchwork Tue Apr 3 15:29:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Suloev X-Patchwork-Id: 10321435 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 01324602C8 for ; Tue, 3 Apr 2018 15:31:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E55F62872E for ; Tue, 3 Apr 2018 15:31:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA13628796; Tue, 3 Apr 2018 15:31:39 +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 7F5722872F for ; Tue, 3 Apr 2018 15:31:39 +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=Jxcp1KoZk67t7Qgy/Eh6p92LYvcapWUd4lEo284qSv4=; b=O0kcCdoX7iSnf2LGrkjqBfaNU7 xIX5z6/8m/h7QGBZarDcLztn3Q2GC+t4nt/8FPpeY9sunyLZ0L9dNLb3Ck12S0Gfi0ws/9thTrAey Y6eYOp3b5PRzqS/yzGT14qdNHGg9r8Cc7UlHdhi7AqbgTrJxZASbNOvxBUxEQStfW3f8QKFjWC0jn 1Wck2/UJVd6nvA/ndkI7IyL827ZMrC7iNMMyzOPKcSQ7EX5ouZvBEv9v8QRQ+4fNQ6hxKMKsFmui+ gfFhNu83cbXQp/QAN8OneDfi+SrD0DufytuxRyNKKgncyq2/9JyNg5e0cMaPZAFMrcb1gn+cxcq6p 22Lus2SQ==; 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 1f3NuE-00056g-N6; Tue, 03 Apr 2018 15:31:30 +0000 Received: from smtp54.i.mail.ru ([217.69.128.34]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3NsA-0002kA-9q for linux-arm-kernel@lists.infradead.org; Tue, 03 Apr 2018 15:29:26 +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=kQ+V013C7EqRCVbBiq4ffiayZSXAm5arWyyIgYdPnDs=; b=NPphYK8PCxbF5bpxNnteapDmJtwZppGyGXyXVHgWsVKZnx+REopGNVCZvRIBOmp8RDssvl8m7sTnDIl99nHZ+cob3Q2oewZpOaKgAMPxH0sX4zDFt1GtnrUEboO5V1WXWkRg/MmnfDVe+k+v0x2S33BWSPxabFU8IRAmHKTvgGQ=; Received: by smtp54.i.mail.ru with esmtpa (envelope-from ) id 1f3Nrx-0003oL-QG; Tue, 03 Apr 2018 18:29:10 +0300 From: Sergey Suloev To: Mark Brown , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v2 1/6] spi: core: handle timeout error from transfer_one() Date: Tue, 3 Apr 2018 18:29:00 +0300 Message-Id: <20180403152905.1524-2-ssuloev@orpaltech.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180403152905.1524-1-ssuloev@orpaltech.com> References: <20180403152905.1524-1-ssuloev@orpaltech.com> Authentication-Results: smtp54.i.mail.ru; auth=pass smtp.auth=ssuloev@orpaltech.com smtp.mailfrom=ssuloev@orpaltech.com X-7FA49CB5: 0D63561A33F958A59F78EFC36D0BDFDAFD153644D6503B5891E74D64282E1D84725E5C173C3A84C3A1C30C8AFC676C8BE6E9CFB9FB6231F8B25CBF701D1BE873C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: C5364AD02485212F3ACDC11E67D8491757F44F8B6190076D6C29EAC4837C1FD6069BFC61DABEEB110841D3AAAB1726C63DDE9B364B0DF289264D2CD8C2503E8C22A194DADEED8EEDCA01A23BA9CD1BE7ED14614B50AE0675 X-Mras: OK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180403_082922_574945_516C41F0 X-CRM114-Status: GOOD ( 10.81 ) 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)