Commit f30e1bfd authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 52f603fe
...@@ -7352,26 +7352,19 @@ lpfc_post_init_setup(struct lpfc_hba *phba) ...@@ -7352,26 +7352,19 @@ lpfc_post_init_setup(struct lpfc_hba *phba)
static int static int
lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
{ {
struct pci_dev *pdev; struct pci_dev *pdev = phba->pcidev;
unsigned long bar0map_len, bar2map_len; unsigned long bar0map_len, bar2map_len;
int i, hbq_count; int i, hbq_count;
void *ptr; void *ptr;
int error = -ENODEV; int error = -ENODEV;
/* Obtain PCI device reference */ if (!pdev)
if (!phba->pcidev)
return error; return error;
else
pdev = phba->pcidev;
/* Set the device DMA mask size */ /* Set the device DMA mask size */
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) { dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
return error; return error;
}
}
/* Get the bus address of Bar0 and Bar2 and the number of bytes /* Get the bus address of Bar0 and Bar2 and the number of bytes
* required by each mapping. * required by each mapping.
...@@ -9735,25 +9728,18 @@ lpfc_pci_function_reset(struct lpfc_hba *phba) ...@@ -9735,25 +9728,18 @@ lpfc_pci_function_reset(struct lpfc_hba *phba)
static int static int
lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
{ {
struct pci_dev *pdev; struct pci_dev *pdev = phba->pcidev;
unsigned long bar0map_len, bar1map_len, bar2map_len; unsigned long bar0map_len, bar1map_len, bar2map_len;
int error = -ENODEV; int error = -ENODEV;
uint32_t if_type; uint32_t if_type;
/* Obtain PCI device reference */ if (!pdev)
if (!phba->pcidev)
return error; return error;
else
pdev = phba->pcidev;
/* Set the device DMA mask size */ /* Set the device DMA mask size */
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) { dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
|| pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
return error; return error;
}
}
/* /*
* The BARs and register set definitions and offset locations are * The BARs and register set definitions and offset locations are
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment