diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-24 13:08:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-24 13:08:39 -0400 |
commit | ed2d265d1266736bd294332d7f649003943ae36e (patch) | |
tree | 860e5b7bb72933e4a9abacdc2f2d75a0e6254e32 /arch | |
parent | f1d38e423a697b7aa06e12d3ca4753bcc1aa3531 (diff) | |
parent | 6c03438edeb5c359af35f060ea016ca65671c269 (diff) |
Merge tag 'bug-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
Pull <linux/bug.h> cleanup from Paul Gortmaker:
"The changes shown here are to unify linux's BUG support under the one
<linux/bug.h> file. Due to historical reasons, we have some BUG code
in bug.h and some in kernel.h -- i.e. the support for BUILD_BUG in
linux/kernel.h predates the addition of linux/bug.h, but old code in
kernel.h wasn't moved to bug.h at that time. As a band-aid, kernel.h
was including <asm/bug.h> to pseudo link them.
This has caused confusion[1] and general yuck/WTF[2] reactions. Here
is an example that violates the principle of least surprise:
CC lib/string.o
lib/string.c: In function 'strlcat':
lib/string.c:225:2: error: implicit declaration of function 'BUILD_BUG_ON'
make[2]: *** [lib/string.o] Error 1
$
$ grep linux/bug.h lib/string.c
#include <linux/bug.h>
$
We've included <linux/bug.h> for the BUG infrastructure and yet we
still get a compile fail! [We've not kernel.h for BUILD_BUG_ON.] Ugh -
very confusing for someone who is new to kernel development.
With the above in mind, the goals of this changeset are:
1) find and fix any include/*.h files that were relying on the
implicit presence of BUG code.
2) find and fix any C files that were consuming kernel.h and hence
relying on implicitly getting some/all BUG code.
3) Move the BUG related code living in kernel.h to <linux/bug.h>
4) remove the asm/bug.h from kernel.h to finally break the chain.
During development, the order was more like 3-4, build-test, 1-2. But
to ensure that git history for bisect doesn't get needless build
failures introduced, the commits have been reorderd to fix the problem
areas in advance.
[1] https://lkml.org/lkml/2012/1/3/90
[2] https://lkml.org/lkml/2012/1/17/414"
Fix up conflicts (new radeon file, reiserfs header cleanups) as per Paul
and linux-next.
* tag 'bug-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
kernel.h: doesn't explicitly use bug.h, so don't include it.
bug: consolidate BUILD_BUG_ON with other bug code
BUG: headers with BUG/BUG_ON etc. need linux/bug.h
bug.h: add include of it to various implicit C users
lib: fix implicit users of kernel.h for TAINT_WARN
spinlock: macroize assert_spin_locked to avoid bug.h dependency
x86: relocate get/set debugreg fcns to include/asm/debugreg.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/cpu_op-mx51.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-pins.c | 1 | ||||
-rw-r--r-- | arch/avr32/include/asm/io.h | 1 | ||||
-rw-r--r-- | arch/m68k/include/asm/system.h | 1 | ||||
-rw-r--r-- | arch/mips/fw/arc/cmdline.c | 1 | ||||
-rw-r--r-- | arch/mips/fw/arc/identify.c | 1 | ||||
-rw-r--r-- | arch/parisc/math-emu/fpudispatch.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/pmc.c | 1 | ||||
-rw-r--r-- | arch/powerpc/xmon/ppc-opc.c | 1 | ||||
-rw-r--r-- | arch/powerpc/xmon/spu-opc.c | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/vga.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/debugreg.h | 67 | ||||
-rw-r--r-- | arch/x86/include/asm/paravirt.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 63 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/paravirt.c | 1 | ||||
-rw-r--r-- | arch/x86/mm/kmemcheck/selftest.c | 1 |
17 files changed, 82 insertions, 63 deletions
diff --git a/arch/arm/mach-imx/cpu_op-mx51.c b/arch/arm/mach-imx/cpu_op-mx51.c index 9d34c3d4c02..7b92cd6da6d 100644 --- a/arch/arm/mach-imx/cpu_op-mx51.c +++ b/arch/arm/mach-imx/cpu_op-mx51.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * http://www.gnu.org/copyleft/gpl.html | 11 | * http://www.gnu.org/copyleft/gpl.html |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/bug.h> | ||
14 | #include <linux/types.h> | 15 | #include <linux/types.h> |
15 | #include <mach/hardware.h> | 16 | #include <mach/hardware.h> |
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c index 74bfcff2bdf..f5413dca532 100644 --- a/arch/arm/mach-ux500/board-mop500-pins.c +++ b/arch/arm/mach-ux500/board-mop500-pins.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/bug.h> | ||
9 | 10 | ||
10 | #include <asm/mach-types.h> | 11 | #include <asm/mach-types.h> |
11 | #include <plat/pincfg.h> | 12 | #include <plat/pincfg.h> |
diff --git a/arch/avr32/include/asm/io.h b/arch/avr32/include/asm/io.h index 22c97ef9220..cf60d0a9f17 100644 --- a/arch/avr32/include/asm/io.h +++ b/arch/avr32/include/asm/io.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ASM_AVR32_IO_H | 1 | #ifndef __ASM_AVR32_IO_H |
2 | #define __ASM_AVR32_IO_H | 2 | #define __ASM_AVR32_IO_H |
3 | 3 | ||
4 | #include <linux/bug.h> | ||
4 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
5 | #include <linux/string.h> | 6 | #include <linux/string.h> |
6 | #include <linux/types.h> | 7 | #include <linux/types.h> |
diff --git a/arch/m68k/include/asm/system.h b/arch/m68k/include/asm/system.h index 47b01f4726b..8dc68178716 100644 --- a/arch/m68k/include/asm/system.h +++ b/arch/m68k/include/asm/system.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/linkage.h> | 4 | #include <linux/linkage.h> |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/bug.h> | ||
6 | #include <linux/irqflags.h> | 7 | #include <linux/irqflags.h> |
7 | #include <asm/segment.h> | 8 | #include <asm/segment.h> |
8 | #include <asm/entry.h> | 9 | #include <asm/entry.h> |
diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c index 9fdf07e50f1..c0122a1dc58 100644 --- a/arch/mips/fw/arc/cmdline.c +++ b/arch/mips/fw/arc/cmdline.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) | 8 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) |
9 | */ | 9 | */ |
10 | #include <linux/bug.h> | ||
10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
12 | #include <linux/string.h> | 13 | #include <linux/string.h> |
diff --git a/arch/mips/fw/arc/identify.c b/arch/mips/fw/arc/identify.c index 788060a53dc..54a33c756f6 100644 --- a/arch/mips/fw/arc/identify.c +++ b/arch/mips/fw/arc/identify.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) | 12 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) |
13 | */ | 13 | */ |
14 | #include <linux/bug.h> | ||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
diff --git a/arch/parisc/math-emu/fpudispatch.c b/arch/parisc/math-emu/fpudispatch.c index 6e28f9f4c62..673b73e8420 100644 --- a/arch/parisc/math-emu/fpudispatch.c +++ b/arch/parisc/math-emu/fpudispatch.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define FPUDEBUG 0 | 50 | #define FPUDEBUG 0 |
51 | 51 | ||
52 | #include "float.h" | 52 | #include "float.h" |
53 | #include <linux/bug.h> | ||
53 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
54 | #include <asm/processor.h> | 55 | #include <asm/processor.h> |
55 | /* #include <sys/debug.h> */ | 56 | /* #include <sys/debug.h> */ |
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c index a841a9d136a..58eaa3ddf7b 100644 --- a/arch/powerpc/kernel/pmc.c +++ b/arch/powerpc/kernel/pmc.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/bug.h> | ||
16 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
17 | #include <linux/export.h> | 18 | #include <linux/export.h> |
18 | 19 | ||
diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index af3780e52e7..6845e91ba04 100644 --- a/arch/powerpc/xmon/ppc-opc.c +++ b/arch/powerpc/xmon/ppc-opc.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/bug.h> | ||
25 | #include "nonstdio.h" | 26 | #include "nonstdio.h" |
26 | #include "ppc.h" | 27 | #include "ppc.h" |
27 | 28 | ||
diff --git a/arch/powerpc/xmon/spu-opc.c b/arch/powerpc/xmon/spu-opc.c index 530df3d6d7b..7d37597c4bc 100644 --- a/arch/powerpc/xmon/spu-opc.c +++ b/arch/powerpc/xmon/spu-opc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | 19 | 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
20 | 20 | ||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/bug.h> | ||
22 | #include "spu.h" | 23 | #include "spu.h" |
23 | 24 | ||
24 | /* This file holds the Spu opcode table */ | 25 | /* This file holds the Spu opcode table */ |
diff --git a/arch/sparc/include/asm/vga.h b/arch/sparc/include/asm/vga.h index c69d5b2ba19..ec0e9967d93 100644 --- a/arch/sparc/include/asm/vga.h +++ b/arch/sparc/include/asm/vga.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #ifndef _LINUX_ASM_VGA_H_ | 7 | #ifndef _LINUX_ASM_VGA_H_ |
8 | #define _LINUX_ASM_VGA_H_ | 8 | #define _LINUX_ASM_VGA_H_ |
9 | 9 | ||
10 | #include <linux/bug.h> | ||
10 | #include <asm/types.h> | 11 | #include <asm/types.h> |
11 | 12 | ||
12 | #define VT_BUF_HAVE_RW | 13 | #define VT_BUF_HAVE_RW |
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h index b903d5ea394..2d91580bf22 100644 --- a/arch/x86/include/asm/debugreg.h +++ b/arch/x86/include/asm/debugreg.h | |||
@@ -78,8 +78,75 @@ | |||
78 | */ | 78 | */ |
79 | #ifdef __KERNEL__ | 79 | #ifdef __KERNEL__ |
80 | 80 | ||
81 | #include <linux/bug.h> | ||
82 | |||
81 | DECLARE_PER_CPU(unsigned long, cpu_dr7); | 83 | DECLARE_PER_CPU(unsigned long, cpu_dr7); |
82 | 84 | ||
85 | #ifndef CONFIG_PARAVIRT | ||
86 | /* | ||
87 | * These special macros can be used to get or set a debugging register | ||
88 | */ | ||
89 | #define get_debugreg(var, register) \ | ||
90 | (var) = native_get_debugreg(register) | ||
91 | #define set_debugreg(value, register) \ | ||
92 | native_set_debugreg(register, value) | ||
93 | #endif | ||
94 | |||
95 | static inline unsigned long native_get_debugreg(int regno) | ||
96 | { | ||
97 | unsigned long val = 0; /* Damn you, gcc! */ | ||
98 | |||
99 | switch (regno) { | ||
100 | case 0: | ||
101 | asm("mov %%db0, %0" :"=r" (val)); | ||
102 | break; | ||
103 | case 1: | ||
104 | asm("mov %%db1, %0" :"=r" (val)); | ||
105 | break; | ||
106 | case 2: | ||
107 | asm("mov %%db2, %0" :"=r" (val)); | ||
108 | break; | ||
109 | case 3: | ||
110 | asm("mov %%db3, %0" :"=r" (val)); | ||
111 | break; | ||
112 | case 6: | ||
113 | asm("mov %%db6, %0" :"=r" (val)); | ||
114 | break; | ||
115 | case 7: | ||
116 | asm("mov %%db7, %0" :"=r" (val)); | ||
117 | break; | ||
118 | default: | ||
119 | BUG(); | ||
120 | } | ||
121 | return val; | ||
122 | } | ||
123 | |||
124 | static inline void native_set_debugreg(int regno, unsigned long value) | ||
125 | { | ||
126 | switch (regno) { | ||
127 | case 0: | ||
128 | asm("mov %0, %%db0" ::"r" (value)); | ||
129 | break; | ||
130 | case 1: | ||
131 | asm("mov %0, %%db1" ::"r" (value)); | ||
132 | break; | ||
133 | case 2: | ||
134 | asm("mov %0, %%db2" ::"r" (value)); | ||
135 | break; | ||
136 | case 3: | ||
137 | asm("mov %0, %%db3" ::"r" (value)); | ||
138 | break; | ||
139 | case 6: | ||
140 | asm("mov %0, %%db6" ::"r" (value)); | ||
141 | break; | ||
142 | case 7: | ||
143 | asm("mov %0, %%db7" ::"r" (value)); | ||
144 | break; | ||
145 | default: | ||
146 | BUG(); | ||
147 | } | ||
148 | } | ||
149 | |||
83 | static inline void hw_breakpoint_disable(void) | 150 | static inline void hw_breakpoint_disable(void) |
84 | { | 151 | { |
85 | /* Zero the control register for HW Breakpoint */ | 152 | /* Zero the control register for HW Breakpoint */ |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index c0180fd372d..aa0f9130836 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm/paravirt_types.h> | 10 | #include <asm/paravirt_types.h> |
11 | 11 | ||
12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
13 | #include <linux/bug.h> | ||
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <linux/cpumask.h> | 15 | #include <linux/cpumask.h> |
15 | 16 | ||
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 95da14f7ee8..5533b30cac0 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -475,61 +475,6 @@ struct thread_struct { | |||
475 | unsigned io_bitmap_max; | 475 | unsigned io_bitmap_max; |
476 | }; | 476 | }; |
477 | 477 | ||
478 | static inline unsigned long native_get_debugreg(int regno) | ||
479 | { | ||
480 | unsigned long val = 0; /* Damn you, gcc! */ | ||
481 | |||
482 | switch (regno) { | ||
483 | case 0: | ||
484 | asm("mov %%db0, %0" :"=r" (val)); | ||
485 | break; | ||
486 | case 1: | ||
487 | asm("mov %%db1, %0" :"=r" (val)); | ||
488 | break; | ||
489 | case 2: | ||
490 | asm("mov %%db2, %0" :"=r" (val)); | ||
491 | break; | ||
492 | case 3: | ||
493 | asm("mov %%db3, %0" :"=r" (val)); | ||
494 | break; | ||
495 | case 6: | ||
496 | asm("mov %%db6, %0" :"=r" (val)); | ||
497 | break; | ||
498 | case 7: | ||
499 | asm("mov %%db7, %0" :"=r" (val)); | ||
500 | break; | ||
501 | default: | ||
502 | BUG(); | ||
503 | } | ||
504 | return val; | ||
505 | } | ||
506 | |||
507 | static inline void native_set_debugreg(int regno, unsigned long value) | ||
508 | { | ||
509 | switch (regno) { | ||
510 | case 0: | ||
511 | asm("mov %0, %%db0" ::"r" (value)); | ||
512 | break; | ||
513 | case 1: | ||
514 | asm("mov %0, %%db1" ::"r" (value)); | ||
515 | break; | ||
516 | case 2: | ||
517 | asm("mov %0, %%db2" ::"r" (value)); | ||
518 | break; | ||
519 | case 3: | ||
520 | asm("mov %0, %%db3" ::"r" (value)); | ||
521 | break; | ||
522 | case 6: | ||
523 | asm("mov %0, %%db6" ::"r" (value)); | ||
524 | break; | ||
525 | case 7: | ||
526 | asm("mov %0, %%db7" ::"r" (value)); | ||
527 | break; | ||
528 | default: | ||
529 | BUG(); | ||
530 | } | ||
531 | } | ||
532 | |||
533 | /* | 478 | /* |
534 | * Set IOPL bits in EFLAGS from given mask | 479 | * Set IOPL bits in EFLAGS from given mask |
535 | */ | 480 | */ |
@@ -575,14 +520,6 @@ static inline void native_swapgs(void) | |||
575 | #define __cpuid native_cpuid | 520 | #define __cpuid native_cpuid |
576 | #define paravirt_enabled() 0 | 521 | #define paravirt_enabled() 0 |
577 | 522 | ||
578 | /* | ||
579 | * These special macros can be used to get or set a debugging register | ||
580 | */ | ||
581 | #define get_debugreg(var, register) \ | ||
582 | (var) = native_get_debugreg(register) | ||
583 | #define set_debugreg(value, register) \ | ||
584 | native_set_debugreg(register, value) | ||
585 | |||
586 | static inline void load_sp0(struct tss_struct *tss, | 523 | static inline void load_sp0(struct tss_struct *tss, |
587 | struct thread_struct *thread) | 524 | struct thread_struct *thread) |
588 | { | 525 | { |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index ade9c794ed9..e49477444ff 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/archrandom.h> | 18 | #include <asm/archrandom.h> |
19 | #include <asm/hypervisor.h> | 19 | #include <asm/hypervisor.h> |
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/debugreg.h> | ||
21 | #include <asm/sections.h> | 22 | #include <asm/sections.h> |
22 | #include <linux/topology.h> | 23 | #include <linux/topology.h> |
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index ada2f99388d..9c57c02e54f 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <asm/bug.h> | 27 | #include <asm/bug.h> |
28 | #include <asm/paravirt.h> | 28 | #include <asm/paravirt.h> |
29 | #include <asm/debugreg.h> | ||
29 | #include <asm/desc.h> | 30 | #include <asm/desc.h> |
30 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
31 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
diff --git a/arch/x86/mm/kmemcheck/selftest.c b/arch/x86/mm/kmemcheck/selftest.c index 036efbea8b2..aef7140c006 100644 --- a/arch/x86/mm/kmemcheck/selftest.c +++ b/arch/x86/mm/kmemcheck/selftest.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/bug.h> | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | 3 | ||
3 | #include "opcode.h" | 4 | #include "opcode.h" |