[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_PYZpwoneV=JvEiTp53U2vT0+Vk=ggKt=srYPSU5PE0SQ@mail.gmail.com>
Date: Mon, 23 Aug 2021 14:45:07 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Dave Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/r128: switch from 'pci_' to 'dma_' API
On Sun, Aug 22, 2021 at 5:34 PM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> The wrappers in include/linux/pci-dma-compat.h should go away.
>
> The patch has been generated with the coccinelle script below.
>
> It has been 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_)
>
> @@
> 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: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Reviewed-by: Alex Deucher <alexander.deucher@....com>
And applied to drm-misc-next.
Alex
> ---
> If needed, see post from Christoph Hellwig on the kernel-janitors ML:
> https://marc.info/?l=kernel-janitors&m=158745678307186&w=4
> ---
> drivers/gpu/drm/r128/ati_pcigart.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/r128/ati_pcigart.c b/drivers/gpu/drm/r128/ati_pcigart.c
> index 0ecccf25a3c7..26001c2de9e9 100644
> --- a/drivers/gpu/drm/r128/ati_pcigart.c
> +++ b/drivers/gpu/drm/r128/ati_pcigart.c
> @@ -99,7 +99,8 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info
> for (i = 0; i < pages; i++) {
> if (!entry->busaddr[i])
> break;
> - pci_unmap_page(pdev, entry->busaddr[i], PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
> + dma_unmap_page(&pdev->dev, entry->busaddr[i],
> + PAGE_SIZE, DMA_BIDIRECTIONAL);
> }
>
> if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
> @@ -134,7 +135,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
> if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
> DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
>
> - if (pci_set_dma_mask(pdev, gart_info->table_mask)) {
> + if (dma_set_mask(&pdev->dev, gart_info->table_mask)) {
> DRM_ERROR("fail to set dma mask to 0x%Lx\n",
> (unsigned long long)gart_info->table_mask);
> ret = -EFAULT;
> @@ -173,9 +174,9 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
> gart_idx = 0;
> for (i = 0; i < pages; i++) {
> /* we need to support large memory configurations */
> - entry->busaddr[i] = pci_map_page(pdev, entry->pagelist[i],
> - 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
> - if (pci_dma_mapping_error(pdev, entry->busaddr[i])) {
> + entry->busaddr[i] = dma_map_page(&pdev->dev, entry->pagelist[i],
> + 0, PAGE_SIZE, DMA_BIDIRECTIONAL);
> + if (dma_mapping_error(&pdev->dev, entry->busaddr[i])) {
> DRM_ERROR("unable to map PCIGART pages!\n");
> drm_ati_pcigart_cleanup(dev, gart_info);
> address = NULL;
> --
> 2.30.2
>
Powered by blists - more mailing lists