1
0
Fork 0
remarkable-linux/include/asm-generic/bitops
Paul Walmsley c32fa99f0b bitops: Fix signedness of compile-time hweight implementations
Enabling '-Wsign-compare' compiler warnings on code that includes
include/linux/bitops.h can generate the following warning:

  In file included from include/linux/kernel.h:10:0,
                    from <random filename>:48:
  include/linux/bitops.h: In function 'hweight_long':
  include/linux/bitops.h:77:26: error: signed and unsigned type in conditional expression [-Werror=sign-compare]

(converted to an error with -Werror)

This is due to the use of the logical negation operator '!' in the
__const_hweight8 macro in include/asm-generic/bitops/const_hweight.h.
The use of that operator here results in a signed value.

Fix by explicitly casting the __const_hweight8 macro expansion to
'unsigned int'.  While here, clean up several checkpatch.pl warnings.

Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1312180459580.30198@tamien
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-02-09 13:39:26 +01:00
..
__ffs.h x86, generic: mark complex bitops.h inlines as __always_inline 2009-01-13 18:56:30 +01:00
__fls.h x86, generic: mark complex bitops.h inlines as __always_inline 2009-01-13 18:56:30 +01:00
arch_hweight.h arch, hweight: Fix compilation errors 2010-05-04 10:25:27 -07:00
atomic.h Add #includes needed to permit the removal of asm/system.h 2012-03-28 18:30:03 +01:00
builtin-__ffs.h generic: Implement generic ffs/fls using __builtin_* functions 2012-09-14 17:15:41 +01:00
builtin-__fls.h generic: Implement generic ffs/fls using __builtin_* functions 2012-09-14 17:15:41 +01:00
builtin-ffs.h generic: Implement generic ffs/fls using __builtin_* functions 2012-09-14 17:15:41 +01:00
builtin-fls.h generic: Implement generic ffs/fls using __builtin_* functions 2012-09-14 17:15:41 +01:00
const_hweight.h bitops: Fix signedness of compile-time hweight implementations 2014-02-09 13:39:26 +01:00
count_zeros.h MPILIB: Provide count_leading/trailing_zeros() based on arch functions 2012-10-08 13:50:11 +10:30
ext2-atomic-setbit.h asm-generic: add another generic ext2 atomic bitops 2011-07-26 16:49:46 -07:00
ext2-atomic.h asm-generic: add another generic ext2 atomic bitops 2011-07-26 16:49:46 -07:00
ffs.h [PATCH] bitops: generic ffs() 2006-03-26 08:57:11 -08:00
ffz.h [PATCH] bitops: generic ffz() 2006-03-26 08:57:10 -08:00
find.h bitops/find: clarify and extend documentation 2013-11-13 12:09:22 +09:00
fls.h x86, generic: mark complex bitops.h inlines as __always_inline 2009-01-13 18:56:30 +01:00
fls64.h x86, generic: mark complex bitops.h inlines as __always_inline 2009-01-13 18:56:30 +01:00
hweight.h bitops: Optimize hweight() by making use of compile-time evaluation 2010-04-06 15:52:11 -07:00
le.h bitops: introduce generic {clear,set}_bit_le() 2012-10-06 03:04:55 +09:00
lock.h bitops: introduce lock ops 2007-10-18 14:37:29 -07:00
non-atomic.h define first set of BIT* macros 2007-10-19 11:53:42 -07:00
sched.h sched: simplify sched_find_first_bit() 2007-07-09 18:52:00 +02:00