Commit a7c79e50 authored by Wolfram Sang's avatar Wolfram Sang Committed by Mark Brown

spi: pic32-sqi: use 'time_left' variable with wait_for_completion_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

	timeout = wait_for_completion_timeout(...)
	if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430114142.28551-5-wsa+renesas@sang-engineering.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent eaeac043
...@@ -344,7 +344,7 @@ static int pic32_sqi_one_message(struct spi_controller *host, ...@@ -344,7 +344,7 @@ static int pic32_sqi_one_message(struct spi_controller *host,
struct spi_transfer *xfer; struct spi_transfer *xfer;
struct pic32_sqi *sqi; struct pic32_sqi *sqi;
int ret = 0, mode; int ret = 0, mode;
unsigned long timeout; unsigned long time_left;
u32 val; u32 val;
sqi = spi_controller_get_devdata(host); sqi = spi_controller_get_devdata(host);
...@@ -410,8 +410,8 @@ static int pic32_sqi_one_message(struct spi_controller *host, ...@@ -410,8 +410,8 @@ static int pic32_sqi_one_message(struct spi_controller *host,
writel(val, sqi->regs + PESQI_BD_CTRL_REG); writel(val, sqi->regs + PESQI_BD_CTRL_REG);
/* wait for xfer completion */ /* wait for xfer completion */
timeout = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ); time_left = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ);
if (timeout == 0) { if (time_left == 0) {
dev_err(&sqi->host->dev, "wait timedout/interrupted\n"); dev_err(&sqi->host->dev, "wait timedout/interrupted\n");
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
msg->status = ret; msg->status = ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment