Skip to content

Commit e66480a

Browse files
Wolfram Sangbroonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a7c79e5 commit e66480a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/spi/spi-pic32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
498498
{
499499
struct pic32_spi *pic32s;
500500
bool dma_issued = false;
501-
unsigned long timeout;
501+
unsigned long time_left;
502502
int ret;
503503

504504
pic32s = spi_controller_get_devdata(host);
@@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host,
545545
}
546546

547547
/* wait for completion */
548-
timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
549-
if (timeout == 0) {
548+
time_left = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
549+
if (time_left == 0) {
550550
dev_err(&spi->dev, "wait error/timedout\n");
551551
if (dma_issued) {
552552
dmaengine_terminate_all(host->dma_rx);

0 commit comments

Comments
 (0)