Skip to contentSkip to conversation

Fix the implicit declaration of function `swiotlb_init' warning, by including

Xen-changelog Muli Ben-Yehuda 2 participants 3 messages Mar 21, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c line 49

Quoted 12 lines · Xen patchbot -unstable

diff -r a013fa6ee37c -r 14c26df4f33c linux-2.6-xen-sparse/arch/i386/mm/init-xen.c

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c +5 -0
@@ -42,6 +42,11 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/hypervisor.h>
+#if defined(CONFIG_SWIOTLB)
+#include <linux/dma-mapping.h>
+#include <asm/scatterlist.h>
+#include <asm/swiotlb.h>
+#endif

Hmm, the right way(TM) to do it is as follows (compile tested only). We're firmly in nit-picking territory, but it's one less thing that will be pointed out when we finally submit it for upstream inclusion.

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c +2 -4
diff -r 045bee6e1ebd linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
@@ -29,6 +29,8 @@
 #include <linux/efi.h>
 #include <linux/memory_hotplug.h>
 #include <linux/initrd.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -42,11 +44,7 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/hypervisor.h>
-#if defined(CONFIG_SWIOTLB)
-#include <linux/dma-mapping.h>
-#include <asm/scatterlist.h>
 #include <asm/swiotlb.h>
-#endif
 
 extern unsigned long *contiguous_bitmap;
 
Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
#2 lore raw
Quoted 35 lines · Muli Ben-Yehuda

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c line 49

Quoted 12 lines · Xen patchbot -unstable

diff -r a013fa6ee37c -r 14c26df4f33c linux-2.6-xen-sparse/arch/i386/mm/init-xen.c

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c +5 -0
@@ -42,6 +42,11 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/hypervisor.h>
+#if defined(CONFIG_SWIOTLB)
+#include <linux/dma-mapping.h>
+#include <asm/scatterlist.h>
+#include <asm/swiotlb.h>
+#endif

Hmm, the right way(TM) to do it is as follows (compile tested only). We're firmly in nit-picking territory, but it's one less thing that will be pointed out when we finally submit it for upstream inclusion.

diff -r 045bee6e1ebd linux-2.6-xen-sparse/arch/i386/mm/init-xen.c

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c +2 -0
@@ -29,6 +29,8 @@
 #include <linux/efi.h>
 #include <linux/memory_hotplug.h>
 #include <linux/initrd.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>

linux-2.6-xen-sparse/arch/i386/mm/init-xen.c line 49

Quoted 10 lines
linux-2.6-xen-sparse/arch/i386/mm/init-xen.c +0 -4
@@ -42,11 +44,7 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/hypervisor.h>
-#if defined(CONFIG_SWIOTLB)
-#include <linux/dma-mapping.h>
-#include <asm/scatterlist.h>
 #include <asm/swiotlb.h>
-#endif
 
 extern unsigned long *contiguous_bitmap;

Why, dare I ask?

Ewan.

#3 lore raw
Quoted 2 lines · Ewan Mellor

Why, dare I ask?

There are two conventions here: no #ifdefs in C files if possible, and #include <linux/xxx> comes before #include <asm/xxx>. The first one helps readability and maintainability, the second one helps readability and stems from letting arch specific include files overrride generic include files.

But really, it's just the accepted kernel idiom, and if we want upstream inclusion, it pays to play by the rules.

Cheers,
Muli

Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/