Commit 7dbbbb12 authored by Wolfram Sang's avatar Wolfram Sang Committed by Mark Brown

spi: armada-3700: 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.

Fix to the proper variable type 'unsigned long' while here.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430114142.28551-2-wsa+renesas@sang-engineering.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 47766799
...@@ -339,7 +339,7 @@ static irqreturn_t a3700_spi_interrupt(int irq, void *dev_id) ...@@ -339,7 +339,7 @@ static irqreturn_t a3700_spi_interrupt(int irq, void *dev_id)
static bool a3700_spi_wait_completion(struct spi_device *spi) static bool a3700_spi_wait_completion(struct spi_device *spi)
{ {
struct a3700_spi *a3700_spi; struct a3700_spi *a3700_spi;
unsigned int timeout; unsigned long time_left;
unsigned int ctrl_reg; unsigned int ctrl_reg;
unsigned long timeout_jiffies; unsigned long timeout_jiffies;
...@@ -361,12 +361,12 @@ static bool a3700_spi_wait_completion(struct spi_device *spi) ...@@ -361,12 +361,12 @@ static bool a3700_spi_wait_completion(struct spi_device *spi)
a3700_spi->wait_mask); a3700_spi->wait_mask);
timeout_jiffies = msecs_to_jiffies(A3700_SPI_TIMEOUT); timeout_jiffies = msecs_to_jiffies(A3700_SPI_TIMEOUT);
timeout = wait_for_completion_timeout(&a3700_spi->done, time_left = wait_for_completion_timeout(&a3700_spi->done,
timeout_jiffies); timeout_jiffies);
a3700_spi->wait_mask = 0; a3700_spi->wait_mask = 0;
if (timeout) if (time_left)
return true; return true;
/* there might be the case that right after we checked the /* there might be the case that right after we checked the
......
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