From 03676e1d31fa0e156df0caecbacf20b488f7bd3a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 10 Oct 2018 19:55:59 +0200 Subject: [PATCH] scsi: nsp32: switch to generic DMA API Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen --- drivers/scsi/nsp32.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 8620ac5d6e41..5aac3e801903 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -2638,7 +2638,7 @@ static int nsp32_detect(struct pci_dev *pdev) /* * setup DMA */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) != 0) { nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); goto scsi_unregister; } @@ -2646,7 +2646,9 @@ static int nsp32_detect(struct pci_dev *pdev) /* * allocate autoparam DMA resource. */ - data->autoparam = pci_alloc_consistent(pdev, sizeof(nsp32_autoparam), &(data->auto_paddr)); + data->autoparam = dma_alloc_coherent(&pdev->dev, + sizeof(nsp32_autoparam), &(data->auto_paddr), + GFP_KERNEL); if (data->autoparam == NULL) { nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); goto scsi_unregister; @@ -2655,8 +2657,8 @@ static int nsp32_detect(struct pci_dev *pdev) /* * allocate scatter-gather DMA resource. */ - data->sg_list = pci_alloc_consistent(pdev, NSP32_SG_TABLE_SIZE, - &(data->sg_paddr)); + data->sg_list = dma_alloc_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE, + &data->sg_paddr, GFP_KERNEL); if (data->sg_list == NULL) { nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); goto free_autoparam; @@ -2761,11 +2763,11 @@ static int nsp32_detect(struct pci_dev *pdev) free_irq(host->irq, data); free_sg_list: - pci_free_consistent(pdev, NSP32_SG_TABLE_SIZE, + dma_free_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE, data->sg_list, data->sg_paddr); free_autoparam: - pci_free_consistent(pdev, sizeof(nsp32_autoparam), + dma_free_coherent(&pdev->dev, sizeof(nsp32_autoparam), data->autoparam, data->auto_paddr); scsi_unregister: @@ -2780,12 +2782,12 @@ static int nsp32_release(struct Scsi_Host *host) nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata; if (data->autoparam) { - pci_free_consistent(data->Pci, sizeof(nsp32_autoparam), + dma_free_coherent(&data->Pci->dev, sizeof(nsp32_autoparam), data->autoparam, data->auto_paddr); } if (data->sg_list) { - pci_free_consistent(data->Pci, NSP32_SG_TABLE_SIZE, + dma_free_coherent(&data->Pci->dev, NSP32_SG_TABLE_SIZE, data->sg_list, data->sg_paddr); }