linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: arnd@arndb.de, hch@infradead.org, akpm@linux-foundation.org,
	rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com
Cc: linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 01/16] alpha: Remove usage of the deprecated "pci-dma-compat.h" API
Date: Thu,  6 Jan 2022 22:46:52 +0100	[thread overview]
Message-ID: <30686538ee42aaa4c2dd0788c42edbc6df07f250.1641500561.git.christophe.jaillet@wanadoo.fr> (raw)
In-Reply-To: <cover.1641500561.git.christophe.jaillet@wanadoo.fr>

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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
---
Reviewed in: https://lore.kernel.org/kernel-janitors/CAK8P3a2XwFveAd8nSCexZG3_UZga2PQ+EXHxQLGaWkLjCwrBxQ@mail.gmail.com/
---
 arch/alpha/include/asm/floppy.h |  7 ++++---
 arch/alpha/kernel/pci_iommu.c   | 12 ++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 8dfdb3aa1d96..588758685439 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -43,17 +43,18 @@ alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
 	static int prev_dir;
 	int dir;
 
-	dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
+	dir = (mode != DMA_MODE_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 
 	if (bus_addr 
 	    && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
 		/* different from last time -- unmap prev */
-		pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir);
+		dma_unmap_single(&isa_bridge->dev, bus_addr, prev_size,
+				 prev_dir);
 		bus_addr = 0;
 	}
 
 	if (!bus_addr)	/* need to map it */
