Skip to content

Commit a69b080

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: bfa: use dma_set_mask_and_coherent
The driver currently uses pci_set_dma_mask despite otherwise using the generic DMA API. Switch it over to the better generic DMA API helper and also ensure we set the coherent mask as well in the resume path. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b3b0776 commit a69b080

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/scsi/bfa/bfad.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -739,14 +739,10 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
739739

740740
pci_set_master(pdev);
741741

742-
743-
if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) ||
744-
(pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0)) {
745-
if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) ||
746-
(pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) {
747-
printk(KERN_ERR "pci_set_dma_mask fail %p\n", pdev);
748-
goto out_release_region;
749-
}
742+
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
743+
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
744+
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
745+
goto out_release_region;
750746
}
751747

752748
/* Enable PCIE Advanced Error Recovery (AER) if kernel supports */
@@ -1565,9 +1561,9 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15651561
pci_save_state(pdev);
15661562
pci_set_master(pdev);
15671563

1568-
if (pci_set_dma_mask(bfad->pcidev, DMA_BIT_MASK(64)) != 0)
1569-
if (pci_set_dma_mask(bfad->pcidev, DMA_BIT_MASK(32)) != 0)
1570-
goto out_disable_device;
1564+
if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) ||
1565+
dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32)))
1566+
goto out_disable_device;
15711567

15721568
if (restart_bfa(bfad) == -1)
15731569
goto out_disable_device;

0 commit comments

Comments
 (0)