From: Keiji Hayashibara <hayashibara.keiji@socionext.com>
To: broonie@kernel.org, yamada.masahiro@socionext.com,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: masami.hiramatsu@linaro.org, jaswinder.singh@linaro.org,
linux-kernel@vger.kernel.org, hayashibara.keiji@socionext.com
Subject: [PATCH 1/2] spi: uniphier: fix timeout error
Date: Wed, 26 Jun 2019 09:41:47 +0900 [thread overview]
Message-ID: <1561509708-4175-2-git-send-email-hayashibara.keiji@socionext.com> (raw)
In-Reply-To: <1561509708-4175-1-git-send-email-hayashibara.keiji@socionext.com>
Timeout error was silently ignored.
This commit adds timeout error handling and modifies return type of
wait_for_completion_timeout().
Signed-off-by: Keiji Hayashibara <hayashibara.keiji@socionext.com>
---
drivers/spi/spi-uniphier.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index 5a6137f..c3c35c0 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -328,7 +328,8 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
struct spi_transfer *t)
{
struct uniphier_spi_priv *priv = spi_master_get_devdata(master);
- int status;
+ struct device *dev = master->dev.parent;
+ unsigned long time_left;
uniphier_spi_setup_transfer(spi, t);
@@ -338,13 +339,15 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
uniphier_spi_irq_enable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
- status = wait_for_completion_timeout(&priv->xfer_done,
- msecs_to_jiffies(SSI_TIMEOUT_MS));
+ time_left = wait_for_completion_timeout(&priv->xfer_done,
+ msecs_to_jiffies(SSI_TIMEOUT_MS));
uniphier_spi_irq_disable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
- if (status < 0)
- return status;
+ if (!time_left) {
+ dev_err(dev, "transfer timeout.\n");
+ return -ETIMEDOUT;
+ }
return priv->error;
}
--
2.7.4
next prev parent reply other threads:[~2019-06-26 0:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 0:41 [PATCH 0/2] spi: fix spi driver for UniPhier SoC Keiji Hayashibara
2019-06-26 0:41 ` Keiji Hayashibara [this message]
2019-06-26 11:32 ` Applied "spi: uniphier: fix timeout error" to the spi tree Mark Brown
2019-06-26 0:41 ` [PATCH 2/2] spi: uniphier: fix zero-length transfer Keiji Hayashibara
2019-06-26 11:32 ` Applied "spi: uniphier: fix zero-length transfer" to the spi tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1561509708-4175-2-git-send-email-hayashibara.keiji@socionext.com \
--to=hayashibara.keiji@socionext.com \
--cc=broonie@kernel.org \
--cc=jaswinder.singh@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=masami.hiramatsu@linaro.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).