diff options
author | Christoph Hellwig <hch@lst.de> | 2018-10-11 10:02:55 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-10-17 21:58:51 -0400 |
commit | 3a21986f1a5974d3d4d1489840188e2349ec7911 (patch) | |
tree | 13c4177b5ee4b3e33adb67e9b01c85758bbab253 | |
parent | 8c6f803fd66e28dfe01f51d1c0b5b9188980ba58 (diff) | |
download | op-kernel-dev-3a21986f1a5974d3d4d1489840188e2349ec7911.zip op-kernel-dev-3a21986f1a5974d3d4d1489840188e2349ec7911.tar.gz |
scsi: aic94xx: fully convert to the generic DMA API
The driver is currently using an odd mix of legacy PCI DMA API and
generic DMA API calls, switch it over to the generic API entirely.
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>
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_init.c | 9 | ||||
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_task.c | 46 |
2 files changed, 25 insertions, 30 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 1391e5f..41c4d8a 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -771,13 +771,8 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) goto Err_remove; err = -ENODEV; - if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64)) - && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64))) - ; - else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32)) - && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32))) - ; - else { + if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) || + dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) { asd_printk("no suitable DMA mask for %s\n", pci_name(dev)); goto Err_remove; } diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c index cdd4ab6..7fea344 100644 --- a/drivers/scsi/aic94xx/aic94xx_task.c +++ b/drivers/scsi/aic94xx/aic94xx_task.c @@ -42,13 +42,13 @@ static void asd_can_dequeue(struct asd_ha_struct *asd_ha, int num) spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); } -/* PCI_DMA_... to our direction translation. +/* DMA_... to our direction translation. */ static const u8 data_dir_flags[] = { - [PCI_DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ - [PCI_DMA_TODEVICE] = DATA_DIR_OUT, /* OUTBOUND */ - [PCI_DMA_FROMDEVICE] = DATA_DIR_IN, /* INBOUND */ - [PCI_DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ + [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */ + [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */ + [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */ + [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */ }; static int asd_map_scatterlist(struct sas_task *task, @@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task, struct scatterlist *sc; int num_sg, res; - if (task->data_dir == PCI_DMA_NONE) + if (task->data_dir == DMA_NONE) return 0; if (task->num_scatter == 0) { void *p = task->scatter; - dma_addr_t dma = pci_map_single(asd_ha->pcidev, p, + dma_addr_t dma = dma_map_single(&asd_ha->pcidev->dev, p, task->total_xfer_len, task->data_dir); sg_arr[0].bus_addr = cpu_to_le64((u64)dma); @@ -79,7 +79,7 @@ static int asd_map_scatterlist(struct sas_task *task, if (sas_protocol_ata(task->task_proto)) num_sg = task->num_scatter; else - num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, + num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter, task->num_scatter, task->data_dir); if (num_sg == 0) return -ENOMEM; @@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task, return 0; err_unmap: if (sas_protocol_ata(task->task_proto)) - pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, - task->data_dir); + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, + task->num_scatter, task->data_dir); return res; } @@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb) struct asd_ha_struct *asd_ha = ascb->ha; struct sas_task *task = ascb->uldd_task; - if (task->data_dir == PCI_DMA_NONE) + if (task->data_dir == DMA_NONE) return; if (task->num_scatter == 0) { dma_addr_t dma = (dma_addr_t) le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr); - pci_unmap_single(ascb->ha->pcidev, dma, task->total_xfer_len, - task->data_dir); + dma_unmap_single(&ascb->ha->pcidev->dev, dma, + task->total_xfer_len, task->data_dir); return; } asd_free_coherent(asd_ha, ascb->sg_arr); if (task->task_proto != SAS_PROTOCOL_STP) - pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, - task->data_dir); + dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter, + task->num_scatter, task->data_dir); } /* ---------- Task complete tasklet ---------- */ @@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, struct domain_device *dev = task->dev; struct scb *scb; - pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1, - PCI_DMA_TODEVICE); - pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1, - PCI_DMA_FROMDEVICE); + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1, + DMA_TO_DEVICE); + dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1, + DMA_FROM_DEVICE); scb = ascb->scb; @@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a) struct sas_task *task = a->uldd_task; BUG_ON(!task); - pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1, - PCI_DMA_TODEVICE); - pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1, - PCI_DMA_FROMDEVICE); + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1, + DMA_TO_DEVICE); + dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1, + DMA_FROM_DEVICE); } /* ---------- SSP ---------- */ |