Skip to contentSkip to conversation

tile: use asm-generic/bitops/builtin-*.h

PATCH In review Akinobu Mita 2 participants 2 messages Aug 14, 2013 Bitops API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tile: use asm-generic/bitops/builtin-*.h

The definisions of __ffs(), __fls(), and ffs() for tile are almost same as asm-generic/bitops-*.h. The only difference is that it is defined as __always_inline or inline. So this switches to use those headers.

---
 arch/tile/include/asm/bitops.h | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)
arch/tile/include/asm/bitops.h +3 -35
index bd186c4..a7ac45e 100644
@@ -28,16 +28,7 @@
 #include <asm/bitops_32.h>
 #endif
 
-/**
- * __ffs - find first set bit in word
- * @word: The word to search
- *
- * Undefined if no set bit exists, so code should check against 0 first.
- */
-static inline unsigned long __ffs(unsigned long word)
-{
-	return __builtin_ctzl(word);
-}
+#include <asm-generic/bitops/builtin-__ffs.h>
 
 /**
  * ffz - find first zero bit in word
@@ -50,32 +41,9 @@ static inline unsigned long ffz(unsigned long word)
 	return __builtin_ctzl(~word);
 }
 
-/**
- * __fls - find last set bit in 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 (sizeof(word) * 8) - 1 - __builtin_clzl(word);
-}
+#include <asm-generic/bitops/builtin-__fls.h>
 
-/**
- * ffs - find first set bit in word
- * @x: the word to search
- *
- * This is defined the same way as the libc and compiler builtin ffs
- * routines, therefore differs in spirit from the other bitops.
- *
- * ffs(value) returns 0 if value is 0 or the position of the first
- * set bit if value is nonzero. The first (least significant) bit
- * is at position 1.
- */
-static inline int ffs(int x)
-{
-	return __builtin_ffs(x);
-}
+#include <asm-generic/bitops/builtin-ffs.h>
 
 static inline int fls64(__u64 w)
 {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · Akinobu Mita

The definisions of __ffs(), __fls(), and ffs() for tile are almost same as asm-generic/bitops-*.h. The only difference is that it is defined as __always_inline or inline. So this switches to use those headers.

---
 arch/tile/include/asm/bitops.h | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

Thanks; taken into the tile tree (though I moved the new #includes to the end of the header with the other asm-generic #includes).

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com