diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-07-17 06:33:29 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-07-17 13:56:49 +0200 |
commit | 5f8f80356eccfaae1db8a827626ae4fc2eb62831 (patch) | |
tree | 1e69cc119ba4d1b480fa0bcd6ee11a278cdd55c2 /drivers/spi | |
parent | spi: rockchip: add description for px30 (diff) | |
download | linux-5f8f80356eccfaae1db8a827626ae4fc2eb62831.tar.xz linux-5f8f80356eccfaae1db8a827626ae4fc2eb62831.zip |
spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer
Upper layer users of SPI device drivers may rely on 'actual_length',
so it is important that information is correctly reported. One such
example is spi_mem_exec_op() function that will fail if
'actual_length' of the data transferred is not what was requested. Add
necessary code to populate 'actual_length.
Cc: Mark Brown <broonie@kernel.org>
Cc: Sanchayan Maity <maitysanchayan@gmail.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: cphealy@gmail.com
Cc: linux-spi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-dspi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 89a1e7a4fe5d..9e598642ca66 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -358,6 +358,7 @@ static int dspi_dma_xfer(struct fsl_dspi *dspi) { struct fsl_dspi_dma *dma = dspi->dma; struct device *dev = &dspi->pdev->dev; + struct spi_message *message = dspi->cur_msg; int curr_remaining_bytes; int bytes_per_buffer; int ret = 0; @@ -377,8 +378,10 @@ static int dspi_dma_xfer(struct fsl_dspi *dspi) goto exit; } else { - curr_remaining_bytes -= dma->curr_xfer_len - * dspi->bytes_per_word; + const int len = + dma->curr_xfer_len * dspi->bytes_per_word; + curr_remaining_bytes -= len; + message->actual_length += len; if (curr_remaining_bytes < 0) curr_remaining_bytes = 0; } |