Skip to content

Commit 85a147a

Browse files
Jinjie Ruanpmladek
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 <[email protected]> Reviewed-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Mladek <[email protected]>
1 parent 59cd94e commit 85a147a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)