Skip to contentSkip to conversation

kfifo: don't include dma-mapping.h in kfifo.h

PATCH In review Christoph Hellwig 4 participants 4 messages Oct 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kfifo: don't include dma-mapping.h in kfifo.h

Nothing in kfifo.h directly needs dma-mapping.h, only two macros use DMA_MAPPING_ERROR when actually instantiated. Drop the dma-mapping.h include to reduce include bloat.

Add an explicity <linux/io.h> include to drivers/mailbox/omap-mailbox.c as that file uses __raw_readl and __raw_writel through a complicated include chain involving <linux/dma-mapping.h>

Fixes d52b761e4b1a ("kfifo: add kfifo_dma_out_prepare_mapped()")

---

Changes since v1:
- improve the commit log

 drivers/mailbox/omap-mailbox.c | 1 +
 include/linux/kfifo.h          | 1 -
 samples/kfifo/dma-example.c    | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)
drivers/mailbox/omap-mailbox.c +1 -0
index 6797770474a5..680243751d62 100644
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/kfifo.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
include/linux/kfifo.h +0 -1
index 564868bdce89..fd743d4c4b4b 100644
@@ -37,7 +37,6 @@
  */
 
 #include <linux/array_size.h>
-#include <linux/dma-mapping.h>
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
samples/kfifo/dma-example.c +1 -0
index 48df719dac8c..8076ac410161 100644
@@ -9,6 +9,7 @@
 #include <linux/kfifo.h>
 #include <linux/module.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-mapping.h>
 
 /*
  * This module shows how to handle fifo dma operations.
Signature · 1 line
2.45.2
#1 lore raw
Quoted 8 lines · Christoph Hellwig

Nothing in kfifo.h directly needs dma-mapping.h, only two macros use DMA_MAPPING_ERROR when actually instantiated. Drop the dma-mapping.h include to reduce include bloat.

Add an explicity <linux/io.h> include to drivers/mailbox/omap-mailbox.c as that file uses __raw_readl and __raw_writel through a complicated include chain involving <linux/dma-mapping.h>

Quoted 6 lines
Fixes d52b761e4b1a ("kfifo: add kfifo_dma_out_prepare_mapped()")

---

Changes since v1:
- improve the commit log

As the original commit came in through the tty tree, I'll take this through the same tree as well.

thanks,

greg k-h

#2 lore raw
In reply to Christoph Hellwig
Quoted 25 lines · Christoph Hellwig

Nothing in kfifo.h directly needs dma-mapping.h, only two macros use DMA_MAPPING_ERROR when actually instantiated. Drop the dma-mapping.h include to reduce include bloat.

Add an explicity <linux/io.h> include to drivers/mailbox/omap-mailbox.c as that file uses __raw_readl and __raw_writel through a complicated include chain involving <linux/dma-mapping.h>

Fixes d52b761e4b1a ("kfifo: add kfifo_dma_out_prepare_mapped()")

---

Changes since v1:
- improve the commit log

  drivers/mailbox/omap-mailbox.c | 1 +
  include/linux/kfifo.h          | 1 -
  samples/kfifo/dma-example.c    | 1 +
  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/mailbox/omap-mailbox.c +0 -0
index 6797770474a5..680243751d62 100644

drivers/mailbox/omap-mailbox.c line 16

Quoted 2 lines
drivers/mailbox/omap-mailbox.c +0 -0
@@ -15,6 +15,7 @@
  #include <linux/slab.h>
  #include <linux/kfifo.h>

Funnily enough, this driver does not use kfifo since:
commit 3f58c1f4206f37d0af4595a9046c76016334b301

Author: Andrew Davis <[email protected]>
Date:   Wed Apr 10 08:59:42 2024 -0500

mailbox: omap: Remove kernel FIFO message queuing

drivers/mailbox/omap-mailbox.c line 18

Quoted 2 lines
drivers/mailbox/omap-mailbox.c +1 -0
  #include <linux/err.h>
+#include <linux/io.h>

So this should have been revealed at that point (while removing kfifo.h in that commit too).

Perhaps Andrew can remove the include now?

thanks,

Signature · 2 lines
js
suse labs
Acked-by
#3 lore raw
Quoted 34 lines · Jiri Slaby
Quoted 25 lines · Christoph Hellwig

Nothing in kfifo.h directly needs dma-mapping.h, only two macros use DMA_MAPPING_ERROR when actually instantiated.  Drop the dma-mapping.h include to reduce include bloat.

Add an explicity <linux/io.h> include to drivers/mailbox/omap-mailbox.c as that file uses __raw_readl and __raw_writel through a complicated include chain involving <linux/dma-mapping.h>

Fixes d52b761e4b1a ("kfifo: add kfifo_dma_out_prepare_mapped()")

---

Changes since v1:
  - improve the commit log

  drivers/mailbox/omap-mailbox.c | 1 +
  include/linux/kfifo.h          | 1 -
  samples/kfifo/dma-example.c    | 1 +

  3 files changed, 2 insertions(+), 1 deletion(-)
drivers/mailbox/omap-mailbox.c +0 -0
index 6797770474a5..680243751d62 100644

drivers/mailbox/omap-mailbox.c line 16

Quoted 2 lines
drivers/mailbox/omap-mailbox.c +0 -0
@@ -15,6 +15,7 @@
   #include <linux/slab.h>
   #include <linux/kfifo.h>

Funnily enough, this driver does not use kfifo since:
commit 3f58c1f4206f37d0af4595a9046c76016334b301
Author: Andrew Davis <[email protected]>
Date:   Wed Apr 10 08:59:42 2024 -0500

Quoted 9 lines

    mailbox: omap: Remove kernel FIFO message queuing

drivers/mailbox/omap-mailbox.c line 18

Quoted 2 lines
drivers/mailbox/omap-mailbox.c +1 -0
   #include <linux/err.h>
+#include <linux/io.h>

So this should have been revealed at that point (while removing kfifo.h in that commit too).

Perhaps Andrew can remove the include now?

Yes, I'll send a patch dropping kfifo.h (unless you want to just do it as part of this patch).

The addition of io.h is still correct here as we seem to have been including it indirectly before, which is always a bit hacky. So for this patch,

Quoted 1 line

thanks,