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

spi: pic32: 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-6-wsa+renesas@sang-engineering.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a7c79e50
...@@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host, ...@@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
{ {
struct pic32_spi *pic32s; struct pic32_spi *pic32s;
bool dma_issued = false; bool dma_issued = false;
unsigned long timeout; unsigned long time_left;
int ret; int ret;
pic32s = spi_controller_get_devdata(host); pic32s = spi_controller_get_devdata(host);
...@@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host, ...@@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
} }
/* wait for completion */ /* wait for completion */
timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); time_left = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
if (timeout == 0) { if (time_left == 0) {
dev_err(&spi->dev, "wait error/timedout\n"); dev_err(&spi->dev, "wait error/timedout\n");
if (dma_issued) { if (dma_issued) {
dmaengine_terminate_all(host->dma_rx); dmaengine_terminate_all(host->dma_rx);
......
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