Skip to contentSkip to conversation

rbtree: Replace kernel.h with the necessary inclusions

PATCH Applied Andy Shevchenko 3 participants 3 messages Jun 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbtree: Replace kernel.h with the necessary inclusions

When kernel.h is used in the headers it adds a lot into dependency hell, especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

---
 include/linux/rbtree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rbtree.h +1 -1
index 235047d7a1b5..f7edca369eda 100644
@@ -17,9 +17,9 @@
 #ifndef	_LINUX_RBTREE_H
 #define	_LINUX_RBTREE_H
 
+#include <linux/container_of.h>
 #include <linux/rbtree_types.h>
 
-#include <linux/kernel.h>
 #include <linux/stddef.h>
 #include <linux/rcupdate.h>
 
Signature · 1 line
2.35.1
#1 lore raw
Quoted 4 lines · On Fri, 3 Jun 2022 20:10:12 +0300 Andy Shevchenko…

When kernel.h is used in the headers it adds a lot into dependency hell, especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

There are surely thousands of files we could do this with. Is this the start of a lifelong project, or is there something special about rbtree.h?

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Fri, 3 Jun 2022 20:10:12 +0300 Andy Shevchenko…

When kernel.h is used in the headers it adds a lot into dependency hell, especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

There are surely thousands of files we could do this with.

Yes, but the idea is to touch only (global / generic) headers to clean up them from kernel.h.

Quoted 2 lines

Is this the
start of a lifelong project,

Continuation of something which annoys me for a long time. We have not so many, btw, files that are generic and include kernel.h in the include/*.

Quoted 2 lines

or is there something special about
rbtree.h?

Nothing except that header being included in many other modules.

I believe this work goes in conjunction with Ingo's huge clean up series. Not sure where it's now.

Signature · 2 lines
With Best Regards,
Andy Shevchenko