Skip to content

Commit 85a147a

Browse files
ruanjinjie-engpmladek
authored andcommitted
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>
1 parent 59cd94e commit 85a147a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/printk/printk_ringbuffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define _KERNEL_PRINTK_RINGBUFFER_H
55

66
#include <linux/atomic.h>
7+
#include <linux/bits.h>
78
#include <linux/dev_printk.h>
89
#include <linux/stddef.h>
910
#include <linux/types.h>
@@ -122,7 +123,7 @@ enum desc_state {
122123

123124
#define _DATA_SIZE(sz_bits) (1UL << (sz_bits))
124125
#define _DESCS_COUNT(ct_bits) (1U << (ct_bits))
125-
#define DESC_SV_BITS (sizeof(unsigned long) * 8)
126+
#define DESC_SV_BITS BITS_PER_LONG
126127
#define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2)
127128
#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT)
128129
#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT))

0 commit comments

Comments
 (0)