All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2()
@ 2017-10-09  8:40 Geert Uytterhoeven
  2017-10-09 14:34 ` Jakub Kicinski
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2017-10-09  8:40 UTC (permalink / raw)
  To: Jakub Kicinski, Arnd Bergmann, Andrew Morton
  Cc: kbuild test robot, linux-arch, linux-kernel, Geert Uytterhoeven

On most architectures[*], gcc turns __builtin_ffsll() into a call to
__ffsdi2(), which is not provided by any architecture, leading to
failures like:

    rcar-gen3-cpg.c:(.text+0x289): undefined reference to `__ffsdi2'

To fix this, use __ffs64() instead, which is available on all
architectures.

[*] Known exceptions are some 64-bit architectures like amd64, arm64,
    ia64, powerpc64, and tilegx.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 3e9b3112ec74f192 ("add basic register-field manipulation macros")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 include/linux/bitfield.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index 8b9d6fff002db113..0a827677372756fa 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -15,6 +15,7 @@
 #ifndef _LINUX_BITFIELD_H
 #define _LINUX_BITFIELD_H
 
+#include <linux/bitops.h>
 #include <linux/bug.h>
 
 /*
@@ -46,7 +47,7 @@
  *  reg |= FIELD_PREP(REG_FIELD_C, c);
  */
 
-#define __bf_shf(x) (__builtin_ffsll(x) - 1)
+#define __bf_shf(x) __ffs64(x)
 
 #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)			\
 	({								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-10 15:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09  8:40 [PATCH] bitfield: Use __ffs64(x) to fix missing __ffsdi2() Geert Uytterhoeven
2017-10-09 14:34 ` Jakub Kicinski
2017-10-09 22:37 ` kbuild test robot
2017-10-09 22:37   ` kbuild test robot
2017-10-09 22:37   ` kbuild test robot
2017-10-09 22:53 ` Jakub Kicinski
2017-10-10  7:03   ` Geert Uytterhoeven
2017-10-10  7:03     ` Geert Uytterhoeven
2017-10-10 15:06     ` Jakub Kicinski
2017-10-09 22:57 ` kbuild test robot
2017-10-09 22:57   ` kbuild test robot
2017-10-09 22:57   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.