All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API
@ 2021-09-18  5:20 Christophe JAILLET
  2021-09-18  9:42 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2021-09-18  5:20 UTC (permalink / raw)
  To: haver, arnd, gregkh; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

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].

Finally, Arnd Bergmann reminded that the documentation was updated 11 years
ago to only describe the modern linux/dma-mapping.h interfaces and mark the
old bus-specific ones as no longer recommended, see commit 216bf58f4092
("Documentation: convert PCI-DMA-mapping.txt to use the generic DMA API").

A coccinelle script has been used to perform the needed transformation
Only relevant parts are given below.

@@ @@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL@@

@@
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;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

[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/

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: Change Subject to be more explicit
    Keep only relevant part of the coccinelle script
    Try to improve the commit message to give some reason of why this change is done
---
 drivers/misc/genwqe/card_utils.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
index 039b923d1d60..1167463f26fb 100644
--- a/drivers/misc/genwqe/card_utils.c
+++ b/drivers/misc/genwqe/card_utils.c
@@ -233,8 +233,8 @@ static void genwqe_unmap_pages(struct genwqe_dev *cd, dma_addr_t *dma_list,
 	struct pci_dev *pci_dev = cd->pci_dev;
 
 	for (i = 0; (i < num_pages) && (dma_list[i] != 0x0); i++) {
-		pci_unmap_page(pci_dev, dma_list[i],
-			       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+		dma_unmap_page(&pci_dev->dev, dma_list[i], PAGE_SIZE,
+			       DMA_BIDIRECTIONAL);
 		dma_list[i] = 0x0;
 	}
 }
@@ -251,12 +251,12 @@ static int genwqe_map_pages(struct genwqe_dev *cd,
 		dma_addr_t daddr;
 
 		dma_list[i] = 0x0;
-		daddr = pci_map_page(pci_dev, page_list[i],
+		daddr = dma_map_page(&pci_dev->dev, page_list[i],
 				     0,	 /* map_offs */
 				     PAGE_SIZE,
-				     PCI_DMA_BIDIRECTIONAL);  /* FIXME rd/rw */
+				     DMA_BIDIRECTIONAL);  /* FIXME rd/rw */
 
-		if (pci_dma_mapping_error(pci_dev, daddr)) {
+		if (dma_mapping_error(&pci_dev->dev, daddr)) {
 			dev_err(&pci_dev->dev,
 				"[%s] err: no dma addr daddr=%016llx!\n",
 				__func__, (long long)daddr);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API
  2021-09-18  5:20 [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
@ 2021-09-18  9:42 ` Arnd Bergmann
  2021-09-18 13:10   ` Christophe JAILLET
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2021-09-18  9:42 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Frank Haverkamp, Arnd Bergmann, gregkh,
	Linux Kernel Mailing List, kernel-janitors

On Sat, Sep 18, 2021 at 7:20 AM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> 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].
>
> Finally, Arnd Bergmann reminded that the documentation was updated 11 years
> ago to only describe the modern linux/dma-mapping.h interfaces and mark the
> old bus-specific ones as no longer recommended, see commit 216bf58f4092
> ("Documentation: convert PCI-DMA-mapping.txt to use the generic DMA API").
...
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

How much is left now overall? Are you getting close enough that the
remaining patches to remove the header can be done as a short series and
merged through Andrew's -mm tree?

       Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API
  2021-09-18  9:42 ` Arnd Bergmann
@ 2021-09-18 13:10   ` Christophe JAILLET
  2021-09-20  7:32     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2021-09-18 13:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: gregkh, Linux Kernel Mailing List, kernel-janitors, Christoph Hellwig

Le 18/09/2021 à 11:42, Arnd Bergmann a écrit :
> On Sat, Sep 18, 2021 at 7:20 AM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>>
>> 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].
>>
>> Finally, Arnd Bergmann reminded that the documentation was updated 11 years
>> ago to only describe the modern linux/dma-mapping.h interfaces and mark the
>> old bus-specific ones as no longer recommended, see commit 216bf58f4092
>> ("Documentation: convert PCI-DMA-mapping.txt to use the generic DMA API").
> ...
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 
> How much is left now overall? Are you getting close enough that the
> remaining patches to remove the header can be done as a short series and
> merged through Andrew's -mm tree?
> 
>         Arnd
> 

Hi,

considering that the 3 patches that you have just review are done, the 
diffsat of what is remaining is:

   32 files changed, 309 insertions(+), 272 deletions(-)


All corresponding patches have already been proposed.
Most of the patches are not that old (i.e. < 1 month)

They all *look* trivial to me, *EXCEPT* the ones for message/fusion.

I've tried to split the latter in small series in the hope of easing review.
Moreover the drivers/message/fusion directory seems to be inactive since 
a few months. I don't know if it is just related to the summer or if 
this code is for some reason stalled.
This is funny, because the very start for me of this clean-up effort was 
related to an issue in memory allocation in message/fusion fixed by 
Christoph Hellwig :)


The details are:


Patches with a Review-by tag
============================
bus: mhi:
 
https://lore.kernel.org/kernel-janitors/bb3dc436fe142309a2334549db782c5ebb80a2be.1625718497.git.christophe.jaillet@wanadoo.fr/

fpga: dfl:
 
https://lore.kernel.org/kernel-janitors/c23cf1cfa058456da69849de22b957c6c414766d.1629643816.git.christophe.jaillet@wanadoo.fr/



Patches waiting for review
==========================
arch: sparc:
 
https://lore.kernel.org/kernel-janitors/aa28186920a1bb964ca03723e482f130cd8e9322.1629663425.git.christophe.jaillet@wanadoo.fr/

agp/intel:
 
https://lore.kernel.org/kernel-janitors/e6b5bc8d1f79955ebba652df3deff6b8b39cc607.1630136212.git.christophe.jaillet@wanadoo.fr/

i2c:
 
https://lore.kernel.org/kernel-janitors/fad542b558afc45496f7a7ba581593cd46e68f7c.1629660967.git.christophe.jaillet@wanadoo.fr/

mt76:
 
https://lore.kernel.org/kernel-janitors/83b2da6ff8a07d576fa3627051daa705aba37a3c.1629617782.git.christophe.jaillet@wanadoo.fr/

rapidio:
 
https://lore.kernel.org/kernel-janitors/20210117133929.563645-1-christophe.jaillet@wanadoo.fr/
    --> Sent a long time ago, should be ping'ed

scsi:
 
https://lore.kernel.org/kernel-janitors/3899b1ed4abac581c30845d82f33ec6df8b38976.1629633207.git.christophe.jaillet@wanadoo.fr/

media: v4l2-pci-skeleton:
 
https://lore.kernel.org/kernel-janitors/7191e316ea3b61b6a015d063d2b068a9f4a965aa.1630230428.git.christophe.jaillet@wanadoo.fr/
    --> Unsure if the one I sent the patch to is the correct one.
        get_maintainer.pl is of no help here

message/fusion:
 
https://lore.kernel.org/kernel-janitors/cover.1623617903.git.christophe.jaillet@wanadoo.fr/
 
https://lore.kernel.org/kernel-janitors/db56a78d7d04b809abd32a6fb4839d698587bf7c.1623580326.git.christophe.jaillet@wanadoo.fr/
 
https://lore.kernel.org/kernel-janitors/cover.1623579808.git.christophe.jaillet@wanadoo.fr/
 
https://lore.kernel.org/kernel-janitors/cover.1623571676.git.christophe.jaillet@wanadoo.fr/
    --> these series are a bit more tricky. See each cover letter


Patches that could be applied as-is, but which received comments
================================================================
drivers: dma:
 
https://lore.kernel.org/kernel-janitors/547fae4abef1ca3bf2198ca68e6c361b4d02f13c.1629635852.git.christophe.jaillet@wanadoo.fr/
    --> Need to be rework because Andy Shevchenko (intel) wants some 
additional clean-up.
        Setting 64 bits DMA mask can't fail, so some code is dead and 
should be removed.
        I think that it could (should ?) be done in another step

drm/i915:
 
https://lore.kernel.org/kernel-janitors/dbf1018fb773785e0b3b40e601246ed6438e645e.1629666258.git.christophe.jaillet@wanadoo.fr/
    --> The original code was apparently weird
    --> I'm not sure on what do do. Send a v2 (which would be a blind 
fix)? Send a serie? Wait for Robin Murphy to "do what needs to be done"?
        I think that it could (should ?) be done in another step



Patches that I need to resend
=============================
arch: alpha:
 
https://lore.kernel.org/kernel-janitors/18ab2b83b05b50a00ef673e320c8ddc0d19f099a.1630230112.git.christophe.jaillet@wanadoo.fr/
    --> subject is broken (s/sparc/alpha/)
    --> I will send a v2 to fix it


Let me know what is the best way to finally end this clean-up which 
started a *long* time ago. (see [1])

CJ

[1]: 
https://lore.kernel.org/kernel-janitors/20200421081257.GA131897@infradead.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API
  2021-09-18 13:10   ` Christophe JAILLET
@ 2021-09-20  7:32     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-09-20  7:32 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Arnd Bergmann, gregkh, Linux Kernel Mailing List,
	kernel-janitors, Christoph Hellwig, Andrew Morton

On Sat, Sep 18, 2021 at 3:10 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

>
> considering that the 3 patches that you have just review are done, the
> diffsat of what is remaining is:
>
>    32 files changed, 309 insertions(+), 272 deletions(-)
>
>
> All corresponding patches have already been proposed.
> Most of the patches are not that old (i.e. < 1 month)
>
> They all *look* trivial to me, *EXCEPT* the ones for message/fusion.

Agreed, nice work getting this far!

> I've tried to split the latter in small series in the hope of easing review.
> Moreover the drivers/message/fusion directory seems to be inactive since
> a few months. I don't know if it is just related to the summer or if
> this code is for some reason stalled.
> This is funny, because the very start for me of this clean-up effort was
> related to an issue in memory allocation in message/fusion fixed by
> Christoph Hellwig :)

It is fairly old code that predates the git history, with the last two
device IDs
added in 2007 and 2011, so I would not expect it to be very active.
It's also part of the SCSI subsystem, so I think you just need to resend
it to the scsi maintainers (cc the listed driver maintainers) asking for it to
get merged unless the maintainers have a specific objection.

Once the fusion-mpt stuff is merged, I'd call it endgame and suggest
you send the remaining 12 patches and the removal of the header file
as a series to Andrew Morton, Cc all the driver maintainers to give them
a final notice: each maintainer can then either apply their trivial patch
for linux-next, or Andrew applies it, with the header removal coming last.

         Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-20  7:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18  5:20 [PATCH v2] misc: genwqe: Remove usage of the deprecated "pci-dma-compat.h" API Christophe JAILLET
2021-09-18  9:42 ` Arnd Bergmann
2021-09-18 13:10   ` Christophe JAILLET
2021-09-20  7:32     ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.