Skip to contentSkip to conversation

nvdimm: Remove duplicate linux/slab.h header

PATCH In review Jiapeng Chong 4 participants 5 messages Sep 28, 2025 – Sep 30, 2025 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvdimm: Remove duplicate linux/slab.h header

./drivers/nvdimm/bus.c: linux/slab.h is included more than once.

---
 drivers/nvdimm/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvdimm/bus.c +0 -1
index ad3a0493f474..87178a53ff9c 100644
@@ -13,7 +13,6 @@
 #include <linux/async.h>
 #include <linux/ndctl.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
 #include <linux/io.h>
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 1 line · Jiapeng Chong

./drivers/nvdimm/bus.c: linux/slab.h is included more than once.

Hi Jiapeng,

It would have been useful here to note where else slab.h was included, since it wasn't simply a duplicate #include in bus.c.

I found slab.h is also in #include <linux/fs.h>. Then I found that this compiles if I remove both of those includes. It would be worthwhile to check all the includes and send a new tested version of this patch that does this "Remove needless #include's in bus.c"

BTW - I didn't check all #includes.There may be more beyond slab.h & fs.h.

--Alison

Quoted 24 lines
---
 drivers/nvdimm/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvdimm/bus.c +0 -1
index ad3a0493f474..87178a53ff9c 100644
@@ -13,7 +13,6 @@
 #include <linux/async.h>
 #include <linux/ndctl.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
 #include <linux/io.h>
Signature · 1 line
2.43.5
Reviewed-by
#2 lore raw
Quoted 7 lines · Alison Schofield
Quoted 1 line · Jiapeng Chong

./drivers/nvdimm/bus.c: linux/slab.h is included more than once.

Hi Jiapeng,

It would have been useful here to note where else slab.h was included, since it wasn't simply a duplicate #include in bus.c.

Actually Alison this is a bug against linux-next where it was an issue with Dave's patch here:

https://lore.kernel.org/all/[email protected]/

I'll queue this up.

Thanks,
Ira

Quoted 34 lines

I found slab.h is also in #include <linux/fs.h>. Then I found that this compiles if I remove both of those includes. It would be worthwhile to check all the includes and send a new tested version of this patch that does this "Remove needless #include's in bus.c"

BTW - I didn't check all #includes.There may be more beyond slab.h & fs.h.

--Alison

Quoted 24 lines
---
 drivers/nvdimm/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvdimm/bus.c +0 -1
index ad3a0493f474..87178a53ff9c 100644
@@ -13,7 +13,6 @@
 #include <linux/async.h>
 #include <linux/ndctl.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
 #include <linux/io.h>
Signature · 1 line
2.43.5
maintainer
#3 lore raw
Quoted 6 lines · Ira Weiny
Quoted 5 lines · Alison Schofield
Quoted 1 line · Jiapeng Chong

./drivers/nvdimm/bus.c: linux/slab.h is included more than once.

Hi Jiapeng,

Quoted 7 lines
Quoted 2 lines

It would have been useful here to note where else slab.h was included, since it wasn't simply a duplicate #include in bus.c.

Actually Alison this is a bug against linux-next where it was an issue with Dave's patch here:

https://lore.kernel.org/all/[email protected]/

Ah, I see this removes the dup that the above patch added.

Why not remove fs.h instead of slab.h and get a clean up and de-dup in one shot?

Quoted 44 lines

I'll queue this up.

Thanks,
Ira

Quoted 34 lines

I found slab.h is also in #include <linux/fs.h>. Then I found that this compiles if I remove both of those includes. It would be worthwhile to check all the includes and send a new tested version of this patch that does this "Remove needless #include's in bus.c"

BTW - I didn't check all #includes.There may be more beyond slab.h & fs.h.

--Alison

Quoted 24 lines
---
 drivers/nvdimm/bus.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvdimm/bus.c +0 -1
index ad3a0493f474..87178a53ff9c 100644
@@ -13,7 +13,6 @@
 #include <linux/async.h>
 #include <linux/ndctl.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
 #include <linux/io.h>
Signature · 1 line
2.43.5
#4 lore raw
Quoted 13 lines · Alison Schofield
Quoted 12 lines · Ira Weiny
Quoted 7 lines · Alison Schofield
Quoted 1 line · Jiapeng Chong

./drivers/nvdimm/bus.c: linux/slab.h is included more than once.

Hi Jiapeng,

It would have been useful here to note where else slab.h was included, since it wasn't simply a duplicate #include in bus.c.

Actually Alison this is a bug against linux-next where it was an issue with Dave's patch here:

Quoted 6 lines
Quoted 1 line

https://lore.kernel.org/all/[email protected]/

Ah, I see this removes the dup that the above patch added.

Why not remove fs.h instead of slab.h and get a clean up and de-dup in one shot?

fs.h is included for 'struct file_operations', so no clean up opportunity there. Recall the "include what you use" recommendation:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submit-checklist.rst?id=v6.17-rc7#n17