Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1358168pxb; Sun, 22 Aug 2021 14:29:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylt1ZH/ic3S9WoOFsD2SGKTJRx3dzNQqWBH6mhNM+uUf883uKVT0WyWbkga+TEVNdcprk+ X-Received: by 2002:a05:6402:2810:: with SMTP id h16mr5144206ede.133.1629667775465; Sun, 22 Aug 2021 14:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629667775; cv=none; d=google.com; s=arc-20160816; b=0vvQDuEgVk23itL4JUlwmfZYVagM+xFvbB3Xca7hHZTHtoyCDxK+RVcr+UdqdJoFSN S9DUt4MUNYbCbFyiN6mhwSAPk+HTf4bCUluyYi5Qo29eCt6GM5uRzyMsu/rQ27pjbISz kKLispx16cIEq4RJULacvkuoH+YKZlqjxvd65KgpKToeo9xfuDiAkrLHPTrp5htkPcjY /cTAuQkA9W8GX1xpPOkmBxCV09YfM4bOMxoetxBKYFOrqXY5QhWTO2ANgeZBjk98pt0N jQJnC+H1BNsGX+E4fcu8ymYx3jjDBErDbPw6u5lx8EC5qitNhCgHDkCx9mJYZ4tzjgRc 366A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tjMkbMM84ZDkvLRjz8He9fO80+96niu4QKf/9SCJ2gA=; b=m+OYBTMzOBqkjyHC/J5zldvpEEFzWq4rkSLA2i96DQy8pXQNcquV089CVsuFDcStGf tuISRmCSRr4AvulosioNDrjeP5F3Z1/4v0wfsINumECS7Yjsqb1aIwMUmoAntDKDSYwT A/fKltkIfxCcssoGB+aes3Y49xNPYcQMmBSIqevw9KnwwhwpDdtbs9INs1+XUZV6Xtqr 8g+bkSA4x2324Wy5aZhBgWlO4vb9W+mBBwntFXgrdnGzyCH929NivufHSiX6L7FBnDTA ojmh4bF7CrRAAHBPVM3Fi4zLkthJJ6UTTQTQ1mZquAge3XRB65gMmqBSjtbut2xkLwq8 GOCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk30si5734910ejc.270.2021.08.22.14.29.12; Sun, 22 Aug 2021 14:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232619AbhHVV1z (ORCPT + 99 others); Sun, 22 Aug 2021 17:27:55 -0400 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:37867 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232539AbhHVV1z (ORCPT ); Sun, 22 Aug 2021 17:27:55 -0400 Received: from pop-os.home ([90.126.253.178]) by mwinf5d51 with ME id klTC250053riaq203lTCv3; Sun, 22 Aug 2021 23:27:12 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 22 Aug 2021 23:27:12 +0200 X-ME-IP: 90.126.253.178 From: Christophe JAILLET To: airlied@linux.ie, daniel@ffwll.ch Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] drm/r128: switch from 'pci_' to 'dma_' API Date: Sun, 22 Aug 2021 23:27:10 +0200 Message-Id: <46ccdd7bffdba1273a1ebb3d6cd2fbe186e0795a.1629667572.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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