Skip to contentSkip to conversation

spi: replace chan->device->dev with dmaengine_get_provider_device()

PATCH In review [email protected] 3 participants 4 messages Nov 3 – Nov 8

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: replace chan->device->dev with dmaengine_get_provider_device()

From: Frank Li <[email protected]>

Use the dmaengine_get_provider_device() API instead of directly accessing chan->device->dev to get the DMA provider device.

No functional change. Prepare make to struct dma_device private to the DMA engine.

---
 drivers/spi/spi-dw-dma.c          | 2 +-
 drivers/spi/spi-pxa2xx-pci.c      | 2 +-
 drivers/spi/spi-pxa2xx-platform.c | 2 +-
 drivers/spi/spi-topcliff-pch.c    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-dw-dma.c +1 -1
index b706770334a61..a655026071729 100644
@@ -27,7 +27,7 @@ static bool dw_spi_dma_chan_filter(struct dma_chan *chan, void *param)
 {
 	struct dw_dma_slave *s = param;
 
-	if (s->dma_dev != chan->device->dev)
+	if (s->dma_dev != dmaengine_get_provider_device(chan))
 		return false;
 
 	chan->private = s;
drivers/spi/spi-pxa2xx-pci.c +1 -1
index cae77ac185206..de790e94f493f 100644
@@ -81,7 +81,7 @@ static bool lpss_dma_filter(struct dma_chan *chan, void *param)
 {
 	struct dw_dma_slave *dws = param;
 
-	if (dws->dma_dev != chan->device->dev)
+	if (dws->dma_dev != dmaengine_get_provider_device(chan))
 		return false;
 
 	chan->private = dws;
drivers/spi/spi-pxa2xx-platform.c +1 -1
index 849a14cd0343c..8e90bbf74350d 100644
@@ -14,7 +14,7 @@
 
 static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param)
 {
-	return param == chan->device->dev;
+	return param == dmaengine_get_provider_device(chan);
 }
 
 static int
drivers/spi/spi-topcliff-pch.c +1 -1
index 1f53d62f37267..b5aa52596ecb4 100644
@@ -808,7 +808,7 @@ static bool pch_spi_filter(struct dma_chan *chan, void *slave)
 	struct pch_dma_slave *param = slave;
 
 	if ((chan->chan_id == param->chan_id) &&
-	    (param->dma_dev == chan->device->dev)) {
+	    (param->dma_dev == dmaengine_get_provider_device(chan))) {
 		chan->private = param;
 		return true;
 	} else {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · On Tue, Nov 03, 2026 at 04:58:23PM -0500, [email protected] wrote:

Use the dmaengine_get_provider_device() API instead of directly accessing chan->device->dev to get the DMA provider device.

No functional change. Prepare make to struct dma_device private to the DMA engine.

...

drivers/spi/spi-dw-dma.c static bool dw_spi_dma_chan_filter(struct dma_chan *chan, void *param) · line 31

Quoted 5 lines
drivers/spi/spi-dw-dma.c +1 -1
 	struct dw_dma_slave *s = param;
 
-	if (s->dma_dev != chan->device->dev)
+	if (s->dma_dev != dmaengine_get_provider_device(chan))
 		return false;

It's obvious that we need another helper to match.

// void * and EXPORT to be able to use as filter function
bool dmaengine_match_provider_device(struct dma_chan *chan, void *dma_dev)

{
	return dmaengine_get_provider_device(chan) == dma_dev;
}

EXPORT_SYMBOL_GPL(dmaengine_match_provider_device);

...

drivers/spi/spi-pxa2xx-platform.c line 18

Quoted 5 lines

static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) {

drivers/spi/spi-pxa2xx-platform.c +1 -1
-	return param == chan->device->dev;
+	return param == dmaengine_get_provider_device(chan);
 }

With that being done this function is gone.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#2 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 5 lines · On Tue, Nov 03, 2026 at 04:58:23PM -0500, [email protected] wrote:

Use the dmaengine_get_provider_device() API instead of directly accessing chan->device->dev to get the DMA provider device.

No functional change. Prepare make to struct dma_device private to the DMA engine.

...

drivers/spi/spi-dw-dma.c static bool dw_spi_dma_chan_filter(struct dma_chan *chan, void *param) · line 31

Quoted 5 lines
drivers/spi/spi-dw-dma.c +1 -1
 	struct dw_dma_slave *s = param;
 
-	if (s->dma_dev != chan->device->dev)
+	if (s->dma_dev != dmaengine_get_provider_device(chan))
 		return false;

It's obvious that we need another helper to match.

Quoted 7 lines

// void * and EXPORT to be able to use as filter function
bool dmaengine_match_provider_device(struct dma_chan *chan, void *dma_dev)

{
	return dmaengine_get_provider_device(chan) == dma_dev;
}

EXPORT_SYMBOL_GPL(dmaengine_match_provider_device);

Yes, I can submit Add API patch first. It cross multi subsystems, it'd better put this optimizate at next version and leave it as it now. Others depend on dma engine patch to make merge complex. and there are not much files.

Frank

Quoted 15 lines

...

drivers/spi/spi-pxa2xx-platform.c line 18

Quoted 5 lines

static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) {

drivers/spi/spi-pxa2xx-platform.c +1 -1
-	return param == chan->device->dev;
+	return param == dmaengine_get_provider_device(chan);
 }

With that being done this function is gone.

--
With Best Regards,
Andy Shevchenko

maintainer
#3 lore raw
In reply to [email protected]
Quoted 1 line · On Tue, 03 Nov 2026 16:58:23 -0500, [email protected] wrote:

spi: replace chan->device->dev with dmaengine_get_provider_device()

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.5

Thanks!

[1/1] spi: replace chan->device->dev with dmaengine_get_provider_device()

      https://git.kernel.org/broonie/spi/c/12acfe305495

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark