From: Matt Mackall <mpm@selenic.com>

This moves duplicate BUG, PAGE_BUG, BUG_ON, and WARN_ON code to asm-generic
and makes them slightly more consistent.  This cleanup is also preparatory
work for making BUG and WARN verbosity configurable.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/asm-alpha/bug.h     |   12 ++----------
 25-akpm/include/asm-arm/bug.h       |   14 +++-----------
 25-akpm/include/asm-arm26/bug.h     |   17 ++---------------
 25-akpm/include/asm-cris/bug.h      |   19 +------------------
 25-akpm/include/asm-generic/bug.h   |   34 ++++++++++++++++++++++++++++++++++
 25-akpm/include/asm-h8300/bug.h     |   19 +------------------
 25-akpm/include/asm-i386/bug.h      |   14 ++------------
 25-akpm/include/asm-ia64/bug.h      |   13 +++----------
 25-akpm/include/asm-m68k/bug.h      |   17 ++---------------
 25-akpm/include/asm-m68knommu/bug.h |   22 +---------------------
 25-akpm/include/asm-mips/bug.h      |   10 ++--------
 25-akpm/include/asm-parisc/bug.h    |   27 +--------------------------
 25-akpm/include/asm-ppc/bug.h       |    7 +++++--
 25-akpm/include/asm-ppc64/bug.h     |    8 ++++++--
 25-akpm/include/asm-s390/bug.h      |   19 +++----------------
 25-akpm/include/asm-sh/bug.h        |   17 ++---------------
 25-akpm/include/asm-sparc/bug.h     |   17 ++---------------
 25-akpm/include/asm-sparc64/bug.h   |   19 ++-----------------
 25-akpm/include/asm-um/bug.h        |   28 +---------------------------
 25-akpm/include/asm-v850/bug.h      |   12 ++----------
 25-akpm/include/asm-x86_64/bug.h    |   25 +++++++++----------------
 21 files changed, 86 insertions(+), 284 deletions(-)

diff -puN include/asm-alpha/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-alpha/bug.h
--- 25/include/asm-alpha/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.777575488 -0700
+++ 25-akpm/include/asm-alpha/bug.h	2004-08-05 00:30:26.814569864 -0700
@@ -9,15 +9,7 @@
   __asm__ __volatile__("call_pal %0  # bugchk\n\t"".long %1\n\t.8byte %2" \
 		       : : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__))
 
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define PAGE_BUG(page)	BUG()
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-arm26/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-arm26/bug.h
--- 25/include/asm-arm26/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.778575336 -0700
+++ 25-akpm/include/asm-arm26/bug.h	2004-08-05 00:30:26.815569712 -0700
@@ -5,26 +5,13 @@
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 extern volatile void __bug(const char *file, int line, void *data);
-
 /* give file/line information */
 #define BUG()		__bug(__FILE__, __LINE__, NULL)
-#define PAGE_BUG(page)	__bug(__FILE__, __LINE__, page)
-
 #else
-
-/* these just cause an oops */
 #define BUG()		(*(int *)0 = 0)
-#define PAGE_BUG(page)	(*(int *)0 = 0)
-
 #endif
 
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-arm/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-arm/bug.h
--- 25/include/asm-arm/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.780575032 -0700
+++ 25-akpm/include/asm-arm/bug.h	2004-08-05 00:30:26.816569560 -0700
@@ -8,23 +8,15 @@ extern volatile void __bug(const char *f
 
 /* give file/line information */
 #define BUG()		__bug(__FILE__, __LINE__, NULL)
-#define PAGE_BUG(page)	__bug(__FILE__, __LINE__, page)
 
 #else
 
-/* these just cause an oops */
+/* this just causes an oops */
 #define BUG()		(*(int *)0 = 0)
-#define PAGE_BUG(page)	(*(int *)0 = 0)
 
 #endif
 
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-cris/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-cris/bug.h
--- 25/include/asm-cris/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.782574728 -0700
+++ 25-akpm/include/asm-cris/bug.h	2004-08-05 00:30:26.817569408 -0700
@@ -1,21 +1,4 @@
 #ifndef _CRIS_BUG_H
 #define _CRIS_BUG_H
-
-#define BUG() do { \
-  printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-} while (0)
-
-#define PAGE_BUG(page) do { \
-         BUG(); \
-} while (0)
-
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-
+#include <asm-generic/bug.h>
 #endif
