Commit d1e8c52a authored by Suraj Upadhyay's avatar Suraj Upadhyay Committed by Greg Kroah-Hartman

staging: comedi: s626: Remove pci-dma-compat wrapper APIs.

The legacy API wrappers in include/linux/pci-dma-compat.h
should go away as it creates unnecessary midlayering
for include/linux/dma-mapping.h APIs, instead use dma-mapping.h
APIs directly.

The patch has been generated with the coccinelle script below
and compile-tested.

@@@@
- 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_ATOMIC)

@@ expression E1, E2, E3; @@
- pci_zalloc_consistent(E1, E2, E3)
+ dma_alloc_coherent(&E1->dev, E2, E3, GFP_ATOMIC)

@@ 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, (enum dma_data_direction)E4)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_single(E1, E2, E3, E4)
+ dma_unmap_single(&E1->dev, E2, E3, (enum dma_data_direction)E4)

@@ expression E1, E2, E3, E4, E5; @@
- pci_map_page(E1, E2, E3, E4, E5)
+ dma_map_page(&E1->dev, E2, E3, E4, (enum dma_data_direction)E5)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_page(E1, E2, E3, E4)
+ dma_unmap_page(&E1->dev, E2, E3, (enum dma_data_direction)E4)

@@ expression E1, E2, E3, E4; @@
- pci_map_sg(E1, E2, E3, E4)
+ dma_map_sg(&E1->dev, E2, E3, (enum dma_data_direction)E4)

@@ expression E1, E2, E3, E4; @@
- pci_unmap_sg(E1, E2, E3, E4)
+ dma_unmap_sg(&E1->dev, E2, E3, (enum dma_data_direction)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, (enum dma_data_direction)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, (enum dma_data_direction)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, (enum dma_data_direction)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, (enum dma_data_direction)E4)

@@ expression E1, E2; @@
- pci_dma_mapping_error(E1, E2)
+ dma_mapping_error(&E1->dev, E2)

@@ expression E1, E2; @@
- pci_set_consistent_dma_mask(E1, E2)
+ dma_set_coherent_mask(&E1->dev, E2)

@@ expression E1, E2; @@
- pci_set_dma_mask(E1, E2)
+ dma_set_mask(&E1->dev, E2)
Signed-off-by: default avatarSuraj Upadhyay <usuraj35@gmail.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200713143253.GA14953@blackclownSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e5f7325
...@@ -2130,13 +2130,15 @@ static int s626_allocate_dma_buffers(struct comedi_device *dev) ...@@ -2130,13 +2130,15 @@ static int s626_allocate_dma_buffers(struct comedi_device *dev)
void *addr; void *addr;
dma_addr_t appdma; dma_addr_t appdma;
addr = pci_alloc_consistent(pcidev, S626_DMABUF_SIZE, &appdma); addr = dma_alloc_coherent(&pcidev->dev, S626_DMABUF_SIZE, &appdma,
GFP_KERNEL);
if (!addr) if (!addr)
return -ENOMEM; return -ENOMEM;
devpriv->ana_buf.logical_base = addr; devpriv->ana_buf.logical_base = addr;
devpriv->ana_buf.physical_base = appdma; devpriv->ana_buf.physical_base = appdma;
addr = pci_alloc_consistent(pcidev, S626_DMABUF_SIZE, &appdma); addr = dma_alloc_coherent(&pcidev->dev, S626_DMABUF_SIZE, &appdma,
GFP_KERNEL);
if (!addr) if (!addr)
return -ENOMEM; return -ENOMEM;
devpriv->rps_buf.logical_base = addr; devpriv->rps_buf.logical_base = addr;
...@@ -2154,11 +2156,11 @@ static void s626_free_dma_buffers(struct comedi_device *dev) ...@@ -2154,11 +2156,11 @@ static void s626_free_dma_buffers(struct comedi_device *dev)
return; return;
if (devpriv->rps_buf.logical_base) if (devpriv->rps_buf.logical_base)
pci_free_consistent(pcidev, S626_DMABUF_SIZE, dma_free_coherent(&pcidev->dev, S626_DMABUF_SIZE,
devpriv->rps_buf.logical_base, devpriv->rps_buf.logical_base,
devpriv->rps_buf.physical_base); devpriv->rps_buf.physical_base);
if (devpriv->ana_buf.logical_base) if (devpriv->ana_buf.logical_base)
pci_free_consistent(pcidev, S626_DMABUF_SIZE, dma_free_coherent(&pcidev->dev, S626_DMABUF_SIZE,
devpriv->ana_buf.logical_base, devpriv->ana_buf.logical_base,
devpriv->ana_buf.physical_base); devpriv->ana_buf.physical_base);
} }
......
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