Skip to content

Commit 594aa75

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

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/spi/spi-xlp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int xlp_spi_xfer_block(struct xlp_spi_priv *xs,
270270
const unsigned char *tx_buf,
271271
unsigned char *rx_buf, int xfer_len, int cmd_cont)
272272
{
273-
int timeout;
273+
unsigned long time_left;
274274
u32 intr_mask = 0;
275275

276276
xs->tx_buf = tx_buf;
@@ -299,11 +299,11 @@ static int xlp_spi_xfer_block(struct xlp_spi_priv *xs,
299299
intr_mask |= XLP_SPI_INTR_DONE;
300300
xlp_spi_reg_write(xs, xs->cs, XLP_SPI_INTR_EN, intr_mask);
301301

302-
timeout = wait_for_completion_timeout(&xs->done,
303-
msecs_to_jiffies(1000));
302+
time_left = wait_for_completion_timeout(&xs->done,
303+
msecs_to_jiffies(1000));
304304
/* Disable interrupts */
305305
xlp_spi_reg_write(xs, xs->cs, XLP_SPI_INTR_EN, 0x0);
306-
if (!timeout) {
306+
if (!time_left) {
307307
dev_err(&xs->dev, "xfer timedout!\n");
308308
goto out;
309309
}

0 commit comments

Comments
 (0)