diff -puN /dev/null include/asm-generic/bug.h
--- /dev/null	2003-09-15 06:40:47.000000000 -0700
+++ 25-akpm/include/asm-generic/bug.h	2004-08-05 00:30:26.818569256 -0700
@@ -0,0 +1,34 @@
+#ifndef _ASM_GENERIC_BUG_H
+#define _ASM_GENERIC_BUG_H
+
+#include <linux/compiler.h>
+#include <linux/config.h>
+
+#ifndef HAVE_ARCH_BUG
+#define BUG() do { \
+	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	panic("BUG!");
+} while (0)
+#endif
+
+#ifndef HAVE_ARCH_PAGE_BUG
+#define PAGE_BUG(page) do { \
+	printk("page BUG for page at %p\n", page); \
+	BUG(); \
+} while (0)
+#endif
+
+#ifndef HAVE_ARCH_BUG_ON
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#endif
+
+#ifndef HAVE_ARCH_WARN_ON
+#define WARN_ON(condition) do { \
+	if (unlikely((condition)!=0)) { \
+		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
+		dump_stack(); \
+	} \
+} while (0)
+#endif
+
+#endif
diff -puN include/asm-h8300/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-h8300/bug.h
--- 25/include/asm-h8300/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.785574272 -0700
+++ 25-akpm/include/asm-h8300/bug.h	2004-08-05 00:30:26.818569256 -0700
@@ -1,21 +1,4 @@
 #ifndef _H8300_BUG_H
 #define _H8300_BUG_H
-
-#define BUG() do { \
-  printk("%s(%d): kernel BUG!\n", __FILE__, __LINE__); \
-} while (0)
-
-#define PAGE_BUG(page) do { \
-         BUG(); \
-} while (0)
-
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-
+#include <asm-generic/bug.h>
 #endif
diff -puN include/asm-i386/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-i386/bug.h
--- 25/include/asm-i386/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.786574120 -0700
+++ 25-akpm/include/asm-i386/bug.h	2004-08-05 00:30:26.819569104 -0700
@@ -19,17 +19,7 @@
 #define BUG() __asm__ __volatile__("ud2\n")
 #endif
 
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-ia64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-ia64/bug.h
--- 25/include/asm-ia64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.788573816 -0700
+++ 25-akpm/include/asm-ia64/bug.h	2004-08-05 00:30:26.820568952 -0700
@@ -8,15 +8,8 @@
 #endif
 #define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)
 
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define PAGE_BUG(page) do { BUG(); } while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+/* should this BUG should be made generic? */
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-m68k/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-m68k/bug.h
--- 25/include/asm-m68k/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.790573512 -0700
+++ 25-akpm/include/asm-m68k/bug.h	2004-08-05 00:30:26.821568800 -0700
@@ -21,20 +21,7 @@
 } while (0)
 #endif
 
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-m68knommu/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-m68knommu/bug.h
--- 25/include/asm-m68knommu/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.792573208 -0700
+++ 25-akpm/include/asm-m68knommu/bug.h	2004-08-05 00:30:26.821568800 -0700
@@ -1,24 +1,4 @@
 #ifndef _M68KNOMMU_BUG_H
 #define _M68KNOMMU_BUG_H
-
-#define BUG() do { \
-  printk("%s(%d): kernel BUG!\n", __FILE__, __LINE__); \
-} while (0)
-
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-         BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-
+#include <asm-generic/bug.h>
 #endif
diff -puN include/asm-mips/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-mips/bug.h
--- 25/include/asm-mips/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.793573056 -0700
+++ 25-akpm/include/asm-mips/bug.h	2004-08-05 00:30:26.822568648 -0700
@@ -7,14 +7,8 @@
 do {									\
 	__asm__ __volatile__("break %0" : : "i" (BRK_BUG));		\
 } while (0)
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-#define PAGE_BUG(page) do {  BUG(); } while (0)
 
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-	dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-parisc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-parisc/bug.h
--- 25/include/asm-parisc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.795572752 -0700
+++ 25-akpm/include/asm-parisc/bug.h	2004-08-05 00:30:26.823568496 -0700
@@ -1,29 +1,4 @@
 #ifndef _PARISC_BUG_H
 #define _PARISC_BUG_H
-
-/*
- * Tell the user there is some problem.
- */
-#define BUG() do { \
-	extern void dump_stack(void); \
-	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-	dump_stack(); \
-} while (0)
-
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-
+#include <asm-generic/bug.h>
 #endif
diff -puN include/asm-ppc64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-ppc64/bug.h
--- 25/include/asm-ppc64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.797572448 -0700
+++ 25-akpm/include/asm-ppc64/bug.h	2004-08-05 00:30:26.824568344 -0700
@@ -43,8 +43,6 @@ struct bug_entry {
 		    "i" (__FUNCTION__));			\
 } while (0)
 
-#define PAGE_BUG(page) do { BUG(); } while (0)
-
 #define WARN_ON(x) do {						\
 	__asm__ __volatile__(					\
 		"1:	tdnei %0,0\n"				\
@@ -56,4 +54,10 @@ struct bug_entry {
 } while (0)
 
 #endif
+
+#define HAVE_ARCH_BUG
+#define HAVE_ARCH_BUG_ON
+#define HAVE_ARCH_WARN_ON
+#include <asm-generic/bug.h>
+
 #endif
diff -puN include/asm-ppc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-ppc/bug.h
--- 25/include/asm-ppc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.799572144 -0700
+++ 25-akpm/include/asm-ppc/bug.h	2004-08-05 00:30:26.825568192 -0700
@@ -35,8 +35,6 @@ struct bug_entry {
 	}								\
 } while (0)
 
