Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Don't include linux/irq.h from asm/hardirq.h

The next patch in this series will have to make the definition of
irq_cpustat_t available to entering_irq().

Inclusion of asm/hardirq.h into asm/apic.h would cause circular header
dependencies like

asm/smp.h
asm/apic.h
asm/hardirq.h
linux/irq.h
linux/topology.h
linux/smp.h
asm/smp.h

or

linux/gfp.h
linux/mmzone.h
asm/mmzone.h
asm/mmzone_64.h
asm/smp.h
asm/apic.h
asm/hardirq.h
linux/irq.h
linux/irqdesc.h
linux/kobject.h
linux/sysfs.h
linux/kernfs.h
linux/idr.h
linux/gfp.h

and others.

This causes compilation errors because of the header guards becoming
effective in the second inclusion: symbols/macros that had been defined
before wouldn't be available to intermediate headers in the #include chain
anymore.

A possible workaround would be to move the definition of irq_cpustat_t
into its own header and include that from both, asm/hardirq.h and
asm/apic.h.

However, this wouldn't solve the real problem, namely asm/harirq.h
unnecessarily pulling in all the linux/irq.h cruft: nothing in
asm/hardirq.h itself requires it. Also, note that there are some other
archs, like e.g. arm64, which don't have that #include in their
asm/hardirq.h.

Remove the linux/irq.h #include from x86' asm/hardirq.h.

Fix resulting compilation errors by adding appropriate #includes to *.c
files as needed.

Note that some of these *.c files could be cleaned up a bit wrt. to their
set of #includes, but that should better be done from separate patches, if
at all.

Signed-off-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Nicolai Stange and committed by
Thomas Gleixner
447ae316 45b575c0

