Re: [PATCH 6.1.y-cip 26/32] spi: rzv2h-rspi: add support for DMA mode
Pavel Machek <[email protected]>
| Newsgroups | org.cip-project.lists.cip-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi! > From: Cosmin Tanislav <[email protected]> > > commit fa08b566860bca8ebf9300090b85174c34de7ca5 upstream. > > The DMA controller can be used to transfer data to and from the SPI > controller without involving the CPU for each word of a SPI transfer. > > Add support for DMA mode. > > Signed-off-by: Cosmin Tanislav <[email protected]> > Link: https://patch.msgid.link/[email protected] > Signed-off-by: Mark Brown <[email protected]> > [tm: Use dev_warn() equivalent of dev_warn_probe()] > Signed-off-by: Tommaso Merciai <[email protected]> > --- > drivers/spi/spi-rzv2h-rspi.c | 171 ++++++++++++++++++++++++++++++++++- > 1 file changed, 170 insertions(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c > index 3191eaddc9d5..623e7683dcf3 100644 > --- a/drivers/spi/spi-rzv2h-rspi.c > +++ b/drivers/spi/spi-rzv2h-rspi.c > +static int rzv2h_rspi_transfer_dma(struct rzv2h_rspi_priv *rspi, > + struct spi_device *spi, > + struct spi_transfer *transfer, > + unsigned int words_to_transfer) > +{ > + struct dma_async_tx_descriptor *tx_desc = NULL, *rx_desc = NULL; > + enum dma_slave_buswidth width; > + dma_cookie_t cookie; > + int ret; ... > + cookie = dmaengine_submit(rx_desc); > + if (dma_submit_error(cookie)) > + return cookie; > + > + cookie = dmaengine_submit(tx_desc); > + if (dma_submit_error(cookie)) { > + dmaengine_terminate_sync(rspi->controller->dma_rx); > + return cookie; > + } I'd do "ret = dma_submit_error()"... return ret; in both cases here. Just silently casting dma_cookie_t to int like this is apparently not how the API was designed. Thanks and best regards, Pavel
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCaj+yCQAKCRAw5/Bqldv6 8jEpAJ9l8EAUMQltieUhwgGQdcKQuYbjMQCfcZmH/XAXyVSlsgtHlfnhe5F/TQs= =zUWN -----END PGP SIGNATURE-----