Skip to content

Commit 4d431b1

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: a100u2w: 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> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 17a361b commit 4d431b1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

drivers/scsi/a100u2w.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ static int inia100_probe_one(struct pci_dev *pdev,
10941094

10951095
if (pci_enable_device(pdev))
10961096
goto out;
1097-
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
1097+
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
10981098
printk(KERN_WARNING "Unable to set 32bit DMA "
10991099
"on inia100 adapter, ignoring.\n");
11001100
goto out_disable_device;
@@ -1124,15 +1124,17 @@ static int inia100_probe_one(struct pci_dev *pdev,
11241124

11251125
/* Get total memory needed for SCB */
11261126
sz = ORC_MAXQUEUE * sizeof(struct orc_scb);
1127-
host->scb_virt = pci_zalloc_consistent(pdev, sz, &host->scb_phys);
1127+
host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys,
1128+
GFP_KERNEL);
11281129
if (!host->scb_virt) {
11291130
printk("inia100: SCB memory allocation error\n");
11301131
goto out_host_put;
11311132
}
11321133

11331134
/* Get total memory needed for ESCB */
11341135
sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);
1135-
host->escb_virt = pci_zalloc_consistent(pdev, sz, &host->escb_phys);
1136+
host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys,
1137+
GFP_KERNEL);
11361138
if (!host->escb_virt) {
11371139
printk("inia100: ESCB memory allocation error\n");
11381140
goto out_free_scb_array;
@@ -1177,10 +1179,12 @@ static int inia100_probe_one(struct pci_dev *pdev,
11771179
out_free_irq:
11781180
free_irq(shost->irq, shost);
11791181
out_free_escb_array:
1180-
pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
1182+
dma_free_coherent(&pdev->dev,
1183+
ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
11811184
host->escb_virt, host->escb_phys);
11821185
out_free_scb_array:
1183-
pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb),
1186+
dma_free_coherent(&pdev->dev,
1187+
ORC_MAXQUEUE * sizeof(struct orc_scb),
11841188
host->scb_virt, host->scb_phys);
11851189
out_host_put:
11861190
scsi_host_put(shost);
@@ -1200,9 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev)
12001204
scsi_remove_host(shost);
12011205

12021206
free_irq(shost->irq, shost);
1203-
pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
1207+
dma_free_coherent(&pdev->dev,
1208+
ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
12041209
host->escb_virt, host->escb_phys);
1205-
pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb),
1210+
dma_free_coherent(&pdev->dev,
1211+
ORC_MAXQUEUE * sizeof(struct orc_scb),
12061212
host->scb_virt, host->scb_phys);
12071213
release_region(shost->io_port, 256);
12081214

0 commit comments

Comments
 (0)