diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index c0e62f811e094a4aa09e788129e306c6e2647580..9e69cfb7f1342a86c4e22617d36cefbf6289de80 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h @@ -148,6 +148,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) #define ffs kernel_ffs #include +#include #include #include #include diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h index cb18e3b0aa948520b8f7321e6ead3d00eb1d5cf2..cb9ddf5fc54ff3837c8393a8e891a8e4766216f9 100644 --- a/arch/h8300/include/asm/bitops.h +++ b/arch/h8300/include/asm/bitops.h @@ -207,6 +207,7 @@ static __inline__ unsigned long __ffs(unsigned long word) #endif /* __KERNEL__ */ #include +#include #include #endif /* _H8300_BITOPS_H */ diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index 39456ba0ec17c7156c5a7fef5baed6cbf60f74e2..287f6f697ce276d55b498cea168a67e402e6b5bf 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h @@ -339,6 +339,19 @@ int __ffs(unsigned long x) return 31 - bit; } +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static inline unsigned long __fls(unsigned long word) +{ + unsigned long bit; + asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word)); + return bit; +} + /* * special slimline version of fls() for calculating ilog2_u32() * - note: no protection against n == 0 diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h index 6dc9b81bf9f36544eeacfee071866629f220ce5c..aaddf0d5760326626616ecfdf3c884c196f924bb 100644 --- a/include/asm-m32r/bitops.h +++ b/include/asm-m32r/bitops.h @@ -251,6 +251,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) #include #include #include +#include #include #ifdef __KERNEL__ diff --git a/include/asm-mn10300/bitops.h b/include/asm-mn10300/bitops.h index cc6d40c05cf3a369951ed8571f7bf226c844405f..0b610f482abb9fbe0622e9b6758cbc758e046de3 100644 --- a/include/asm-mn10300/bitops.h +++ b/include/asm-mn10300/bitops.h @@ -195,6 +195,17 @@ int fls(int x) return (x != 0) ? __ilog2_u32(x) + 1 : 0; } +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static inline unsigned long __fls(unsigned long word) +{ + return __ilog2_u32(word); +} + /** * ffs - find first bit set * @x: the word to search diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index 23261e8f2e5ac4c15cf36a23921f3cd9cb654b5f..6c3930397bd32539716f51c0cd23a290efa74cdd 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h @@ -82,6 +82,16 @@ static inline int fls (unsigned int x) return 32 - __cntlz(x); } +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static inline unsigned long __fls(unsigned long word) +{ + return 31 - __cntlz(word); +} #else /* Use the generic implementation if we don't have the nsa/nsau instructions. */ @@ -90,6 +100,7 @@ static inline int fls (unsigned int x) # include # include # include +# include #endif