-		bus_addr = pci_map_single(isa_bridge, addr, size, dir);
+		bus_addr = dma_map_single(&isa_bridge->dev, addr, size, dir);
 
 	/* remember this one as prev */
 	prev_addr = addr;
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 21f9ac101324..e83a02ed5267 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -333,7 +333,7 @@ static dma_addr_t alpha_pci_map_page(struct device *dev, struct page *page,
 	struct pci_dev *pdev = alpha_gendev_to_pci(dev);
 	int dac_allowed;
 
-	BUG_ON(dir == PCI_DMA_NONE);
+	BUG_ON(dir == DMA_NONE);
 
 	dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0; 
 	return pci_map_single_1(pdev, (char *)page_address(page) + offset, 
@@ -356,7 +356,7 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
 	struct pci_iommu_arena *arena;
 	long dma_ofs, npages;
 
-	BUG_ON(dir == PCI_DMA_NONE);
+	BUG_ON(dir == DMA_NONE);
 
 	if (dma_addr >= __direct_map_base
 	    && dma_addr < __direct_map_base + __direct_map_size) {
@@ -460,7 +460,7 @@ static void alpha_pci_free_coherent(struct device *dev, size_t size,
 				    unsigned long attrs)
 {
 	struct pci_dev *pdev = alpha_gendev_to_pci(dev);
-	pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
+	dma_unmap_single(&pdev->dev, dma_addr, size, DMA_BIDIRECTIONAL);
 	free_pages((unsigned long)cpu_addr, get_order(size));
 
 	DBGA2("pci_free_consistent: [%llx,%zx] from %ps\n",
@@ -639,7 +639,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
 	dma_addr_t max_dma;
 	int dac_allowed;
 
-	BUG_ON(dir == PCI_DMA_NONE);
+	BUG_ON(dir == DMA_NONE);
 
 	dac_allowed = dev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
 
@@ -702,7 +702,7 @@ static int alpha_pci_map_sg(struct device *dev, struct scatterlist *sg,
 	/* Some allocation failed while mapping the scatterlist
 	   entries.  Unmap them now.  */
 	if (out > start)
-		pci_unmap_sg(pdev, start, out - start, dir);
+		dma_unmap_sg(&pdev->dev, start, out - start, dir);
 	return -ENOMEM;
 }
 
@@ -722,7 +722,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
 	dma_addr_t max_dma;
 	dma_addr_t fbeg, fend;
 
-	BUG_ON(dir == PCI_DMA_NONE);
+	BUG_ON(dir == DMA_NONE);
 
 	if (! alpha_mv.mv_pci_tbi)
 		return;
-- 
2.32.0


  reply	other threads:[~2022-01-06 21:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 21:45 [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
2022-01-06 21:46 ` Christophe JAILLET [this message]
2022-01-10  8:43   ` [PATCH 01/16] alpha: " Christoph Hellwig
2022-01-06 21:47 ` [PATCH 02/16] floppy: " Christophe JAILLET
2022-01-10  8:43   ` Christoph Hellwig
2022-01-06 21:49 ` [PATCH 03/16] fpga: dfl: pci: " Christophe JAILLET
2022-01-06 23:06   ` Arnd Bergmann
2022-01-07  0:58     ` Arnd Bergmann
2022-01-07  6:34       ` Christophe JAILLET
2022-01-10  8:44   ` Christoph Hellwig
2022-01-06 21:50 ` [PATCH 04/16] media: " Christophe JAILLET
2022-01-07  0:51   ` Arnd Bergmann
2022-01-07  7:10     ` Mauro Carvalho Chehab
2022-02-18 13:11       ` Hans Verkuil
2022-01-10  8:44   ` Christoph Hellwig
2022-01-06 21:51 ` [PATCH 05/16] agp/intel: " Christophe JAILLET
2022-01-07  0:53   ` Arnd Bergmann
2022-01-10  8:45   ` Christoph Hellwig
2022-01-06 21:51 ` [PATCH 06/16] sparc: " Christophe JAILLET
2022-01-07  0:54   ` Arnd Bergmann
2022-01-07 11:04   ` David Miller
2022-01-10  8:45   ` Christoph Hellwig
2022-01-06 21:52 ` [PATCH 07/16] dmaengine: pch_dma: " Christophe JAILLET
2022-01-07  0:56   ` Arnd Bergmann
2022-01-08 16:47     ` Vinod Koul
2022-01-10  8:45   ` Christoph Hellwig
2022-01-06 21:52 ` [PATCH 08/16] rapidio/tsi721: " Christophe JAILLET
2022-01-07  1:00   ` Arnd Bergmann
2022-01-10  8:46   ` Christoph Hellwig
2022-01-06 21:53 ` [PATCH 09/16] media: v4l2-pci-skeleton: " Christophe JAILLET
2022-01-07  1:01   ` Arnd Bergmann
2022-01-10  8:46   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 10/16] scsi: message: fusion: " Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 11/16] scsi: mptbase: Use dma_alloc_coherent() in 'mpt_alloc_fw_memory()' Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 12/16] scsi: mptbase: Use dma_alloc_coherent() Christophe JAILLET
2022-01-10  8:47   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 13/16] scsi: mptsas: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 14/16] scsi: mptsas: Use dma_alloc_coherent() Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-06 21:54 ` [PATCH 15/16] scsi: mptctl: " Christophe JAILLET
2022-01-10  8:48   ` Christoph Hellwig
2022-01-06 21:55 ` [PATCH 16/16] PCI: Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
2022-01-06 22:28   ` Bjorn Helgaas
2022-01-07  6:34     ` Christophe JAILLET
2022-01-07 17:23       ` Marion & Christophe JAILLET
2022-01-10  8:49         ` Christoph Hellwig
2022-01-10 15:35 ` [PATCH 00/16] " Martin K. Petersen
2022-01-19  4:06 ` Martin K. Petersen
2022-01-25 19:28 ` Moritz Fischer
2022-02-23  7:46 ` Christoph Hellwig
     [not found]   ` <ddf6010e-417d-8da7-8e11-1b4a55f92fff@wanadoo.fr>
     [not found]     ` <YhckzJp5/x9zW4uQ@infradead.org>
     [not found]       ` <CAK8P3a23Pjm1Btc=mXX=vU4hkNiPqz3+o4=j0FuYKHB7KuMtPg@mail.gmail.com>
2022-02-24 18:15         ` Christophe JAILLET
2022-02-25 16:20 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30686538ee42aaa4c2dd0788c42edbc6df07f250.1641500561.git.christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hch@infradead.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).