Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- drivers/scsi/csiostor/csio_init.c | 7 ++----- drivers/scsi/csiostor/csio_lnode.c | 6 +++--- drivers/scsi/csiostor/csio_scsi.c | 12 ++++++------ drivers/scsi/csiostor/csio_wr.c | 17 +++++++++-------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c index ed2dae657964..aa04e4a7aed5 100644 --- a/drivers/scsi/csiostor/csio_init.c +++ b/drivers/scsi/csiostor/csio_init.c @@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars) pci_set_master(pdev); pci_try_set_mwi(pdev); - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); - } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - } else { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { dev_err(&pdev->dev, "No suitable DMA available.\n"); goto err_release_regions; } diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c index cc5611efc7a9..66e58f0a75dc 100644 --- a/drivers/scsi/csiostor/csio_lnode.c +++ b/drivers/scsi/csiostor/csio_lnode.c @@ -1845,8 +1845,8 @@ csio_ln_fdmi_init(struct csio_lnode *ln) /* Allocate Dma buffers for FDMI response Payload */ dma_buf = &ln->mgmt_req->dma_buf; dma_buf->len = 2048; - dma_buf->vaddr = pci_alloc_consistent(hw->pdev, dma_buf->len, - &dma_buf->paddr); + dma_buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, dma_buf->len, + &dma_buf->paddr, GFP_KERNEL); if (!dma_buf->vaddr) { csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n"); kfree(ln->mgmt_req); @@ -1873,7 +1873,7 @@ csio_ln_fdmi_exit(struct csio_lnode *ln) dma_buf = &ln->mgmt_req->dma_buf; if (dma_buf->vaddr) - pci_free_consistent(hw->pdev, dma_buf->len, dma_buf->vaddr, + dma_free_coherent(&hw->pdev->dev, dma_buf->len, dma_buf->vaddr, dma_buf->paddr); kfree(ln->mgmt_req); diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c index dab0d3f9bee1..8c15b7acb4b7 100644 --- a/drivers/scsi/csiostor/csio_scsi.c +++ b/drivers/scsi/csiostor/csio_scsi.c @@ -2349,8 +2349,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw, } /* Allocate Dma buffers for DDP */ - ddp_desc->vaddr = pci_alloc_consistent(hw->pdev, unit_size, - &ddp_desc->paddr); + ddp_desc->vaddr = dma_alloc_coherent(&hw->pdev->dev, unit_size, + &ddp_desc->paddr, GFP_KERNEL); if (!ddp_desc->vaddr) { csio_err(hw, "SCSI response DMA buffer (ddp) allocation" @@ -2372,8 +2372,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw, list_for_each(tmp, &scm->ddp_freelist) { ddp_desc = (struct csio_dma_buf *) tmp; tmp = csio_list_prev(tmp); - pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr, - ddp_desc->paddr); + dma_free_coherent(&hw->pdev->dev, ddp_desc->len, + ddp_desc->vaddr, ddp_desc->paddr); list_del_init(&ddp_desc->list); kfree(ddp_desc); } @@ -2399,8 +2399,8 @@ csio_scsi_free_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw) list_for_each(tmp, &scm->ddp_freelist) { ddp_desc = (struct csio_dma_buf *) tmp; tmp = csio_list_prev(tmp); - pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr, - ddp_desc->paddr); + dma_free_coherent(&hw->pdev->dev, ddp_desc->len, + ddp_desc->vaddr, ddp_desc->paddr); list_del_init(&ddp_desc->list); kfree(ddp_desc); } diff --git a/drivers/scsi/csiostor/csio_wr.c b/drivers/scsi/csiostor/csio_wr.c index 5022e82ccc4f..dc12933533d5 100644 --- a/drivers/scsi/csiostor/csio_wr.c +++ b/drivers/scsi/csiostor/csio_wr.c @@ -124,8 +124,8 @@ csio_wr_fill_fl(struct csio_hw *hw, struct csio_q *flq) while (n--) { buf->len = sge->sge_fl_buf_size[sreg]; - buf->vaddr = pci_alloc_consistent(hw->pdev, buf->len, - &buf->paddr); + buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, buf->len, + &buf->paddr, GFP_KERNEL); if (!buf->vaddr) { csio_err(hw, "Could only fill %d buffers!\n", n + 1); return -ENOMEM; @@ -233,7 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize, q = wrm->q_arr[free_idx]; - q->vstart = pci_zalloc_consistent(hw->pdev, qsz, &q->pstart); + q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart, + GFP_KERNEL); if (!q->vstart) { csio_err(hw, "Failed to allocate DMA memory for " @@ -1703,14 +1704,14 @@ csio_wrm_exit(struct csio_wrm *wrm, struct csio_hw *hw) buf = &q->un.fl.bufs[j]; if (!buf->vaddr) continue; - pci_free_consistent(hw->pdev, buf->len, - buf->vaddr, - buf->paddr); + dma_free_coherent(&hw->pdev->dev, + buf->len, buf->vaddr, + buf->paddr); } kfree(q->un.fl.bufs); } - pci_free_consistent(hw->pdev, q->size, - q->vstart, q->pstart); + dma_free_coherent(&hw->pdev->dev, q->size, + q->vstart, q->pstart); } kfree(q); } -- 2.19.1