Skip to contentSkip to conversation

Fix WARN_ON() on bitfield ops for all other archs

PATCH In review Heiko Carstens 3 participants 3 messages Aug 1, 2007 – Aug 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix WARN_ON() on bitfield ops for all other archs

From: Heiko Carstens <[email protected]>

Fixes WARN_ON() on bitfiels ops for all architectures that have been left out in 8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f.

Cc Alexey Dobriyan <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Haavard Skinnemoen <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Kyle McMartin <[email protected]>
Cc Martin Schwidefsky <[email protected]>
---
 include/asm-avr32/bug.h  |    2 +-
 include/asm-parisc/bug.h |    2 +-
 include/asm-s390/bug.h   |    2 +-
 include/asm-sh/bug.h     |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
include/asm-avr32/bug.h +1 -1
Index: linux-2.6/include/asm-avr32/bug.h
===================================================================
@@ -57,7 +57,7 @@
 
 #define WARN_ON(condition)							\
 	({								\
-		typeof(condition) __ret_warn_on = (condition);		\
+		int __ret_warn_on = !!(condition);			\
 		if (unlikely(__ret_warn_on))				\
 			_BUG_OR_WARN(BUGFLAG_WARNING);			\
 		unlikely(__ret_warn_on);				\
include/asm-parisc/bug.h +1 -1
Index: linux-2.6/include/asm-parisc/bug.h
===================================================================
@@ -74,7 +74,7 @@
 
 
 #define WARN_ON(x) ({						\
-	typeof(x) __ret_warn_on = (x);				\
+	int __ret_warn_on = !!(x);				\
 	if (__builtin_constant_p(__ret_warn_on)) {		\
 		if (__ret_warn_on)				\
 			__WARN();				\
include/asm-s390/bug.h +1 -1
Index: linux-2.6/include/asm-s390/bug.h
===================================================================
@@ -50,7 +50,7 @@
 #define BUG()	__EMIT_BUG(0)
 
 #define WARN_ON(x) ({					\
-	typeof(x) __ret_warn_on = (x);			\
+	int __ret_warn_on = !!(x);			\
 	if (__builtin_constant_p(__ret_warn_on)) {	\
 		if (__ret_warn_on)			\
 			__EMIT_BUG(BUGFLAG_WARNING);	\
include/asm-sh/bug.h +1 -1
Index: linux-2.6/include/asm-sh/bug.h
===================================================================
@@ -61,7 +61,7 @@ do {							\
 } while (0)
 
 #define WARN_ON(x) ({						\
-	typeof(x) __ret_warn_on = (x);				\
+	int __ret_warn_on = !!(x);				\
 	if (__builtin_constant_p(__ret_warn_on)) {		\
 		if (__ret_warn_on)				\
 			__WARN();				\
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

Fixes WARN_ON() on bitfiels ops for all architectures that have been left out in 8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f.

Quoted 8 lines
Cc Alexey Dobriyan <[email protected]>
Cc Herbert Xu <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Haavard Skinnemoen <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Kyle McMartin <[email protected]>
Cc Martin Schwidefsky <[email protected]>
#2 lore raw
In reply to Heiko Carstens
Quoted 4 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

Fixes WARN_ON() on bitfiels ops for all architectures that have been left out in 8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f.

Well, considering ...

Quoted 3 lines · Alexey Dobriyan

But I question the rationale of that commit:
[...]
I think that second case is more clear and immediately understandable.

and

Quoted 3 lines · Linus Torvalds

For all I know, the proper solution is
to just revert the whole mess, and *not* make WARN_ON() return a value at all, since that seems to be the fundamental mistake here.

... I think it makes sense to stop returning the value from WARN_ON() in the first place. There's only 5 places in the tree that uses its return value anyway, and one of them ( net/xfrm/xfrm_policy.c:681 ) is a good example of why it's less readable that way.

Satyam