-#define PAGE_BUG(page)	BUG()
-
 #define WARN_ON(x) do {							\
 	if (!__builtin_constant_p(x) || (x)) {				\
 		__asm__ __volatile__(					\
@@ -49,4 +47,9 @@ struct bug_entry {
 	}								\
 } while (0)
 
+#define HAVE_ARCH_BUG
+#define HAVE_ARCH_BUG_ON
+#define HAVE_ARCH_WARN_ON
+#include <asm-generic/bug.h>
+
 #endif
diff -puN include/asm-s390/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-s390/bug.h
--- 25/include/asm-s390/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.800571992 -0700
+++ 25-akpm/include/asm-s390/bug.h	2004-08-05 00:30:26.825568192 -0700
@@ -6,22 +6,9 @@
 #define BUG() do { \
         printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
         __asm__ __volatile__(".long 0"); \
-} while (0)                                       
-
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-        BUG(); \
-} while (0)                      
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
 } while (0)
 
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
+
 #endif
diff -puN include/asm-sh/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-sh/bug.h
--- 25/include/asm-sh/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.802571688 -0700
+++ 25-akpm/include/asm-sh/bug.h	2004-08-05 00:30:26.826568040 -0700
@@ -11,20 +11,7 @@
 	asm volatile("nop"); \
 } while (0)
 
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-sparc64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-sparc64/bug.h
--- 25/include/asm-sparc64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.804571384 -0700
+++ 25-akpm/include/asm-sparc64/bug.h	2004-08-05 00:30:26.827567888 -0700
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 #ifndef _SPARC64_BUG_H
 #define _SPARC64_BUG_H
 
@@ -15,20 +13,7 @@ extern void do_BUG(const char *file, int
 #define BUG()		__builtin_trap()
 #endif
 
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-sparc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-sparc/bug.h
--- 25/include/asm-sparc/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.806571080 -0700
+++ 25-akpm/include/asm-sparc/bug.h	2004-08-05 00:30:26.828567736 -0700
@@ -25,20 +25,7 @@ extern void do_BUG(const char *file, int
 #define BUG()		__bug_trap()
 #endif
 
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif
diff -puN include/asm-um/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-um/bug.h
--- 25/include/asm-um/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.807570928 -0700
+++ 25-akpm/include/asm-um/bug.h	2004-08-05 00:30:26.828567736 -0700
@@ -1,30 +1,4 @@
 #ifndef __UM_BUG_H
 #define __UM_BUG_H
-
-#ifndef __ASSEMBLY__
-
-#define BUG() do { \
-	panic("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-} while (0)
-
-#define BUG_ON(condition) do { \
-	if (unlikely((condition)!=0)) \
-		BUG(); \
-} while(0)
-
-#define PAGE_BUG(page) do { \
-	BUG(); \
-} while (0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-
-extern int foo;
-
-#endif
-
+#include <asm-generic/bug.h>
 #endif
diff -puN include/asm-v850/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-v850/bug.h
--- 25/include/asm-v850/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.809570624 -0700
+++ 25-akpm/include/asm-v850/bug.h	2004-08-05 00:30:26.829567584 -0700
@@ -16,15 +16,7 @@
 
 extern void __bug (void) __attribute__ ((noreturn));
 #define BUG()		__bug()
-#define PAGE_BUG(page)	__bug()
-
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#define HAVE_ARCH_BUG
+#include <asm-generic/bug.h>
 
 #endif /* __V850_BUG_H__ */
diff -puN include/asm-x86_64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic include/asm-x86_64/bug.h
--- 25/include/asm-x86_64/bug.h~move-duplicate-bug-and-warn_on-bits-to-asm-generic	2004-08-05 00:30:26.811570320 -0700
+++ 25-akpm/include/asm-x86_64/bug.h	2004-08-05 00:30:26.830567432 -0700
@@ -6,27 +6,20 @@
 /*
  * Tell the user there is some problem.  The exception handler decodes 
  * this frame.
- */ 
-struct bug_frame { 
-       unsigned char ud2[2];          
+ */
+struct bug_frame {
+       unsigned char ud2[2];
 	/* should use 32bit offset instead, but the assembler doesn't 
-	   like it */ 
-	char *filename;   
-	unsigned short line; 
-} __attribute__((packed)); 
+	   like it */
+	char *filename;
+	unsigned short line;
+} __attribute__((packed));
 
+#define HAVE_ARCH_BUG
 #define BUG() \
 	asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \
 		     "i"(__LINE__), "i" (__stringify(KBUILD_BASENAME)))
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
-#define PAGE_BUG(page) BUG()
 void out_of_line_bug(void);
-
-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
+#include <asm-generic/bug.h>
 
 #endif
_