Skip to content

Commit f30e1bf

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: lpfc: 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. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 52f603f commit f30e1bf

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7352,26 +7352,19 @@ lpfc_post_init_setup(struct lpfc_hba *phba)
73527352
static int
73537353
lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
73547354
{
7355-
struct pci_dev *pdev;
7355+
struct pci_dev *pdev = phba->pcidev;
73567356
unsigned long bar0map_len, bar2map_len;
73577357
int i, hbq_count;
73587358
void *ptr;
73597359
int error = -ENODEV;
73607360

7361-
/* Obtain PCI device reference */
7362-
if (!phba->pcidev)
7361+
if (!pdev)
73637362
return error;
7364-
else
7365-
pdev = phba->pcidev;
73667363

73677364
/* Set the device DMA mask size */
7368-
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
7369-
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
7370-
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
7371-
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
7372-
return error;
7373-
}
7374-
}
7365+
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
7366+
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
7367+
return error;
73757368

73767369
/* Get the bus address of Bar0 and Bar2 and the number of bytes
73777370
* required by each mapping.
@@ -9735,25 +9728,18 @@ lpfc_pci_function_reset(struct lpfc_hba *phba)
97359728
static int
97369729
lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
97379730
{
9738-
struct pci_dev *pdev;
9731+
struct pci_dev *pdev = phba->pcidev;
97399732
unsigned long bar0map_len, bar1map_len, bar2map_len;
97409733
int error = -ENODEV;
97419734
uint32_t if_type;
97429735

9743-
/* Obtain PCI device reference */
9744-
if (!phba->pcidev)
9736+
if (!pdev)
97459737
return error;
9746-
else
9747-
pdev = phba->pcidev;
97489738

97499739
/* Set the device DMA mask size */
9750-
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
9751-
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
9752-
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
9753-
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
9754-
return error;
9755-
}
9756-
}
9740+
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
9741+
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
9742+
return error;
97579743

97589744
/*
97599745
* The BARs and register set definitions and offset locations are

0 commit comments

Comments
 (0)