mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Mark Brown <broonie@kernel.org>, Frank Li <Frank.Li@nxp.com>,
	imx@lists.linux.dev, linux-spi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH] spi: use dmaengine_get_dma_device() for DMA mapping
Date: Wed, 16 Sep 2026 14:22:04 -0500	[thread overview]
Message-ID: <aqrsXK2T4_9kL0Fd@SMW015318> (raw)
In-Reply-To: <20260916-spi-dma-v1-1-2b30657d373d@nxp.com>

On Wed, Sep 16, 2026 at 11:30:55PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Replace chan->device->dev with dmaengine_get_dma_device(chan) in the
> SPI core (spi.c) and SPI mem (spi-mem.c) DMA mapping helpers so that
> DMA mapping goes through the correct device when the DMA controller
> has per-channel IOMMU domains (chan_dma_dev=true).
>
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/spi/spi-mem.c | 8 ++++----
>  drivers/spi/spi.c     | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
> index 94d122be1c930..b94680b60af95 100644
> --- a/drivers/spi/spi-mem.c
> +++ b/drivers/spi/spi-mem.c
> @@ -46,9 +46,9 @@ int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr,
>  		return -EINVAL;
>
>  	if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx)
> -		dmadev = ctlr->dma_tx->device->dev;
> +		dmadev = dmaengine_get_dma_device(ctlr->dma_tx);
>  	else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx)
> -		dmadev = ctlr->dma_rx->device->dev;
> +		dmadev = dmaengine_get_dma_device(ctlr->dma_rx);
>  	else
>  		dmadev = ctlr->dev.parent;
>
> @@ -92,9 +92,9 @@ void spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr,
>  		return;
>
>  	if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx)
> -		dmadev = ctlr->dma_tx->device->dev;
> +		dmadev = dmaengine_get_dma_device(ctlr->dma_tx);
>  	else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx)
> -		dmadev = ctlr->dma_rx->device->dev;
> +		dmadev = dmaengine_get_dma_device(ctlr->dma_rx);
>  	else
>  		dmadev = ctlr->dev.parent;
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 172141650b648..4f9f34b798b66 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1456,14 +1456,14 @@ int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
>  		return 0;
>
>  	if (ctlr->dma_tx)
> -		tx_dev = ctlr->dma_tx->device->dev;
> +		tx_dev = dmaengine_get_dma_device(ctlr->dma_tx);
>  	else if (ctlr->dma_map_dev)
>  		tx_dev = ctlr->dma_map_dev;
>  	else
>  		tx_dev = ctlr->dev.parent;
>
>  	if (ctlr->dma_rx)
> -		rx_dev = ctlr->dma_rx->device->dev;
> +		rx_dev = dmaengine_get_dma_device(ctlr->dma_rx);
>  	else if (ctlr->dma_map_dev)
>  		rx_dev = ctlr->dma_map_dev;
>  	else
>
> ---
> base-commit: e6e35979777d646fe3c7c94dca7dd32fb25d45f4
> change-id: 20260916-spi-dma-466d0a92bd28
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
>

      parent reply	other threads:[~2026-09-16 19:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 15:30 Peng Fan (OSS)
2026-09-16 19:10 ` Frank Li
2026-09-16 19:22 ` Frank Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqrsXK2T4_9kL0Fd@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=broonie@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®