diff options
| -rw-r--r-- | drivers/spi/spi-imx.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 6a2ff750c206..5eaecbba06b7 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
| @@ -891,6 +891,7 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 891 | { | 891 | { |
| 892 | struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL; | 892 | struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL; |
| 893 | int ret; | 893 | int ret; |
| 894 | unsigned long timeout; | ||
| 894 | u32 dma; | 895 | u32 dma; |
| 895 | int left; | 896 | int left; |
| 896 | struct spi_master *master = spi_imx->bitbang.master; | 897 | struct spi_master *master = spi_imx->bitbang.master; |
| @@ -938,17 +939,17 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 938 | dma_async_issue_pending(master->dma_tx); | 939 | dma_async_issue_pending(master->dma_tx); |
| 939 | dma_async_issue_pending(master->dma_rx); | 940 | dma_async_issue_pending(master->dma_rx); |
| 940 | /* Wait SDMA to finish the data transfer.*/ | 941 | /* Wait SDMA to finish the data transfer.*/ |
| 941 | ret = wait_for_completion_timeout(&spi_imx->dma_tx_completion, | 942 | timeout = wait_for_completion_timeout(&spi_imx->dma_tx_completion, |
| 942 | IMX_DMA_TIMEOUT); | 943 | IMX_DMA_TIMEOUT); |
| 943 | if (!ret) { | 944 | if (!timeout) { |
| 944 | pr_warn("%s %s: I/O Error in DMA TX\n", | 945 | pr_warn("%s %s: I/O Error in DMA TX\n", |
| 945 | dev_driver_string(&master->dev), | 946 | dev_driver_string(&master->dev), |
| 946 | dev_name(&master->dev)); | 947 | dev_name(&master->dev)); |
| 947 | dmaengine_terminate_all(master->dma_tx); | 948 | dmaengine_terminate_all(master->dma_tx); |
| 948 | } else { | 949 | } else { |
| 949 | ret = wait_for_completion_timeout(&spi_imx->dma_rx_completion, | 950 | timeout = wait_for_completion_timeout( |
| 950 | IMX_DMA_TIMEOUT); | 951 | &spi_imx->dma_rx_completion, IMX_DMA_TIMEOUT); |
| 951 | if (!ret) { | 952 | if (!timeout) { |
| 952 | pr_warn("%s %s: I/O Error in DMA RX\n", | 953 | pr_warn("%s %s: I/O Error in DMA RX\n", |
| 953 | dev_driver_string(&master->dev), | 954 | dev_driver_string(&master->dev), |
| 954 | dev_name(&master->dev)); | 955 | dev_name(&master->dev)); |
| @@ -963,9 +964,9 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 963 | spi_imx->dma_finished = 1; | 964 | spi_imx->dma_finished = 1; |
| 964 | spi_imx->devtype_data->trigger(spi_imx); | 965 | spi_imx->devtype_data->trigger(spi_imx); |
| 965 | 966 | ||
| 966 | if (!ret) | 967 | if (!timeout) |
| 967 | ret = -ETIMEDOUT; | 968 | ret = -ETIMEDOUT; |
| 968 | else if (ret > 0) | 969 | else |
| 969 | ret = transfer->len; | 970 | ret = transfer->len; |
| 970 | 971 | ||
| 971 | return ret; | 972 | return ret; |
