mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20240430114142.28551-6-wsa+renesas@sang-engineering.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a7c79e50a2
commit
e66480aed4
@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
|
||||
{
|
||||
struct pic32_spi *pic32s;
|
||||
bool dma_issued = false;
|
||||
unsigned long timeout;
|
||||
unsigned long time_left;
|
||||
int ret;
|
||||
|
||||
pic32s = spi_controller_get_devdata(host);
|
||||
@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
|
||||
}
|
||||
|
||||
/* wait for completion */
|
||||
timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
|
||||
if (timeout == 0) {
|
||||
time_left = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
|
||||
if (time_left == 0) {
|
||||
dev_err(&spi->dev, "wait error/timedout\n");
|
||||
if (dma_issued) {
|
||||
dmaengine_terminate_all(host->dma_rx);
|
||||
|
Loading…
Reference in New Issue
Block a user