Skip to content

Commit 4677d4a

Browse files
Borislav PetkovH. Peter Anvin
authored andcommitted
arch, hweight: Fix compilation errors
Fix function prototype visibility issues when compiling for non-x86 architectures. Tested with crosstool (ftp://ftp.kernel.org/pub/tools/crosstool/) with alpha, ia64 and sparc targets. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> LKML-Reference: <20100503130736.GD26107@aftab> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1 parent d61931d commit 4677d4a

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎include/asm-generic/bitops/arch_hweight.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33

44
#include <asm/types.h>
55

6-
inline unsigned int __arch_hweight32(unsigned int w)
6+
static inline unsigned int __arch_hweight32(unsigned int w)
77
{
88
return __sw_hweight32(w);
99
}
1010

11-
inline unsigned int __arch_hweight16(unsigned int w)
11+
static inline unsigned int __arch_hweight16(unsigned int w)
1212
{
1313
return __sw_hweight16(w);
1414
}
1515

16-
inline unsigned int __arch_hweight8(unsigned int w)
16+
static inline unsigned int __arch_hweight8(unsigned int w)
1717
{
1818
return __sw_hweight8(w);
1919
}
2020

21-
inline unsigned long __arch_hweight64(__u64 w)
21+
static inline unsigned long __arch_hweight64(__u64 w)
2222
{
2323
return __sw_hweight64(w);
2424
}

‎include/linux/bitops.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
1111
#endif
1212

13+
extern unsigned int __sw_hweight8(unsigned int w);
14+
extern unsigned int __sw_hweight16(unsigned int w);
15+
extern unsigned int __sw_hweight32(unsigned int w);
16+
extern unsigned long __sw_hweight64(__u64 w);
17+
1318
/*
1419
* Include this here because some architectures need generic_ffs/fls in
1520
* scope

0 commit comments

Comments
 (0)