Skip to content

Commit fd4e025

Browse files
ubizjakbp3tk0v
authored andcommitted
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 <ubizjak@gmail.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20250907184915.78041-1-ubizjak@gmail.com
1 parent 47955b5 commit fd4e025

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

arch/x86/include/asm/percpu.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#else /* !__ASSEMBLY__: */
2424

2525
#include <linux/args.h>
26+
#include <linux/bits.h>
2627
#include <linux/build_bug.h>
2728
#include <linux/stringify.h>
2829
#include <asm/asm.h>
@@ -572,9 +573,9 @@ do { \
572573
#define x86_this_cpu_constant_test_bit(_nr, _var) \
573574
({ \
574575
unsigned long __percpu *addr__ = \
575-
(unsigned long __percpu *)&(_var) + ((_nr) / BITS_PER_LONG); \
576+
(unsigned long __percpu *)&(_var) + BIT_WORD(_nr); \
576577
\
577-
!!((1UL << ((_nr) % BITS_PER_LONG)) & raw_cpu_read(*addr__)); \
578+
!!(BIT_MASK(_nr) & raw_cpu_read(*addr__)); \
578579
})
579580

580581
#define x86_this_cpu_variable_test_bit(_nr, _var) \

0 commit comments

Comments
 (0)