scsi: qla1280: switch to generic DMA API
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Oct 2018 18:09:04 +0000 (20:09 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 18 Oct 2018 01:58:53 +0000 (21:58 -0400)
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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla1280.c

index 390775d5c91888361ebaad09a5425a02217baaed..15a50cc7e4b36820a077d04af895543a4e2dc681 100644 (file)
@@ -1750,7 +1750,7 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha)
        uint8_t *sp, *tbuf;
        dma_addr_t p_tbuf;
 
-       tbuf = pci_alloc_consistent(ha->pdev, 8000, &p_tbuf);
+       tbuf = dma_alloc_coherent(&ha->pdev->dev, 8000, &p_tbuf, GFP_KERNEL);
        if (!tbuf)
                return -ENOMEM;
 #endif
@@ -1841,7 +1841,7 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha)
 
  out:
 #if DUMP_IT_BACK
-       pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf);
+       dma_free_coherent(&ha->pdev->dev, 8000, tbuf, p_tbuf);
 #endif
        return err;
 }
@@ -4259,8 +4259,8 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        ha->devnum = devnum;    /* specifies microcode load address */
 
 #ifdef QLA_64BIT_PTR
-       if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(64))) {
-               if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) {
+       if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) {
+               if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
                        printk(KERN_WARNING "scsi(%li): Unable to set a "
                               "suitable DMA mask - aborting\n", ha->host_no);
                        error = -ENODEV;
@@ -4270,7 +4270,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
                dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n",
                        ha->host_no);
 #else
-       if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) {
+       if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
                printk(KERN_WARNING "scsi(%li): Unable to set a "
                       "suitable DMA mask - aborting\n", ha->host_no);
                error = -ENODEV;
@@ -4278,17 +4278,17 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        }
 #endif
 
-       ha->request_ring = pci_alloc_consistent(ha->pdev,
+       ha->request_ring = dma_alloc_coherent(&ha->pdev->dev,
                        ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)),
-                       &ha->request_dma);
+                       &ha->request_dma, GFP_KERNEL);
        if (!ha->request_ring) {
                printk(KERN_INFO "qla1280: Failed to get request memory\n");
                goto error_put_host;
        }
 
-       ha->response_ring = pci_alloc_consistent(ha->pdev,
+       ha->response_ring = dma_alloc_coherent(&ha->pdev->dev,
                        ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)),
-                       &ha->response_dma);
+                       &ha->response_dma, GFP_KERNEL);
        if (!ha->response_ring) {
                printk(KERN_INFO "qla1280: Failed to get response memory\n");
                goto error_free_request_ring;
@@ -4370,11 +4370,11 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        release_region(host->io_port, 0xff);
 #endif
  error_free_response_ring:
-       pci_free_consistent(ha->pdev,
+       dma_free_coherent(&ha->pdev->dev,
                        ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)),
                        ha->response_ring, ha->response_dma);
  error_free_request_ring:
-       pci_free_consistent(ha->pdev,
+       dma_free_coherent(&ha->pdev->dev,
                        ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)),
                        ha->request_ring, ha->request_dma);
  error_put_host:
@@ -4404,10 +4404,10 @@ qla1280_remove_one(struct pci_dev *pdev)
        release_region(host->io_port, 0xff);
 #endif
 
-       pci_free_consistent(ha->pdev,
+       dma_free_coherent(&ha->pdev->dev,
                        ((REQUEST_ENTRY_CNT + 1) * (sizeof(request_t))),
                        ha->request_ring, ha->request_dma);
-       pci_free_consistent(ha->pdev,
+       dma_free_coherent(&ha->pdev->dev,
                        ((RESPONSE_ENTRY_CNT + 1) * (sizeof(struct response))),
                        ha->response_ring, ha->response_dma);