Skip to contentSkip to conversation

Circular include dependencies

RFC Russell King 3 participants 3 messages May 23, 2008 – May 26, 2008

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

Hi,

Having discovered some circular include dependencies in the ARM header files which were causing build issues, I created a script to walk ARM includes and report any similar issues found - which includes traversing any referenced linux/ includes.

It identified the following two in include/linux/:

linux/mmzone.h <- linux/memory_hotplug.h <- linux/mmzone.h linux/mmzone.h <- linux/topology.h <- linux/mmzone.h

Checking them by hand reveals that these are real. Whether they're capable of causing a problem or not, I'm not going to comment on. However, they're not a good idea and someone should probably look at resolving the loops.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
maintainer
#1 lore raw
Quoted 9 lines · On Fri, 23 May 2008 14:20:34 +0100 Russell King <[email protected]>…

Hi,

Having discovered some circular include dependencies in the ARM header files which were causing build issues, I created a script to walk ARM includes and report any similar issues found - which includes traversing any referenced linux/ includes.

It identified the following two in include/linux/:

Quoted 7 lines

linux/mmzone.h <- linux/memory_hotplug.h <- linux/mmzone.h linux/mmzone.h <- linux/topology.h <- linux/mmzone.h

Checking them by hand reveals that these are real. Whether they're capable of causing a problem or not, I'm not going to comment on. However, they're not a good idea and someone should probably look at resolving the loops.

(cc's added).

Thanks.

I'm not sure who we could tap for the topology.h one.

A suitable (and often good) way of solving this is to identify the things which a.h needs from b.h and hoist them out into a new c.h and include that from both a.h and b.h.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 21 lines · On Fri, 23 May 2008 14:20:34 +0100 Russell King <[email protected]>…
Quoted 10 lines

Hi,

Having discovered some circular include dependencies in the ARM header files which were causing build issues, I created a script to walk ARM includes and report any similar issues found - which includes traversing any referenced linux/ includes.

It identified the following two in include/linux/:

Quoted 7 lines

linux/mmzone.h <- linux/memory_hotplug.h <- linux/mmzone.h linux/mmzone.h <- linux/topology.h <- linux/mmzone.h

Checking them by hand reveals that these are real. Whether they're capable of causing a problem or not, I'm not going to comment on. However, they're not a good idea and someone should probably look at resolving the loops.

(cc's added).

Quoted 7 lines

Thanks.

I'm not sure who we could tap for the topology.h one.

A suitable (and often good) way of solving this is to identify the things which a.h needs from b.h and hoist them out into a new c.h and include that from both a.h and b.h.

Kame-san and I reviewed memory_hotplug.h. We found its including was not necessary certainly.

This is the patch to fix it. I tested on IA64, and checked cross-compile on powerpc. Kame-san tested this on x86-64.

Thanks for your report.

Bye.

----
Fix no need including of mmzone.h in memory_hotplug.h

---
 include/linux/memory_hotplug.h |    1 -
 1 file changed, 1 deletion(-)
include/linux/memory_hotplug.h +0 -1
Index: dptest/include/linux/memory_hotplug.h
===================================================================
@@ -1,7 +1,6 @@
 #ifndef __LINUX_MEMORY_HOTPLUG_H
 #define __LINUX_MEMORY_HOTPLUG_H
 
-#include <linux/mmzone.h>
 #include <linux/spinlock.h>
 #include <linux/notifier.h>
 
Signature · 8 lines
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>