diff mbox series

crypto: cavium/zip - Use dma_set_mask_and_coherent to simplify code

Message ID 20201121073131.1321343-1-christophe.jaillet@wanadoo.fr
State Accepted
Commit d4f9afb23378f50e40cd3bc8aee35679bfd1d27b
Headers show
Series crypto: cavium/zip - Use dma_set_mask_and_coherent to simplify code | expand

Commit Message

Christophe JAILLET Nov. 21, 2020, 7:31 a.m. UTC
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by
an equivalent 'dma_set_mask_and_coherent()' which is much less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/crypto/cavium/zip/zip_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Herbert Xu Nov. 27, 2020, 6:27 a.m. UTC | #1
On Sat, Nov 21, 2020 at 08:31:31AM +0100, Christophe JAILLET wrote:
> 'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by

> an equivalent 'dma_set_mask_and_coherent()' which is much less verbose.

> 

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

> ---

>  drivers/crypto/cavium/zip/zip_main.c | 10 ++--------

>  1 file changed, 2 insertions(+), 8 deletions(-)


Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff mbox series

Patch

diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index d35216e2f6cd..812b4ac9afd6 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -263,15 +263,9 @@  static int zip_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_disable_device;
 	}
 
-	err = pci_set_dma_mask(pdev, DMA_BIT_MASK(48));
+	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48));
 	if (err) {
-		dev_err(dev, "Unable to get usable DMA configuration\n");
-		goto err_release_regions;
-	}
-
-	err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(48));
-	if (err) {
-		dev_err(dev, "Unable to get 48-bit DMA for allocations\n");
+		dev_err(dev, "Unable to get usable 48-bit DMA configuration\n");
 		goto err_release_regions;
 	}