Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1355606pxb; Sun, 22 Aug 2021 14:24:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd1ayFq+K9RCa4uInHG2N1oan9dH/wAqm+DMnIwiD5Lq5rtbDf4tXThSF4AdnCYnf4JgSx X-Received: by 2002:a05:6402:50:: with SMTP id f16mr33378065edu.346.1629667486941; Sun, 22 Aug 2021 14:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629667486; cv=none; d=google.com; s=arc-20160816; b=opOAH9gl1uHL3qgjKsJ5I25MSnnnO21iQFvg1Cqe2DpbySrkKYqe4+BqgTc5ufmhIt 1HS80lSQZ8FIUFu2hGXBvTmZ82Vc6tTq5wa5anNqFTfI3LH9yzb4flxfVh38eDWl0gsw VhB0N60AUHsacxGcY5+pTgpa9xhXMe8dizhJ+b3xSqYt/QEseFOsGdm978ir9p6srb+G iDRl6D3GiTzd0i96z4UM8CnSYvs9lVTxC9TkJZ1uzkTnWyLbjOtHjRep88qq+8vM+Sla +dGOZq7pXhVJ89L/ly65Qev18QQvl5dzuDzhOMSp6bZraCO07TIPxB1VTMbIdjauxDDi Lgmg== 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=w6e4Lfv/8ZzAQ+mxKuVdgU43HJA7YbAKnhyY33f2AQI=; b=WpKVag042a1na2KANe6Ki+sLa4R5kG8tURAtaUWg511xwdpQwXGfzfP3SmdI0saWx2 AMmKynuUyUMZImXtap/FSiLQYh/15ddMLE1jlc1mo21zKwtLjF5Zr5Jyo3rGTpYyyHzd kLE1xL0aeuFnB/xlWjHkhZEiG+lmRbjGywNIhDF5YLOP9pEQ2vzLq5k8wOtMLTajuKb8 Rx5eIwfMbwWO1GdI9P4d67DceURJV7mBJ6Au3biwyO9BLka3arsKy0YFgeXLhgWlNP9B oYiu3HujaGGygF2psLvNiPzuWDt6cBy6QlFNrHr4ZhwwR7F9EfOIId6Qtwty0LAEDHrq kL4Q== 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 g16si1018347edb.129.2021.08.22.14.24.22; Sun, 22 Aug 2021 14:24:46 -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 S233045AbhHVVWa (ORCPT + 99 others); Sun, 22 Aug 2021 17:22:30 -0400 Received: from out02.smtpout.orange.fr ([193.252.22.211]:60568 "EHLO out.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232539AbhHVVW2 (ORCPT ); Sun, 22 Aug 2021 17:22:28 -0400 Received: from pop-os.home ([90.126.253.178]) by mwinf5d51 with ME id klMk250043riaq203lMkgB; Sun, 22 Aug 2021 23:21:45 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 22 Aug 2021 23:21:45 +0200 X-ME-IP: 90.126.253.178 From: Christophe JAILLET To: alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] drm/amdgpu: switch from 'pci_' to 'dma_' API Date: Sun, 22 Aug 2021 23:21:43 +0200 Message-Id: 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/amd/amdgpu/amdgpu_gart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index b36405170ff3..76efd5f8950f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c @@ -76,7 +76,7 @@ static int amdgpu_gart_dummy_page_init(struct amdgpu_device *adev) if (adev->dummy_page_addr) return 0; adev->dummy_page_addr = dma_map_page(&adev->pdev->dev, dummy_page, 0, - PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); + PAGE_SIZE, DMA_BIDIRECTIONAL); if (dma_mapping_error(&adev->pdev->dev, adev->dummy_page_addr)) { dev_err(&adev->pdev->dev, "Failed to DMA MAP the dummy page\n"); adev->dummy_page_addr = 0; @@ -96,8 +96,8 @@ void amdgpu_gart_dummy_page_fini(struct amdgpu_device *adev) { if (!adev->dummy_page_addr) return; - pci_unmap_page(adev->pdev, adev->dummy_page_addr, - PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); + dma_unmap_page(&adev->pdev->dev, adev->dummy_page_addr, PAGE_SIZE, + DMA_BIDIRECTIONAL); adev->dummy_page_addr = 0; } -- 2.30.2