summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-10-30 16:17:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-11-01 10:08:38 +0100
commit43cbf3f0b718a8c8b0cfc4bb351dde39c6ea9b05 (patch)
tree802c8e6a79a3db46142b3e0f89ce384897e58ad0 /scripts
parent547333d3c27882bae37ee5833d2dac6f31c29c97 (diff)
downloadbarebox-43cbf3f0b718a8c8b0cfc4bb351dde39c6ea9b05.tar.gz
barebox-43cbf3f0b718a8c8b0cfc4bb351dde39c6ea9b05.tar.xz
scripts: <linux/bitops.h>: fix references to undefined __BITS_PER_LONG
No where do we define __BITS_PER_LONG, but we know about BITS_PER_LONG. Fix it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-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
-rw-r--r--scripts/include/linux/bitops.h7
4 files changed, 20 insertions, 11 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
diff --git a/scripts/include/linux/bitops.h b/scripts/include/linux/bitops.h
index c9ec614e0d..60f5c5b4f9 100644
--- a/scripts/include/linux/bitops.h
+++ b/scripts/include/linux/bitops.h
@@ -4,12 +4,7 @@
#include <asm/types.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
-
-#ifndef __WORDSIZE
-#define __WORDSIZE (__SIZEOF_LONG__ * 8)
-#endif
-
-#define BITS_PER_LONG __WORDSIZE
+#include <asm-generic/bitsperlong.h>
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)