* [PATCH] spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer
@ 2018-07-16 6:25 Andrey Smirnov
2018-07-16 11:26 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Andrey Smirnov @ 2018-07-16 6:25 UTC (permalink / raw)
To: Mark Brown
Cc: Andrey Smirnov, Sanchayan Maity, Stefan Agner, cphealy, linux-spi,
linux-kernel
Users of SPI device drivers may rely on 'actual_length', so it is
important that information is correctly reported. One example would be
spi_mem_exec_op() which will fail if 'actual_length' doesn't match
requested transfer length. To fix the problem, 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>
---
drivers/spi/spi-fsl-dspi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 0630962ce442..8877dd1e18dc 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -327,6 +327,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 word = 1;
@@ -348,7 +349,10 @@ static int dspi_dma_xfer(struct fsl_dspi *dspi)
goto exit;
} else {
- curr_remaining_bytes -= dma->curr_xfer_len * word;
+ const int len = dma->curr_xfer_len * word;
+
+ curr_remaining_bytes -= len;
+ message->actual_length += len;
if (curr_remaining_bytes < 0)
curr_remaining_bytes = 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer
2018-07-16 6:25 [PATCH] spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer Andrey Smirnov
@ 2018-07-16 11:26 ` Mark Brown
2018-07-17 4:11 ` Andrey Smirnov
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2018-07-16 11:26 UTC (permalink / raw)
To: Andrey Smirnov
Cc: Sanchayan Maity, Stefan Agner, cphealy, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
On Sun, Jul 15, 2018 at 11:25:08PM -0700, Andrey Smirnov wrote:
> Users of SPI device drivers may rely on 'actual_length', so it is
> important that information is correctly reported. One example would be
> spi_mem_exec_op() which will fail if 'actual_length' doesn't match
> requested transfer length. To fix the problem, add necessary code to
> populate 'actual_length'.
This doesn't apply against current code, please check and resend.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer
2018-07-16 11:26 ` Mark Brown
@ 2018-07-17 4:11 ` Andrey Smirnov
0 siblings, 0 replies; 3+ messages in thread
From: Andrey Smirnov @ 2018-07-17 4:11 UTC (permalink / raw)
To: Mark Brown
Cc: maitysanchayan, Stefan Agner, Chris Healy, linux-spi,
linux-kernel
On Mon, Jul 16, 2018 at 4:26 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Sun, Jul 15, 2018 at 11:25:08PM -0700, Andrey Smirnov wrote:
> > Users of SPI device drivers may rely on 'actual_length', so it is
> > important that information is correctly reported. One example would be
> > spi_mem_exec_op() which will fail if 'actual_length' doesn't match
> > requested transfer length. To fix the problem, add necessary code to
> > populate 'actual_length'.
>
> This doesn't apply against current code, please check and resend.
Sorry about that. Will do in v2.
Thanks,
Andrey Smirnov
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-17 4:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16 6:25 [PATCH] spi: spi-fsl-dspi: Fill actual_length when doing DMA transfer Andrey Smirnov
2018-07-16 11:26 ` Mark Brown
2018-07-17 4:11 ` Andrey Smirnov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).