Commit 8a9e71e0 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Mauro Carvalho Chehab

media: ttpci: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below and has been
hand modified to replace GFP_ with a correct flag.
It has been compile tested.

When memory is allocated in 'av7110_attach()' GFP_KERNEL can be used
because this flag is already used above in the same function and no lock is
taken in the between.

@@
@@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL

@@
@@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE

@@
@@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE

@@
@@
-    PCI_DMA_NONE
+    DMA_NONE

@@
expression e1, e2, e3;
@@
-    pci_alloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
-    pci_zalloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
-    pci_free_consistent(e1, e2, e3, e4)
+    dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
-    pci_map_page(e1, e2, e3, e4, e5)
+    dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_page(e1, e2, e3, e4)
+    dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_sg(e1, e2, e3, e4)
+    dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_sg(e1, e2, e3, e4)
+    dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_device(e1, e2, e3, e4)
+    dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_consistent_dma_mask(e1, e2)
+    dma_set_coherent_mask(&e1->dev, e2)
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 0c5a71dc
...@@ -1250,7 +1250,8 @@ static void vpeirq(struct tasklet_struct *t) ...@@ -1250,7 +1250,8 @@ static void vpeirq(struct tasklet_struct *t)
return; return;
/* Ensure streamed PCI data is synced to CPU */ /* Ensure streamed PCI data is synced to CPU */
pci_dma_sync_sg_for_cpu(budget->dev->pci, budget->pt.slist, budget->pt.nents, PCI_DMA_FROMDEVICE); dma_sync_sg_for_cpu(&budget->dev->pci->dev, budget->pt.slist,
budget->pt.nents, DMA_FROM_DEVICE);
#if 0 #if 0
/* track rps1 activity */ /* track rps1 activity */
...@@ -2637,7 +2638,8 @@ static int av7110_attach(struct saa7146_dev* dev, ...@@ -2637,7 +2638,8 @@ static int av7110_attach(struct saa7146_dev* dev,
av7110->arm_thread = NULL; av7110->arm_thread = NULL;
/* allocate and init buffers */ /* allocate and init buffers */
av7110->debi_virt = pci_alloc_consistent(pdev, 8192, &av7110->debi_bus); av7110->debi_virt = dma_alloc_coherent(&pdev->dev, 8192,
&av7110->debi_bus, GFP_KERNEL);
if (!av7110->debi_virt) if (!av7110->debi_virt)
goto err_saa71466_vfree_4; goto err_saa71466_vfree_4;
...@@ -2726,7 +2728,8 @@ static int av7110_attach(struct saa7146_dev* dev, ...@@ -2726,7 +2728,8 @@ static int av7110_attach(struct saa7146_dev* dev,
err_iobuf_vfree_6: err_iobuf_vfree_6:
vfree(av7110->iobuf); vfree(av7110->iobuf);
err_pci_free_5: err_pci_free_5:
pci_free_consistent(pdev, 8192, av7110->debi_virt, av7110->debi_bus); dma_free_coherent(&pdev->dev, 8192, av7110->debi_virt,
av7110->debi_bus);
err_saa71466_vfree_4: err_saa71466_vfree_4:
if (av7110->grabbing) if (av7110->grabbing)
saa7146_vfree_destroy_pgtable(pdev, av7110->grabbing, &av7110->pt); saa7146_vfree_destroy_pgtable(pdev, av7110->grabbing, &av7110->pt);
...@@ -2779,8 +2782,8 @@ static int av7110_detach(struct saa7146_dev* saa) ...@@ -2779,8 +2782,8 @@ static int av7110_detach(struct saa7146_dev* saa)
av7110_av_exit(av7110); av7110_av_exit(av7110);
vfree(av7110->iobuf); vfree(av7110->iobuf);
pci_free_consistent(saa->pci, 8192, av7110->debi_virt, dma_free_coherent(&saa->pci->dev, 8192, av7110->debi_virt,
av7110->debi_bus); av7110->debi_bus);
i2c_del_adapter(&av7110->i2c_adap); i2c_del_adapter(&av7110->i2c_adap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment