Only define BITS_TO_LONGS if not defined
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 12 Jan 2010 00:24:09 +0000 (16:24 -0800)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 12 Jan 2010 00:24:09 +0000 (16:24 -0800)
This removes this nagging complaint on older kernels:

  CC [M]  /home/mcgrof/compat/compat/compat-2.6.32.o
In file included from include/asm-i386/cpufeature.h:11,
                 from include/asm/cpufeature.h:10,
                 from include/asm/alternative.h:43,
                 from include/asm/atomic.h:4,
                 from /home/mcgrof/compat/include/linux/compat-2.6.24.h:10,
                 from /home/mcgrof/compat/include/linux/compat-2.6.h:15,
                 from <command-line>:0:
/home/mcgrof/compat/include/linux/bitops.h:10:1: warning: "BITS_TO_LONGS" redefined
In file included from include/asm/alternative.h:6,
                 from include/asm/atomic.h:4,
                 from /home/mcgrof/compat/include/linux/compat-2.6.24.h:10,
                 from /home/mcgrof/compat/include/linux/compat-2.6.h:15,
                 from <command-line>:0:
include/linux/types.h:6:1: warning: this is the location of the previous definition
In file included from include/asm-i386/cpufeature.h:11,
                 from include/asm/cpufeature.h:10,
                 from include/asm/alternative.h:43,
                 from include/asm/atomic.h:4,
                 from /home/mcgrof/compat/include/linux/compat-2.6.24.h:10,
                 from /home/mcgrof/compat/include/linux/compat-2.6.h:15,
                 from <command-line>:0:

Note that this means we'll have to keep include/linux/bitops.h up to
date on our tree now. Shouldn't be an issue but just worth noting.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
include/linux/bitops.h

index c05a29c..8469d35 100644 (file)
@@ -7,8 +7,10 @@
 #define BIT_MASK(nr)           (1UL << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)           ((nr) / BITS_PER_LONG)
 #define BITS_PER_BYTE          8
+#ifndef BITS_TO_LONGS /* Older kernels define this already */
 #define BITS_TO_LONGS(nr)      DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
 #endif
+#endif
 
 /*
  * Include this here because some architectures need generic_ffs/fls in