+22 -2
+1 -1
arch/x86/include/asm/dmi.h
··· 4 4 5 5 #include <linux/compiler.h> 6 6 #include <linux/init.h> 7 + #include <linux/io.h> 7 8 8 - #include <asm/io.h> 9 9 #include <asm/setup.h> 10 10 11 11 static __always_inline __init void *dmi_alloc(unsigned len)
-1
arch/x86/include/asm/hardirq.h
··· 3 3 #define _ASM_X86_HARDIRQ_H 4 4 5 5 #include <linux/threads.h> 6 - #include <linux/irq.h> 7 6 8 7 typedef struct { 9 8 u16 __softirq_pending;
+1
arch/x86/include/asm/kvm_host.h
··· 17 17 #include <linux/tracepoint.h> 18 18 #include <linux/cpumask.h> 19 19 #include <linux/irq_work.h> 20 + #include <linux/irq.h> 20 21 21 22 #include <linux/kvm.h> 22 23 #include <linux/kvm_para.h>
+1
arch/x86/kernel/apic/apic.c
··· 56 56 #include <asm/hypervisor.h> 57 57 #include <asm/cpu_device_id.h> 58 58 #include <asm/intel-family.h> 59 + #include <asm/irq_regs.h> 59 60 60 61 unsigned int num_processors; 61 62
+1
arch/x86/kernel/apic/io_apic.c
··· 33 33 34 34 #include <linux/mm.h> 35 35 #include <linux/interrupt.h> 36 + #include <linux/irq.h> 36 37 #include <linux/init.h> 37 38 #include <linux/delay.h> 38 39 #include <linux/sched.h>
+1
arch/x86/kernel/apic/msi.c
··· 12 12 */ 13 13 #include <linux/mm.h> 14 14 #include <linux/interrupt.h> 15 + #include <linux/irq.h> 15 16 #include <linux/pci.h> 16 17 #include <linux/dmar.h> 17 18 #include <linux/hpet.h>
+1
arch/x86/kernel/apic/vector.c
··· 11 11 * published by the Free Software Foundation. 12 12 */ 13 13 #include <linux/interrupt.h> 14 + #include <linux/irq.h> 14 15 #include <linux/seq_file.h> 15 16 #include <linux/init.h> 16 17 #include <linux/compiler.h>
+1
arch/x86/kernel/fpu/core.c
··· 10 10 #include <asm/fpu/signal.h> 11 11 #include <asm/fpu/types.h> 12 12 #include <asm/traps.h> 13 + #include <asm/irq_regs.h> 13 14 14 15 #include <linux/hardirq.h> 15 16 #include <linux/pkeys.h>
+1
arch/x86/kernel/hpet.c
··· 1 1 #include <linux/clocksource.h> 2 2 #include <linux/clockchips.h> 3 3 #include <linux/interrupt.h> 4 + #include <linux/irq.h> 4 5 #include <linux/export.h> 5 6 #include <linux/delay.h> 6 7 #include <linux/errno.h>
+1
arch/x86/kernel/i8259.c
··· 5 5 #include <linux/sched.h> 6 6 #include <linux/ioport.h> 7 7 #include <linux/interrupt.h> 8 + #include <linux/irq.h> 8 9 #include <linux/timex.h> 9 10 #include <linux/random.h> 10 11 #include <linux/init.h>
+1
arch/x86/kernel/idt.c
··· 8 8 #include <asm/traps.h> 9 9 #include <asm/proto.h> 10 10 #include <asm/desc.h> 11 + #include <asm/hw_irq.h> 11 12 12 13 struct idt_data { 13 14 unsigned int vector;
+1
arch/x86/kernel/irq.c
··· 10 10 #include <linux/ftrace.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/export.h> 13 + #include <linux/irq.h> 13 14 14 15 #include <asm/apic.h> 15 16 #include <asm/io_apic.h>
+1
arch/x86/kernel/irq_32.c
··· 11 11 12 12 #include <linux/seq_file.h> 13 13 #include <linux/interrupt.h> 14 + #include <linux/irq.h> 14 15 #include <linux/kernel_stat.h> 15 16 #include <linux/notifier.h> 16 17 #include <linux/cpu.h>
+1
arch/x86/kernel/irq_64.c
··· 11 11 12 12 #include <linux/kernel_stat.h> 13 13 #include <linux/interrupt.h> 14 + #include <linux/irq.h> 14 15 #include <linux/seq_file.h> 15 16 #include <linux/delay.h> 16 17 #include <linux/ftrace.h>
+1
arch/x86/kernel/irqinit.c
··· 5 5 #include <linux/sched.h> 6 6 #include <linux/ioport.h> 7 7 #include <linux/interrupt.h> 8 + #include <linux/irq.h> 8 9 #include <linux/timex.h> 9 10 #include <linux/random.h> 10 11 #include <linux/kprobes.h>
+1
arch/x86/kernel/smpboot.c
··· 80 80 #include <asm/intel-family.h> 81 81 #include <asm/cpu_device_id.h> 82 82 #include <asm/spec-ctrl.h> 83 + #include <asm/hw_irq.h> 83 84 84 85 /* representing HT siblings of each logical CPU */ 85 86 DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
+1
arch/x86/kernel/time.c
··· 12 12 13 13 #include <linux/clockchips.h> 14 14 #include <linux/interrupt.h> 15 + #include <linux/irq.h> 15 16 #include <linux/i8253.h> 16 17 #include <linux/time.h> 17 18 #include <linux/export.h>
+1
arch/x86/mm/pti.c
··· 45 45 #include <asm/pgalloc.h> 46 46 #include <asm/tlbflush.h> 47 47 #include <asm/desc.h> 48 + #include <asm/sections.h> 48 49 49 50 #undef pr_fmt 50 51 #define pr_fmt(fmt) "Kernel/User page tables isolation: " fmt
+1
arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
··· 18 18 #include <asm/intel-mid.h> 19 19 #include <asm/intel_scu_ipc.h> 20 20 #include <asm/io_apic.h> 21 + #include <asm/hw_irq.h> 21 22 22 23 #define TANGIER_EXT_TIMER0_MSI 12 23 24
+1
arch/x86/xen/enlighten.c
··· 3 3 #endif 4 4 #include <linux/cpu.h> 5 5 #include <linux/kexec.h> 6 + #include <linux/slab.h> 6 7 7 8 #include <xen/features.h> 8 9 #include <xen/page.h>
+1
drivers/gpu/drm/i915/i915_pmu.c
··· 4 4 * Copyright © 2017-2018 Intel Corporation 5 5 */ 6 6 7 + #include <linux/irq.h> 7 8 #include "i915_pmu.h" 8 9 #include "intel_ringbuffer.h" 9 10 #include "i915_drv.h"
+1
drivers/gpu/drm/i915/intel_lpe_audio.c
··· 62 62 63 63 #include <linux/acpi.h> 64 64 #include <linux/device.h> 65 + #include <linux/irq.h> 65 66 #include <linux/pci.h> 66 67 #include <linux/pm_runtime.h> 67 68
+1
drivers/pci/controller/pci-hyperv.c
··· 45 45 #include <linux/irqdomain.h> 46 46 #include <asm/irqdomain.h> 47 47 #include <asm/apic.h> 48 + #include <linux/irq.h> 48 49 #include <linux/msi.h> 49 50 #include <linux/hyperv.h> 50 51 #include <linux/refcount.h>