Subject: Re: linux-next: build failure after merge of the final tree (jdelvare-hwmon tree related)

From: Jean Delvare <[email-masked]>
Date: Thu, 17 Mar 2011 16:36:21 +0100

On Thu, 17 Mar 2011 13:18:00 +0100, Geert Uytterhoeven wrote:
> On Tue, Mar 15, 2011 at 11:22, Stephen Rothwell <[email-masked]> wrote:
> > On Tue, 15 Mar 2011 10:32:28 +0100 Jean Delvare <[email-masked]> wrote:
> >> Stephen, sorry for the inconvenience, both Hans and myself build-tested
> >> the new code on an architecture where <linux/delay.h> gets included
> >> implicitly, so we didn't notice it was missing.
> >
> > It happens.  It seems that delay.h is almost always the one that is
> > forgotten.  X86 builds include it implicitly but powerpc doesn't.
> >
> > I wonder if we could concoct a nice checkpatch test for it.
> 
> Or remove the implicit includes on x86...
> 
> $ git grep delay\\.h arch/x86/include/
> arch/x86/include/asm/apic.h:#include <linux/delay.h>
> arch/x86/include/asm/dma.h:#include <linux/delay.h>
> arch/x86/include/asm/i8259.h:#include <linux/delay.h>
> $
> 
> At first sight, apic.h and dmah.h don't seem to need it.

Something like this?

* * * * *

Stop including <linux/delay.h> in x86 header files which don't need
it. This will let the compiler complain when this header is not
included by source files when it should, so that contributors can fix
the problem before building on other architectures starts to fail.

Credits go to Geert for the idea.

Signed-off-by: Jean Delvare <[email-masked]>
Cc: Geert Uytterhoeven <[email-masked]>
Cc: Stephen Rothwell <[email-masked]>
---
 arch/x86/include/asm/apic.h        |    1 -
 arch/x86/include/asm/dma.h         |    1 -
 arch/x86/kernel/apic/hw_nmi.c      |    1 +
 arch/x86/kernel/apic/x2apic_uv_x.c |    1 +
 arch/x86/kernel/irq.c              |    1 +
 arch/x86/kernel/reboot.c           |    1 +
 arch/x86/platform/uv/tlb_uv.c      |    1 +
 drivers/scsi/ultrastor.c           |    1 +
 8 files changed, 6 insertions(+), 2 deletions(-)

--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -2,7 +2,6 @@
 #define _ASM_X86_APIC_H
 
 #include <linux/cpumask.h>
-#include <linux/delay.h>
 #include <linux/pm.h>
 
 #include <asm/alternative.h>
--- a/arch/x86/include/asm/dma.h
+++ b/arch/x86/include/asm/dma.h
@@ -10,7 +10,6 @@
 
 #include <linux/spinlock.h>	/* And spinlocks */
 #include <asm/io.h>		/* need byte IO */
-#include <linux/delay.h>
 
 #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
 #define dma_outb	outb_p
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -16,6 +16,7 @@
 #include <linux/kprobes.h>
 #include <linux/nmi.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
 u64 hw_nmi_get_sample_period(void)
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -23,6 +23,7 @@
 #include <linux/io.h>
 #include <linux/pci.h>
 #include <linux/kdebug.h>
+#include <linux/delay.h>
 
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -8,6 +8,7 @@
 #include <linux/seq_file.h>
 #include <linux/smp.h>
 #include <linux/ftrace.h>
+#include <linux/delay.h>
 
 #include <asm/apic.h>
 #include <asm/io_apic.h>
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -6,6 +6,7 @@
 #include <linux/dmi.h>
 #include <linux/sched.h>
 #include <linux/tboot.h>
+#include <linux/delay.h>
 #include <acpi/reboot.h>
 #include <asm/io.h>
 #include <asm/apic.h>
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -11,6 +11,7 @@
 #include <linux/debugfs.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 
 #include <asm/mmu_context.h>
 #include <asm/uv/uv.h>
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -138,6 +138,7 @@
 #include <linux/spinlock.h>
 #include <linux/stat.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/system.h>

-- 
Jean Delvare