[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60691eb7-ca16-4547-8744-f9bfae919a3f@notapiano>
Date: Wed, 29 May 2024 08:35:26 -0400
From: Nícolas F. R. A. Prado <nfraprado@...labora.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Neil Armstrong <neil.armstrong@...aro.org>
Subject: Re: [PATCH v1 2/2] spi: Check if transfer is mapped before calling
DMA sync APIs
On Wed, May 22, 2024 at 02:41:51PM -0400, Nícolas F. R. A. Prado wrote:
> On Wed, May 22, 2024 at 08:09:50PM +0300, Andy Shevchenko wrote:
[..]
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index f94420858c22..9bc9fd10d538 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1220,6 +1220,11 @@ void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,
> spi_unmap_buf_attrs(ctlr, dev, sgt, dir, 0);
> }
>
> +/* Dummy SG for unidirect transfers */
> +static struct scatterlist dummy_sg = {
> + .page_link = SG_END,
> +};
> +
> static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
> {
> struct device *tx_dev, *rx_dev;
> @@ -1258,6 +1263,8 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
> attrs);
> if (ret != 0)
> return ret;
> + } else {
> + xfer->tx_sg.sgl = &dummy_sg;
> }
>
> if (xfer->rx_buf != NULL) {
> @@ -1271,6 +1278,8 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
>
> return ret;
> }
> + } else {
> + xfer->rx_sg.sgl = &dummy_sg;
> }
> }
> /* No transfer has been mapped, bail out with success */
Hi Andy,
I can send this patch to the list myself with your authorship, I just need your
SoB.
Thanks,
Nícolas
Powered by blists - more mailing lists