Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430114142.28551-2-wsa+renesas@sang-engineering.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Wolfram Sang and committed by
Mark Brown
7dbbbb12 47766799

+4 -4
+4 -4
drivers/spi/spi-armada-3700.c
··· 339 339 static bool a3700_spi_wait_completion(struct spi_device *spi) 340 340 { 341 341 struct a3700_spi *a3700_spi; 342 - unsigned int timeout; 342 + unsigned long time_left; 343 343 unsigned int ctrl_reg; 344 344 unsigned long timeout_jiffies; 345 345 ··· 361 361 a3700_spi->wait_mask); 362 362 363 363 timeout_jiffies = msecs_to_jiffies(A3700_SPI_TIMEOUT); 364 - timeout = wait_for_completion_timeout(&a3700_spi->done, 365 - timeout_jiffies); 364 + time_left = wait_for_completion_timeout(&a3700_spi->done, 365 + timeout_jiffies); 366 366 367 367 a3700_spi->wait_mask = 0; 368 368 369 - if (timeout) 369 + if (time_left) 370 370 return true; 371 371 372 372 /* there might be the case that right after we checked the