[PATCH 07/28] atp870u: 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 --- drivers/scsi/atp870u.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 8996d2329e11..802d15018ec0 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -1193,7 +1193,7 @@ static void atp870u_free_tables(struct Scsi_Host *host) for (k = 0; k < 16; k++) { if (!atp_dev->id[j][k].prd_table) continue; - pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); + dma_free_coherent(_dev->pdev->dev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); atp_dev->id[j][k].prd_table = NULL; } } @@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) int c,k; for(c=0;c < 2;c++) { for(k=0;k<16;k++) { - atp_dev->id[c][k].prd_table = pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prd_bus)); + atp_dev->id[c][k].prd_table = dma_alloc_coherent(_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), GFP_KERNEL); if (!atp_dev->id[c][k].prd_table) { printk("atp870u_init_tables fail\n"); atp870u_free_tables(host); @@ -1509,7 +1509,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto fail; - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { + if (dma_set_mask(>dev, DMA_BIT_MASK(32))) { printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); err = -EIO; goto disable_device; -- 2.19.1
Re: [PATCH 07/28] atp870u: switch to generic DMA API
On Thu, Oct 11, 2018 at 08:49:42PM +0200, Christoph Hellwig wrote: > Switch from the legacy PCI DMA API to the generic DMA API. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/atp870u.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c > index 8996d2329e11..802d15018ec0 100644 > --- a/drivers/scsi/atp870u.c > +++ b/drivers/scsi/atp870u.c > @@ -1193,7 +1193,7 @@ static void atp870u_free_tables(struct Scsi_Host *host) > for (k = 0; k < 16; k++) { > if (!atp_dev->id[j][k].prd_table) > continue; > - pci_free_consistent(atp_dev->pdev, 1024, > atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); > + dma_free_coherent(_dev->pdev->dev, 1024, > atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); > atp_dev->id[j][k].prd_table = NULL; > } > } > @@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) > int c,k; > for(c=0;c < 2;c++) { > for(k=0;k<16;k++) { > - atp_dev->id[c][k].prd_table = > pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prd_bus)); > + atp_dev->id[c][k].prd_table = > dma_alloc_coherent(_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), > GFP_KERNEL); > if (!atp_dev->id[c][k].prd_table) { > printk("atp870u_init_tables fail\n"); > atp870u_free_tables(host); This looks ugly, but so does the rest, Reviewed-by: Johannes Thumshirn -- Johannes ThumshirnSUSE Labs jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[PATCH 07/28] atp870u: switch to generic DMA API
Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig --- drivers/scsi/atp870u.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 8996d2329e11..802d15018ec0 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -1193,7 +1193,7 @@ static void atp870u_free_tables(struct Scsi_Host *host) for (k = 0; k < 16; k++) { if (!atp_dev->id[j][k].prd_table) continue; - pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); + dma_free_coherent(_dev->pdev->dev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); atp_dev->id[j][k].prd_table = NULL; } } @@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) int c,k; for(c=0;c < 2;c++) { for(k=0;k<16;k++) { - atp_dev->id[c][k].prd_table = pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prd_bus)); + atp_dev->id[c][k].prd_table = dma_alloc_coherent(_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), GFP_KERNEL); if (!atp_dev->id[c][k].prd_table) { printk("atp870u_init_tables fail\n"); atp870u_free_tables(host); @@ -1509,7 +1509,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto fail; - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { + if (dma_set_mask(>dev, DMA_BIT_MASK(32))) { printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); err = -EIO; goto disable_device; -- 2.19.1