public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] BUG_ON() not arch-specific.
@ 2001-12-05  7:24 Rusty Russell
  2001-12-05  8:36 ` Jens Axboe
  2001-12-05 14:42 ` David Woodhouse
  0 siblings, 2 replies; 4+ messages in thread
From: Rusty Russell @ 2001-12-05  7:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

Hi all,

	We only need one BUG_ON implementation, surely.  Genericized
and moved to linux/kernel.h.

Cheers,
Rusty.

diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/linux/kernel.h working-2.5.1-pre5-percpu/include/linux/kernel.h
--- linux-2.5.1-pre5/include/linux/kernel.h	Wed Dec  5 16:49:14 2001
+++ working-2.5.1-pre5-percpu/include/linux/kernel.h	Wed Dec  5 18:12:15 2001
@@ -176,4 +176,5 @@
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
 #endif
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/asm-alpha/page.h working-2.5.1-pre5-percpu/include/asm-alpha/page.h
--- linux-2.5.1-pre5/include/asm-alpha/page.h	Tue Dec  4 17:17:27 2001
+++ working-2.5.1-pre5-percpu/include/asm-alpha/page.h	Wed Dec  5 18:14:34 2001
@@ -67,18 +67,6 @@
 
 #define PAGE_BUG(page)	BUG()
 
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((long)(condition)))\
-			BUG();			\
-	} while (0)
-
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((int)(condition)))	\
-			BUG();			\
-	} while (0)
-
 /* Pure 2^n version of get_order */
 extern __inline__ int get_order(unsigned long size)
 {
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/asm-i386/page.h working-2.5.1-pre5-percpu/include/asm-i386/page.h
--- linux-2.5.1-pre5/include/asm-i386/page.h	Tue Dec  4 17:17:27 2001
+++ working-2.5.1-pre5-percpu/include/asm-i386/page.h	Wed Dec  5 18:06:31 2001
@@ -101,12 +101,6 @@
 	BUG(); \
 } while (0)
 
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((int)(condition)))	\
-			BUG();			\
-	} while (0)
-
 /* Pure 2^n version of get_order */
 static __inline__ int get_order(unsigned long size)
 {
--
Premature optmztion is rt of all evl. --DK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] BUG_ON() not arch-specific.
  2001-12-05  7:24 [PATCH] BUG_ON() not arch-specific Rusty Russell
@ 2001-12-05  8:36 ` Jens Axboe
  2001-12-05 14:42 ` David Woodhouse
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2001-12-05  8:36 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, torvalds

On Wed, Dec 05 2001, Rusty Russell wrote:
> Hi all,
> 
> 	We only need one BUG_ON implementation, surely.  Genericized
> and moved to linux/kernel.h.

Yes, fine.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] BUG_ON() not arch-specific.
  2001-12-05  7:24 [PATCH] BUG_ON() not arch-specific Rusty Russell
  2001-12-05  8:36 ` Jens Axboe
@ 2001-12-05 14:42 ` David Woodhouse
  2001-12-08 23:56   ` Rusty Russell
  1 sibling, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2001-12-05 14:42 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, torvalds


rusty@rustcorp.com.au said:
> --- linux-2.5.1-pre5/include/linux/kernel.h	Wed Dec  5 16:49:14 2001
> +++ working-2.5.1-pre5-percpu/include/linux/kernel.h	Wed Dec  5 18:12:15 2001
> @@ -176,4 +176,5 @@
>  	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
>  };
>  
> +#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)

You'll need to add #include <linux/compiler.h> to linux/kernel.h if you do 
that. Let's not make the include files any more broken than they already 
are :)


--
dwmw2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] BUG_ON() not arch-specific.
  2001-12-05 14:42 ` David Woodhouse
@ 2001-12-08 23:56   ` Rusty Russell
  0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2001-12-08 23:56 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel, torvalds

In message <26384.1007563352@redhat.com> you write:
> You'll need to add #include <linux/compiler.h> to linux/kernel.h if you do 
> that. Let's not make the include files any more broken than they already 
> are :)

Ack.  Linus, please apply.

diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/linux/kernel.h working-2.5.1-pre5-percpu/include/linux/kernel.h
--- linux-2.5.1-pre5/include/linux/kernel.h	Thu Dec  6 16:20:29 2001
+++ working-2.5.1-pre5-percpu/include/linux/kernel.h	Sun Dec  9 10:52:09 2001
@@ -11,6 +11,7 @@
 #include <linux/linkage.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /* Optimization barrier */
 /* The "volatile" is due to gcc bugs */
@@ -176,4 +177,5 @@
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
 #endif
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/asm-alpha/page.h working-2.5.1-pre5-percpu/include/asm-alpha/page.h
--- linux-2.5.1-pre5/include/asm-alpha/page.h	Tue Dec  4 17:17:27 2001
+++ working-2.5.1-pre5-percpu/include/asm-alpha/page.h	Wed Dec  5 18:14:34 2001
@@ -67,18 +67,6 @@
 
 #define PAGE_BUG(page)	BUG()
 
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((long)(condition)))\
-			BUG();			\
-	} while (0)
-
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((int)(condition)))	\
-			BUG();			\
-	} while (0)
-
 /* Pure 2^n version of get_order */
 extern __inline__ int get_order(unsigned long size)
 {
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.1-pre5/include/asm-i386/page.h working-2.5.1-pre5-percpu/include/asm-i386/page.h
--- linux-2.5.1-pre5/include/asm-i386/page.h	Tue Dec  4 17:17:27 2001
+++ working-2.5.1-pre5-percpu/include/asm-i386/page.h	Wed Dec  5 18:06:31 2001
@@ -101,12 +101,6 @@
 	BUG(); \
 } while (0)
 
-#define BUG_ON(condition)			\
-	do {					\
-		if (unlikely((int)(condition)))	\
-			BUG();			\
-	} while (0)
-
 /* Pure 2^n version of get_order */
 static __inline__ int get_order(unsigned long size)
 {
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-08 23:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-05  7:24 [PATCH] BUG_ON() not arch-specific Rusty Russell
2001-12-05  8:36 ` Jens Axboe
2001-12-05 14:42 ` David Woodhouse
2001-12-08 23:56   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox