Received: by 10.213.65.68 with SMTP id h4csp1840386imn; Thu, 29 Mar 2018 12:01:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+whExO+Gl24hZUjx85mURvR+IMeFlPJ5QHn98ilEhLLWI55n0d+2T+bCuwsPVapD+yU8iZ X-Received: by 2002:a17:902:2a43:: with SMTP id i61-v6mr9671290plb.54.1522350105270; Thu, 29 Mar 2018 12:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522350105; cv=none; d=google.com; s=arc-20160816; b=IiOqTZc0kuHH95/ZiO6/VC9d/hDo2LEoK6c9DRILA10kp4dKyqmJ2znBxdpSV9j7V4 LdqVtIB1ohuztJXS8colAbpuPm1+Kv0gxSSv9slZ7IVt6IuZKeBOkLHX2rGSp9ZH9Jfc sp+qJGRF7x3+w3ghfLBuzzGFEs2CkXTqGtpzDzp3o2a7FcTcTaF5QxOg+IIIot7GDEN8 iX7X38EoZnQymOROOqlC51UhLQ63g1dOhy5eYtuqiPLBBld9ozdcBBdDeDV7CiZBKMcH yX/fLGa1YY/MUJMPj/fNtOFKcwdy2BxERw9RLQWigoZFd5zoPrgj6wgIKZtpk8UfWAqh fUew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature :arc-authentication-results; bh=rYgrFchEeott97N1b2w/sRT0dJKPvG0d5l3HmUZDmp0=; b=OBxQJZl3vHcleb9BRZNqx/A2OeKIWsz0ECflOnfyYha3yZLuUFiiIBviln97okLmmz uvTTtHpGXAfXYetKEnzbVANFZoEo2acBtEcbwSRbTowubB+E8Wqe9Cbp4jSRPWLoWnhk 6paNgAdQ/8VnCKlkZyPl6sCEpq0Pr0zs3KNCciZ0wQQ7uncrLkyRjz6cbQ9EtF691KkG oCg6Jf1GnDdsE1mQIr4mHlJMZC8CndTlSEAfr9IftOSzvDb2tjvku8AuKavLxqJ6vt5Z 9JM4ZlKTusaBCe9R91jqVQg2UbUyzc9jfbbrmYDCkyjqy+g364+/593XrKze12KC84OJ 5EtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orpaltech.com header.s=mailru header.b=eM/Jznee; dkim=pass header.i=@orpaltech.com header.s=mailru header.b=eM/Jznee; 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 p3si4361604pgc.776.2018.03.29.12.01.30; Thu, 29 Mar 2018 12:01:45 -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; dkim=pass header.i=@orpaltech.com header.s=mailru header.b=eM/Jznee; dkim=pass header.i=@orpaltech.com header.s=mailru header.b=eM/Jznee; 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 S1752027AbeC2S7k (ORCPT + 99 others); Thu, 29 Mar 2018 14:59:40 -0400 Received: from fallback7.mail.ru ([94.100.181.128]:50154 "EHLO fallback.mail.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751096AbeC2S7i (ORCPT ); Thu, 29 Mar 2018 14:59:38 -0400 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: from [10.161.25.37] (port=43896 helo=smtp60.i.mail.ru) by fallback7.mail.ru with esmtp (envelope-from ) id 1f1clq-0000j7-Eq; Thu, 29 Mar 2018 21:59:34 +0300 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 Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sergey Suloev 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> X-7FA49CB5: 0D63561A33F958A580B087001892C764A67B693F76D0AEE7805F6469B87D5BC0725E5C173C3A84C37C6C241D99759064AE0A0621C6B81FEB3946EFC6A664F553C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: C5364AD02485212F3ACDC11E67D84917DA9421E42869FF8C6A3CB6A274E9D547069BFC61DABEEB110841D3AAAB1726C63DDE9B364B0DF289264D2CD8C2503E8C22A194DADEED8EEDCA01A23BA9CD1BE7ED14614B50AE0675 X-Mras: OK X-Mras: OK Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.16.2