Skip to content

Commit a7c79e5

Browse files
Wolfram Sangbroonie
authored andcommitted
spi: pic32-sqi: 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 eaeac04 commit a7c79e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/spi/spi-pic32-sqi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static int pic32_sqi_one_message(struct spi_controller *host,
344344
struct spi_transfer *xfer;
345345
struct pic32_sqi *sqi;
346346
int ret = 0, mode;
347-
unsigned long timeout;
347+
unsigned long time_left;
348348
u32 val;
349349

350350
sqi = spi_controller_get_devdata(host);
@@ -410,8 +410,8 @@ static int pic32_sqi_one_message(struct spi_controller *host,
410410
writel(val, sqi->regs + PESQI_BD_CTRL_REG);
411411

412412
/* wait for xfer completion */
413-
timeout = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ);
414-
if (timeout == 0) {
413+
time_left = wait_for_completion_timeout(&sqi->xfer_done, 5 * HZ);
414+
if (time_left == 0) {
415415
dev_err(&sqi->host->dev, "wait timedout/interrupted\n");
416416
ret = -ETIMEDOUT;
417417
msg->status = ret;

0 commit comments

Comments
 (0)