[PATCH 2/2] arm64: Use the generic builtin-* ffs/fls implementation

From: Catalin Marinas
Date: Wed Sep 12 2012 - 17:06:22 EST


This patch removes the arm64-specific ffs/fls implementation and
includes the generic gcc builtins implementation.

Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
---
arch/arm64/include/asm/bitops.h | 31 +++++--------------------------
1 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/arch/arm64/include/asm/bitops.h b/arch/arm64/include/asm/bitops.h
index 67df4d2..5e69307 100644
--- a/arch/arm64/include/asm/bitops.h
+++ b/arch/arm64/include/asm/bitops.h
@@ -28,36 +28,15 @@
#define smp_mb__after_clear_bit() smp_mb()
#endif

-/*
- * Use compiler builtins for simple inline operations.
- */
-static inline unsigned long __ffs(unsigned long word)
-{
- return __builtin_ffsl(word) - 1;
-}
-
-static inline int ffs(int x)
-{
- return __builtin_ffs(x);
-}
-
-static inline unsigned long __fls(unsigned long word)
-{
- return BITS_PER_LONG - 1 - __builtin_clzl(word);
-}
-
-static inline int fls(int x)
-{
- return x ? sizeof(x) * BITS_PER_BYTE - __builtin_clz(x) : 0;
-}
-
-/*
- * Mainly use the generic routines for now.
- */
#ifndef _LINUX_BITOPS_H
#error only <linux/bitops.h> can be included directly
#endif

+#include <asm-generic/bitops/builtin-__ffs.h>
+#include <asm-generic/bitops/builtin-ffs.h>
+#include <asm-generic/bitops/builtin-__fls.h>
+#include <asm-generic/bitops/builtin-fls.h>
+
#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/find.h>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/