aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/bitops.h')
-rw-r--r--include/asm-mips/bitops.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index c2bd126c3b4e..642724734eba 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -558,11 +558,13 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
558 __clear_bit(nr, addr); 558 __clear_bit(nr, addr);
559} 559}
560 560
561#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
562
561/* 563/*
562 * Return the bit position (0..63) of the most significant 1 bit in a word 564 * Return the bit position (0..63) of the most significant 1 bit in a word
563 * Returns -1 if no 1 bit exists 565 * Returns -1 if no 1 bit exists
564 */ 566 */
565static inline int __ilog2(unsigned long x) 567static inline unsigned long __fls(unsigned long x)
566{ 568{
567 int lz; 569 int lz;
568 570
@@ -591,13 +593,6 @@ static inline int __ilog2(unsigned long x)
591 return 63 - lz; 593 return 63 - lz;
592} 594}
593 595
594static inline unsigned long __fls(unsigned long x)
595{
596 return __ilog2(x);
597}
598
599#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
600
601/* 596/*
602 * __ffs - find first bit in word. 597 * __ffs - find first bit in word.
603 * @word: The word to search 598 * @word: The word to search
@@ -607,7 +602,7 @@ static inline unsigned long __fls(unsigned long x)
607 */ 602 */
608static inline unsigned long __ffs(unsigned long word) 603static inline unsigned long __ffs(unsigned long word)
609{ 604{
610 return __ilog2(word & -word); 605 return __fls(word & -word);
611} 606}
612 607
613/* 608/*
@@ -654,6 +649,7 @@ static inline int ffs(int word)
654#else 649#else
655 650
656#include <asm-generic/bitops/__ffs.h> 651#include <asm-generic/bitops/__ffs.h>
652#include <asm-generic/bitops/__fls.h>
657#include <asm-generic/bitops/ffs.h> 653#include <asm-generic/bitops/ffs.h>
658#include <asm-generic/bitops/fls.h> 654#include <asm-generic/bitops/fls.h>
659#include <asm-generic/bitops/fls64.h> 655#include <asm-generic/bitops/fls64.h>