lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <c8ac6625-a2d8-171d-f1b5-ad72e34a7645@pcs.com>
Date:   Wed, 15 Nov 2023 14:59:06 +0100
From:   Thomas Pfaff <tpfaff@....com>
To:     <tudor.ambarus@...rochip.com>
CC:     <broonie@...nel.org>, <nicolas.ferre@...rochip.com>,
        <alexandre.belloni@...tlin.com>, <claudiu.beznea@...rochip.com>,
        <linux-spi@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH RFC 1/3 stable-6.1] spi: spi-atmel: switch to managed
 dma_alloc_coherent

From: Thomas Pfaff <tpfaff@....com>

use managed dma_alloc_coherent instead of unmanaged.

Signed-off-by: Thomas Pfaff <tpfaff@....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);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