Skip to content

Commit eef51e9

Browse files
Wolfram Sangbroonie
authored andcommitted
spi: fsl-lpspi: 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 7dbbbb1 commit eef51e9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller,
553553
{
554554
struct dma_async_tx_descriptor *desc_tx, *desc_rx;
555555
unsigned long transfer_timeout;
556-
unsigned long timeout;
556+
unsigned long time_left;
557557
struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg;
558558
int ret;
559559

@@ -594,19 +594,19 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller,
594594
transfer->len);
595595

596596
/* Wait eDMA to finish the data transfer.*/
597-
timeout = wait_for_completion_timeout(&fsl_lpspi->dma_tx_completion,
598-
transfer_timeout);
599-
if (!timeout) {
597+
time_left = wait_for_completion_timeout(&fsl_lpspi->dma_tx_completion,
598+
transfer_timeout);
599+
if (!time_left) {
600600
dev_err(fsl_lpspi->dev, "I/O Error in DMA TX\n");
601601
dmaengine_terminate_all(controller->dma_tx);
602602
dmaengine_terminate_all(controller->dma_rx);
603603
fsl_lpspi_reset(fsl_lpspi);
604604
return -ETIMEDOUT;
605605
}
606606

607-
timeout = wait_for_completion_timeout(&fsl_lpspi->dma_rx_completion,
608-
transfer_timeout);
609-
if (!timeout) {
607+
time_left = wait_for_completion_timeout(&fsl_lpspi->dma_rx_completion,
608+
transfer_timeout);
609+
if (!time_left) {
610610
dev_err(fsl_lpspi->dev, "I/O Error in DMA RX\n");
611611
dmaengine_terminate_all(controller->dma_tx);
612612
dmaengine_terminate_all(controller->dma_rx);

0 commit comments

Comments
 (0)