Commit ffecba83 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Christoph Hellwig
Browse files

agp/intel: Remove usage of the deprecated "pci-dma-compat.h" API

In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.

Some reasons why this API should be removed have been given by Julia
Lawall in [2].

A coccinelle script has been used to perform the needed transformation.
It can be found in [3].

[1]: https://lore.kernel.org/kernel-janitors/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/20200716192821.321233-1-christophe.jaillet@wanadoo.fr/



Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 06cc5cf1
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -111,8 +111,8 @@ static int intel_gtt_map_memory(struct page **pages,
	for_each_sg(st->sgl, sg, num_entries, i)
		sg_set_page(sg, pages[i], PAGE_SIZE, 0);

	if (!pci_map_sg(intel_private.pcidev,
			st->sgl, st->nents, PCI_DMA_BIDIRECTIONAL))
	if (!dma_map_sg(&intel_private.pcidev->dev, st->sgl, st->nents,
			DMA_BIDIRECTIONAL))
		goto err;

	return 0;
@@ -127,8 +127,8 @@ static void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg)
	struct sg_table st;
	DBG("try unmapping %lu pages\n", (unsigned long)mem->page_count);

	pci_unmap_sg(intel_private.pcidev, sg_list,
		     num_sg, PCI_DMA_BIDIRECTIONAL);
	dma_unmap_sg(&intel_private.pcidev->dev, sg_list, num_sg,
		     DMA_BIDIRECTIONAL);

	st.sgl = sg_list;
	st.orig_nents = st.nents = num_sg;
@@ -303,9 +303,9 @@ static int intel_gtt_setup_scratch_page(void)
	set_pages_uc(page, 1);

	if (intel_private.needs_dmar) {
		dma_addr = pci_map_page(intel_private.pcidev, page, 0,
				    PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
		if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) {
		dma_addr = dma_map_page(&intel_private.pcidev->dev, page, 0,
					PAGE_SIZE, DMA_BIDIRECTIONAL);
		if (dma_mapping_error(&intel_private.pcidev->dev, dma_addr)) {
			__free_page(page);
			return -EINVAL;
		}
@@ -552,9 +552,9 @@ static void intel_gtt_teardown_scratch_page(void)
{
	set_pages_wb(intel_private.scratch_page, 1);
	if (intel_private.needs_dmar)
		pci_unmap_page(intel_private.pcidev,
			       intel_private.scratch_page_dma,
			       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
		dma_unmap_page(&intel_private.pcidev->dev,
			       intel_private.scratch_page_dma, PAGE_SIZE,
			       DMA_BIDIRECTIONAL);
	__free_page(intel_private.scratch_page);
}

@@ -1412,12 +1412,12 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,

	if (bridge) {
		mask = intel_private.driver->dma_mask_size;
		if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask)))
		if (dma_set_mask(&intel_private.pcidev->dev, DMA_BIT_MASK(mask)))
			dev_err(&intel_private.pcidev->dev,
				"set gfx device dma mask %d-bit failed!\n",
				mask);
		else
			pci_set_consistent_dma_mask(intel_private.pcidev,
			dma_set_coherent_mask(&intel_private.pcidev->dev,
					      DMA_BIT_MASK(mask));
	}