* [PATCH RFC 1/3 stable-6.1] spi: spi-atmel: switch to managed dma_alloc_coherent
@ 2023-11-15 13:59 Thomas Pfaff
0 siblings, 0 replies; only message in thread
From: Thomas Pfaff @ 2023-11-15 13:59 UTC (permalink / raw)
To: tudor.ambarus
Cc: broonie, nicolas.ferre, alexandre.belloni, claudiu.beznea,
linux-spi, linux-arm-kernel, linux-kernel
From: Thomas Pfaff <tpfaff@pcs.com>
use managed dma_alloc_coherent instead of unmanaged.
Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
---
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index c4f22d50dba5..fc566d22aa36 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1513,22 +1513,22 @@ static int atmel_spi_probe(struct platform_device *pdev)
}
if (IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) {
- as->addr_rx_bbuf = dma_alloc_coherent(&pdev->dev,
- SPI_MAX_DMA_XFER,
- &as->dma_addr_rx_bbuf,
- GFP_KERNEL | GFP_DMA);
+ as->addr_rx_bbuf = dmam_alloc_coherent(&pdev->dev,
+ SPI_MAX_DMA_XFER,
+ &as->dma_addr_rx_bbuf,
+ GFP_KERNEL | GFP_DMA);
if (!as->addr_rx_bbuf) {
as->use_dma = false;
} else {
- as->addr_tx_bbuf = dma_alloc_coherent(&pdev->dev,
- SPI_MAX_DMA_XFER,
- &as->dma_addr_tx_bbuf,
- GFP_KERNEL | GFP_DMA);
+ as->addr_tx_bbuf = dmam_alloc_coherent(&pdev->dev,
+ SPI_MAX_DMA_XFER,
+ &as->dma_addr_tx_bbuf,
+ GFP_KERNEL | GFP_DMA);
if (!as->addr_tx_bbuf) {
as->use_dma = false;
- dma_free_coherent(&pdev->dev, SPI_MAX_DMA_XFER,
- as->addr_rx_bbuf,
- as->dma_addr_rx_bbuf);
+ dmam_free_coherent(&pdev->dev, SPI_MAX_DMA_XFER,
+ as->addr_rx_bbuf,
+ as->dma_addr_rx_bbuf);
}
}
if (!as->use_dma)
@@ -1607,14 +1607,6 @@ static int atmel_spi_remove(struct platform_device *pdev)
if (as->use_dma) {
atmel_spi_stop_dma(master);
atmel_spi_release_dma(master);
- if (IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) {
- dma_free_coherent(&pdev->dev, SPI_MAX_DMA_XFER,
- as->addr_tx_bbuf,
- as->dma_addr_tx_bbuf);
- dma_free_coherent(&pdev->dev, SPI_MAX_DMA_XFER,
- as->addr_rx_bbuf,
- as->dma_addr_rx_bbuf);
- }
}
spin_lock_irq(&as->lock);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-15 14:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 13:59 [PATCH RFC 1/3 stable-6.1] spi: spi-atmel: switch to managed dma_alloc_coherent Thomas Pfaff
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).