Skip to content

Commit

Permalink
crypto: cavium - Use dma_set_mask_and_coherent to simplify code
Browse files Browse the repository at this point in the history
'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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Christophe JAILLET authored and Herbert Xu committed Nov 27, 2020
1 parent 7f6c383 commit aeb4d8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions drivers/crypto/cavium/cpt/cptpf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,9 @@ static int cpt_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto cpt_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 cpt_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 consistent allocations\n");
dev_err(dev, "Unable to get usable 48-bit DMA configuration\n");
goto cpt_err_release_regions;
}

Expand Down
10 changes: 2 additions & 8 deletions drivers/crypto/cavium/cpt/cptvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,9 @@ static int cptvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
/* Mark as VF driver */
cptvf->flags |= CPT_FLAG_VF_DRIVER;
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 cptvf_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 consistent allocations\n");
dev_err(dev, "Unable to get usable 48-bit DMA configuration\n");
goto cptvf_err_release_regions;
}

Expand Down

0 comments on commit aeb4d8c

Please sign in to comment.