summaryrefslogtreecommitdiffstats
path: root/scripts/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/include/asm-generic')
-rw-r--r--scripts/include/asm-generic/bitops/__ffs.h3
-rw-r--r--scripts/include/asm-generic/bitops/atomic.h9
-rw-r--r--scripts/include/asm-generic/bitsperlong.h12
3 files changed, 19 insertions, 5 deletions
diff --git a/scripts/include/asm-generic/bitops/__ffs.h b/scripts/include/asm-generic/bitops/__ffs.h
index c94175015a..15ffaa12c5 100644
--- a/scripts/include/asm-generic/bitops/__ffs.h
+++ b/scripts/include/asm-generic/bitops/__ffs.h
@@ -2,6 +2,7 @@
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_
#include <asm/types.h>
+#include <asm-generic/bitsperlong.h>
/**
* __ffs - find first bit in word.
@@ -13,7 +14,7 @@ static __always_inline unsigned long __ffs(unsigned long word)
{
int num = 0;
-#if __BITS_PER_LONG == 64
+#if BITS_PER_LONG == 64
if ((word & 0xffffffff) == 0) {
num += 32;
word >>= 32;
diff --git a/scripts/include/asm-generic/bitops/atomic.h b/scripts/include/asm-generic/bitops/atomic.h
index 4bccd7c3d5..03fe804024 100644
--- a/scripts/include/asm-generic/bitops/atomic.h
+++ b/scripts/include/asm-generic/bitops/atomic.h
@@ -2,21 +2,22 @@
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
#include <asm/types.h>
+#include <asm-generic/bitsperlong.h>
static inline void set_bit(int nr, unsigned long *addr)
{
- addr[nr / __BITS_PER_LONG] |= 1UL << (nr % __BITS_PER_LONG);
+ addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
}
static inline void clear_bit(int nr, unsigned long *addr)
{
- addr[nr / __BITS_PER_LONG] &= ~(1UL << (nr % __BITS_PER_LONG));
+ addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
}
static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
{
- return ((1UL << (nr % __BITS_PER_LONG)) &
- (((unsigned long *)addr)[nr / __BITS_PER_LONG])) != 0;
+ return ((1UL << (nr % BITS_PER_LONG)) &
+ (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
}
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */
diff --git a/scripts/include/asm-generic/bitsperlong.h b/scripts/include/asm-generic/bitsperlong.h
new file mode 100644
index 0000000000..eb2dfd9065
--- /dev/null
+++ b/scripts/include/asm-generic/bitsperlong.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __BITS_PER_LONG_H_
+#define __BITS_PER_LONG_H_
+
+#ifndef __WORDSIZE
+#define __WORDSIZE (__SIZEOF_LONG__ * 8)
+#endif
+
+#define BITS_PER_LONG __WORDSIZE
+
+#endif