From fcd84f2fca49166dab2dba259eca6e633585763f Mon Sep 17 00:00:00 2001 From: Thomas Bogendoerfer Date: Sun, 4 May 2008 00:25:02 +0200 Subject: [MIPS] Fix __fls for non-MIPS32/MIPS64 cpus Only MIPS32 and MIPS64 CPUs implement clz/dclz. Therefore don't export __ilog2() for non MIPS32/MIPS64 cpus and use generic __fls bitop code for these cpus. Signed-off-by: Thomas Bogendoerfer Signed-off-by: Ralf Baechle --- include/asm-mips/bitops.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/asm-mips/bitops.h') diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index c2bd126c3b4e..5e1f590a24a1 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -558,6 +558,8 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long * __clear_bit(nr, addr); } +#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) + /* * Return the bit position (0..63) of the most significant 1 bit in a word * Returns -1 if no 1 bit exists @@ -596,8 +598,6 @@ static inline unsigned long __fls(unsigned long x) return __ilog2(x); } -#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) - /* * __ffs - find first bit in word. * @word: The word to search @@ -654,6 +654,7 @@ static inline int ffs(int word) #else #include +#include #include #include #include -- cgit v1.2.3 From ddc0d009947bf8645fa3543f4532063a787202da Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sun, 4 May 2008 14:53:53 +0100 Subject: [MIPS] Get rid of __ilog2 56a6b1eb7bfb5ace0b5cb9c149f502fbd101b8ab was a bit too conservative and left __ilog2 around which is only used as an internal function for other bitops. Signed-off-by: Ralf Baechle --- include/asm-mips/bitops.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include/asm-mips/bitops.h') diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 5e1f590a24a1..642724734eba 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -564,7 +564,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long * * Return the bit position (0..63) of the most significant 1 bit in a word * Returns -1 if no 1 bit exists */ -static inline int __ilog2(unsigned long x) +static inline unsigned long __fls(unsigned long x) { int lz; @@ -593,11 +593,6 @@ static inline int __ilog2(unsigned long x) return 63 - lz; } -static inline unsigned long __fls(unsigned long x) -{ - return __ilog2(x); -} - /* * __ffs - find first bit in word. * @word: The word to search @@ -607,7 +602,7 @@ static inline unsigned long __fls(unsigned long x) */ static inline unsigned long __ffs(unsigned long word) { - return __ilog2(word & -word); + return __fls(word & -word); } /* -- cgit v1.2.3