[PATCH] Blackfin: Fix hamming weight functions

From: David Howells
Date: Tue Aug 24 2010 - 18:03:03 EST


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

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

arch/blackfin/include/asm/bitops.h | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index d5872cd..5f259a9 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/