Skip to contentSkip to conversation

Blackfin: Fix hamming weight functions

PATCH In review David Howells 2 participants 2 messages Aug 24, 2010 Bitops API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Blackfin: Fix hamming weight functions

Fix the hamming weight functions to support the const variants in asm-generic/bitops/const_hweight.h.

To this end, the arch specific hweightN() functions are renamed to __arch_hweightN() and the generic header file included which will use them as appropriate.

Without this, I see the following error:

fs/fcntl.c: In function 'fcntl_init':
fs/fcntl.c:773: error: implicit declaration of function 'HWEIGHT32' fs/fcntl.c:773: error: bit-field '<anonymous>' width not an integer constant

---

 arch/blackfin/include/asm/bitops.h |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
arch/blackfin/include/asm/bitops.h +10 -7
index d5872cd..5f259a9 100644
@@ -115,7 +115,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
  * of bits set) of a N-bit word
  */
 
-static inline unsigned int hweight32(unsigned int w)
+static inline unsigned int __arch_hweight32(unsigned int w)
 {
 	unsigned int res;
 
@@ -125,19 +125,22 @@ static inline unsigned int hweight32(unsigned int w)
 	return res;
 }
 
-static inline unsigned int hweight64(__u64 w)
+static inline unsigned int __arch_hweight64(__u64 w)
 {
-	return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
+	return __arch_hweight32((unsigned int)(w >> 32)) +
+		__arch_hweight32((unsigned int)w);
 }
 
-static inline unsigned int hweight16(unsigned int w)
+static inline unsigned int __arch_hweight16(unsigned int w)
 {
-	return hweight32(w & 0xffff);
+	return __arch_hweight32(w & 0xffff);
 }
 
-static inline unsigned int hweight8(unsigned int w)
+static inline unsigned int __arch_hweight8(unsigned int w)
 {
-	return hweight32(w & 0xff);
+	return __arch_hweight32(w & 0xff);
 }
 
+#include <asm-generic/bitops/const_hweight.h>
+
 #endif				/* _BLACKFIN_BITOPS_H */