You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/types.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <plat/pincfg.h>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __ASM_AVR32_IO_H
|
||||
#define __ASM_AVR32_IO_H
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/irqflags.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/entry.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
#include <linux/bug.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
||||
*/
|
||||
#include <linux/bug.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#define FPUDEBUG 0
|
||||
|
||||
#include "float.h"
|
||||
#include <linux/bug.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/processor.h>
|
||||
/* #include <sys/debug.h> */
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bug.h>
|
||||
#include "nonstdio.h"
|
||||
#include "ppc.h"
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bug.h>
|
||||
#include "spu.h"
|
||||
|
||||
/* This file holds the Spu opcode table */
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#ifndef _LINUX_ASM_VGA_H_
|
||||
#define _LINUX_ASM_VGA_H_
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
#define VT_BUF_HAVE_RW
|
||||
|
||||
@@ -78,8 +78,75 @@
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/bug.h>
|
||||
|
||||
DECLARE_PER_CPU(unsigned long, cpu_dr7);
|
||||
|
||||
#ifndef CONFIG_PARAVIRT
|
||||
/*
|
||||
* These special macros can be used to get or set a debugging register
|
||||
*/
|
||||
#define get_debugreg(var, register) \
|
||||
(var) = native_get_debugreg(register)
|
||||
#define set_debugreg(value, register) \
|
||||
native_set_debugreg(register, value)
|
||||
#endif
|
||||
|
||||
static inline unsigned long native_get_debugreg(int regno)
|
||||
{
|
||||
unsigned long val = 0; /* Damn you, gcc! */
|
||||
|
||||
switch (regno) {
|
||||
case 0:
|
||||
asm("mov %%db0, %0" :"=r" (val));
|
||||
break;
|
||||
case 1:
|
||||
asm("mov %%db1, %0" :"=r" (val));
|
||||
break;
|
||||
case 2:
|
||||
asm("mov %%db2, %0" :"=r" (val));
|
||||
break;
|
||||
case 3:
|
||||
asm("mov %%db3, %0" :"=r" (val));
|
||||
break;
|
||||
case 6:
|
||||
asm("mov %%db6, %0" :"=r" (val));
|
||||
break;
|
||||
case 7:
|
||||
asm("mov %%db7, %0" :"=r" (val));
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline void native_set_debugreg(int regno, unsigned long value)
|
||||
{
|
||||
switch (regno) {
|
||||
case 0:
|
||||
asm("mov %0, %%db0" ::"r" (value));
|
||||
break;
|
||||
case 1:
|
||||
asm("mov %0, %%db1" ::"r" (value));
|
||||
break;
|
||||
case 2:
|
||||
asm("mov %0, %%db2" ::"r" (value));
|
||||
break;
|
||||
case 3:
|
||||
asm("mov %0, %%db3" ::"r" (value));
|
||||
break;
|
||||
case 6:
|
||||
asm("mov %0, %%db6" ::"r" (value));
|
||||
break;
|
||||
case 7:
|
||||
asm("mov %0, %%db7" ::"r" (value));
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
|
||||
static inline void hw_breakpoint_disable(void)
|
||||
{
|
||||
/* Zero the control register for HW Breakpoint */
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <asm/paravirt_types.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/bug.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
|
||||
@@ -475,61 +475,6 @@ struct thread_struct {
|
||||
unsigned io_bitmap_max;
|
||||
};
|
||||
|
||||
static inline unsigned long native_get_debugreg(int regno)
|
||||
{
|
||||
unsigned long val = 0; /* Damn you, gcc! */
|
||||
|
||||
switch (regno) {
|
||||
case 0:
|
||||
asm("mov %%db0, %0" :"=r" (val));
|
||||
break;
|
||||
case 1:
|
||||
asm("mov %%db1, %0" :"=r" (val));
|
||||
break;
|
||||
case 2:
|
||||
asm("mov %%db2, %0" :"=r" (val));
|
||||
break;
|
||||
case 3:
|
||||
asm("mov %%db3, %0" :"=r" (val));
|
||||
break;
|
||||
case 6:
|
||||
asm("mov %%db6, %0" :"=r" (val));
|
||||
break;
|
||||
case 7:
|
||||
asm("mov %%db7, %0" :"=r" (val));
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline void native_set_debugreg(int regno, unsigned long value)
|
||||
{
|
||||
switch (regno) {
|
||||
case 0:
|
||||
asm("mov %0, %%db0" ::"r" (value));
|
||||
break;
|
||||
case 1:
|
||||
asm("mov %0, %%db1" ::"r" (value));
|
||||
break;
|
||||
case 2:
|
||||
asm("mov %0, %%db2" ::"r" (value));
|
||||
break;
|
||||
case 3:
|
||||
asm("mov %0, %%db3" ::"r" (value));
|
||||
break;
|
||||
case 6:
|
||||
asm("mov %0, %%db6" ::"r" (value));
|
||||
break;
|
||||
case 7:
|
||||
asm("mov %0, %%db7" ::"r" (value));
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set IOPL bits in EFLAGS from given mask
|
||||
*/
|
||||
@@ -575,14 +520,6 @@ static inline void native_swapgs(void)
|
||||
#define __cpuid native_cpuid
|
||||
#define paravirt_enabled() 0
|
||||
|
||||
/*
|
||||
* These special macros can be used to get or set a debugging register
|
||||
*/
|
||||
#define get_debugreg(var, register) \
|
||||
(var) = native_get_debugreg(register)
|
||||
#define set_debugreg(value, register) \
|
||||
native_set_debugreg(register, value)
|
||||
|
||||
static inline void load_sp0(struct tss_struct *tss,
|
||||
struct thread_struct *thread)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <asm/archrandom.h>
|
||||
#include <asm/hypervisor.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/debugreg.h>
|
||||
#include <asm/sections.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <asm/bug.h>
|
||||
#include <asm/paravirt.h>
|
||||
#include <asm/debugreg.h>
|
||||
#include <asm/desc.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <linux/bug.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include "opcode.h"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* Alex Deucher <alexander.deucher@amd.com>
|
||||
*/
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* Alex Deucher <alexander.deucher@amd.com>
|
||||
*/
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* Alex Deucher <alexander.deucher@amd.com>
|
||||
*/
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user