x86: Eliminate result signage problem in asm-x86_64/bitops.h
authorChuck Lever <chuck.lever@oracle.com>
Wed, 17 Oct 2007 16:04:38 +0000 (18:04 +0200)
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>
Wed, 17 Oct 2007 18:16:27 +0000 (20:16 +0200)
The return type of __scanbit() doesn't match the return type of
find_{first,next}_bit().  Thus when you construct something like
this:

   boolean ? __scanbit() : find_first_bit()

you get an unsigned long result if "boolean" is true, and a signed
long result if "boolean" is false.

In file included from /home/cel/src/linux/include/linux/mmzone.h:15,
                 from /home/cel/src/linux/include/linux/gfp.h:4,
                 from /home/cel/src/linux/include/linux/slab.h:14,
                 from /home/cel/src/linux/include/linux/percpu.h:5,
                 from
/home/cel/src/linux/include/linux/rcupdate.h:41,
                 from /home/cel/src/linux/include/linux/dcache.h:10,
                 from /home/cel/src/linux/include/linux/fs.h:275,
                 from /home/cel/src/linux/fs/nfs/sysctl.c:9:
/home/cel/src/linux/include/linux/nodemask.h: In function
â\80\98__first_nodeâ\80\99:
/home/cel/src/linux/include/linux/nodemask.h:229: warning: signed and
unsigned type in conditional expression
/home/cel/src/linux/include/linux/nodemask.h: In function
â\80\98__next_nodeâ\80\99:
/home/cel/src/linux/include/linux/nodemask.h:235: warning: signed and
unsigned type in conditional expression
/home/cel/src/linux/include/linux/nodemask.h: In function
â\80\98__first_unset_nodeâ\80\99:
/home/cel/src/linux/include/linux/nodemask.h:253: warning: signed and
unsigned type in conditional expression

[ tglx: arch/x86 adaptation ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/bitops_64.h

index d4dbbe5f7bd9f466451e0ee65572b6accf929277..1d7d9b4bcacb0846f44f72282008552f4582dba5 100644 (file)
@@ -260,7 +260,7 @@ extern long find_first_bit(const unsigned long * addr, unsigned long size);
 extern long find_next_bit(const unsigned long * addr, long size, long offset);
 
 /* return index of first bet set in val or max when no bit is set */
-static inline unsigned long __scanbit(unsigned long val, unsigned long max)
+static inline long __scanbit(unsigned long val, unsigned long max)
 {
        asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max));
        return val;