diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2024-09-03 11:53:58 +0800 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2024-09-04 11:57:48 +0200 |
commit | 85a147a986e4feafb9286fabaf03a302a611cd85 (patch) | |
tree | ba7b3a629e1d27245ced2c98c2c8c39de6c1f971 /kernel/printk | |
parent | 59cd94ef80094857f0d0085daa2e32badc4cddf4 (diff) | |
download | lwn-85a147a986e4feafb9286fabaf03a302a611cd85.tar.gz lwn-85a147a986e4feafb9286fabaf03a302a611cd85.zip |
printk: Use the BITS_PER_LONG macro
sizeof(unsigned long) * 8 is the number of bits in an unsigned long
variable, replace it with BITS_PER_LONG macro to make it simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240903035358.308482-1-ruanjinjie@huawei.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk_ringbuffer.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/printk/printk_ringbuffer.h b/kernel/printk/printk_ringbuffer.h index bd2a892deac1..8de6c495cf2b 100644 --- a/kernel/printk/printk_ringbuffer.h +++ b/kernel/printk/printk_ringbuffer.h @@ -4,6 +4,7 @@ #define _KERNEL_PRINTK_RINGBUFFER_H #include <linux/atomic.h> +#include <linux/bits.h> #include <linux/dev_printk.h> #include <linux/stddef.h> #include <linux/types.h> @@ -122,7 +123,7 @@ enum desc_state { #define _DATA_SIZE(sz_bits) (1UL << (sz_bits)) #define _DESCS_COUNT(ct_bits) (1U << (ct_bits)) -#define DESC_SV_BITS (sizeof(unsigned long) * 8) +#define DESC_SV_BITS BITS_PER_LONG #define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) #define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) #define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT)) |