2010-08-24 22:02:59

by David Howells

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: David Howells <[email protected]>
---

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 */


2010-08-24 22:29:25

by Mike Frysinger

[permalink] [raw]
Subject: Re: [Uclinux-dist-devel] [PATCH] Blackfin: Fix hamming weight functions

On Tue, Aug 24, 2010 at 18:02, David Howells wrote:
> Fix the hamming weight functions to support the const variants in
> asm-generic/bitops/const_hweight.h.

mmm i sent a pull request to Linus for this already ... you can find
the same fix in my for-linus branch
http://git.kernel.org/?p=linux/kernel/git/vapier/blackfin.git;a=shortlog;h=refs/heads/for-linus
-mike