diff options
author | Christoph Hellwig <hch@lst.de> | 2018-10-10 13:59:50 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-10-17 21:58:52 -0400 |
commit | f73bdebdf020a31ad43ce4de590ec7a09e383abd (patch) | |
tree | e208c83cd5d4dad081fcf5694c73c3111bfb7546 /drivers/scsi/pm8001/pm8001_init.c | |
parent | 03676e1d31fa0e156df0caecbacf20b488f7bd3a (diff) |
scsi: pm8001: switch to generic DMA API
Switch from the legacy PCI DMA API to the generic DMA API.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_init.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_init.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 501830caba21..d71e7e4ec29c 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -152,7 +152,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha) | |||
152 | 152 | ||
153 | for (i = 0; i < USI_MAX_MEMCNT; i++) { | 153 | for (i = 0; i < USI_MAX_MEMCNT; i++) { |
154 | if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { | 154 | if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { |
155 | pci_free_consistent(pm8001_ha->pdev, | 155 | dma_free_coherent(&pm8001_ha->pdev->dev, |
156 | (pm8001_ha->memoryMap.region[i].total_len + | 156 | (pm8001_ha->memoryMap.region[i].total_len + |
157 | pm8001_ha->memoryMap.region[i].alignment), | 157 | pm8001_ha->memoryMap.region[i].alignment), |
158 | pm8001_ha->memoryMap.region[i].virt_ptr, | 158 | pm8001_ha->memoryMap.region[i].virt_ptr, |
@@ -501,30 +501,12 @@ static int pci_go_44(struct pci_dev *pdev) | |||
501 | { | 501 | { |
502 | int rc; | 502 | int rc; |
503 | 503 | ||
504 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(44))) { | 504 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); |
505 | rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(44)); | 505 | if (rc) { |
506 | if (rc) { | 506 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
507 | rc = pci_set_consistent_dma_mask(pdev, | 507 | if (rc) |
508 | DMA_BIT_MASK(32)); | ||
509 | if (rc) { | ||
510 | dev_printk(KERN_ERR, &pdev->dev, | ||
511 | "44-bit DMA enable failed\n"); | ||
512 | return rc; | ||
513 | } | ||
514 | } | ||
515 | } else { | ||
516 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
517 | if (rc) { | ||
518 | dev_printk(KERN_ERR, &pdev->dev, | 508 | dev_printk(KERN_ERR, &pdev->dev, |
519 | "32-bit DMA enable failed\n"); | 509 | "32-bit DMA enable failed\n"); |
520 | return rc; | ||
521 | } | ||
522 | rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
523 | if (rc) { | ||
524 | dev_printk(KERN_ERR, &pdev->dev, | ||
525 | "32-bit consistent DMA enable failed\n"); | ||
526 | return rc; | ||
527 | } | ||
528 | } | 510 | } |
529 | return rc; | 511 | return rc; |
530 | } | 512 | } |