x86/percpu: Use BIT_WORD() and BIT_MASK() macros
Subsystems (2)
PATCH RESEND 1/1 x86/percpu: Use BIT_WORD() and BIT_MASK() macros
Use BIT_WORD() and BIT_MASK() macros from <linux/bits.h> in <arch/x86/include/asm/percpu.h> instead of open-coding them.
No functional change intended.
Signed-off-by Uros Bizjak <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
--- arch/x86/include/asm/percpu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/percpu.h +3 -2
@@ -23,6 +23,7 @@#else /* !__ASSEMBLY__: */ #include <linux/args.h> +#include <linux/bits.h> #include <linux/build_bug.h> #include <linux/stringify.h> #include <asm/asm.h>
@@ -572,9 +573,9 @@ do { \#define x86_this_cpu_constant_test_bit (_nr, _var) \ ({ \ unsigned long __percpu *addr__ = \ - (unsigned long __percpu *)&(_var) + ((_nr) / BITS_PER_LONG); \ + (unsigned long __percpu *)&(_var) + BIT_WORD(_nr); \ \ - !!((1UL << ((_nr) % BITS_PER_LONG)) & raw_cpu_read(*addr__)); \ + !!(BIT_MASK(_nr) & raw_cpu_read(*addr__)); \ })#define x86_this_cpu_variable_test_bit (_nr, _var) \
Signature · 1 line
2.51.0
The following commit has been merged into the x86/cleanups branch of tip:
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: fd4e0255269bca311c90f0d0c1d5bd53c8846a59 Gitweb: https://git.kernel.org/tip/fd4e0255269bca311c90f0d0c1d5bd53c8846a59 Author: Uros Bizjak <[email protected]> AuthorDate: Sun, 07 Sep 2025 20:48:46 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Mon, 10 Nov 2025 11:55:54 +01:00
x86/percpu: Use BIT_WORD() and BIT_MASK() macros
Use BIT_WORD() and BIT_MASK() macros from <linux/bits.h> in <arch/x86/include/asm/percpu.h> instead of open-coding them.
No functional change intended.
Signed-off-by Uros Bizjak <[email protected]>
Signed-off-by Borislav Petkov (AMD) <[email protected]>
--- arch/x86/include/asm/percpu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/percpu.h +3 -2
@@ -23,6 +23,7 @@#else /* !__ASSEMBLY__: */ #include <linux/args.h> +#include <linux/bits.h> #include <linux/build_bug.h> #include <linux/stringify.h> #include <asm/asm.h>
@@ -572,9 +573,9 @@ do { \#define x86_this_cpu_constant_test_bit (_nr, _var) \ ({ \ unsigned long __percpu *addr__ = \ - (unsigned long __percpu *)&(_var) + ((_nr) / BITS_PER_LONG); \ + (unsigned long __percpu *)&(_var) + BIT_WORD(_nr); \ \ - !!((1UL << ((_nr) % BITS_PER_LONG)) & raw_cpu_read(*addr__)); \ + !!(BIT_MASK(_nr) & raw_cpu_read(*addr__)); \ })#define x86_this_cpu_variable_test_bit (_nr, _var) \