Re: [PATCH net-next v1 7/7] net: hsr: use BIT() macro for bit shift constant
From: Felix Maurer <hidden>
Date: 2026-03-26 16:26:20
Also in:
lkml
From: Felix Maurer <hidden>
Date: 2026-03-26 16:26:20
Also in:
lkml
On Tue, Mar 24, 2026 at 03:46:30PM +0100, luka.gejak@linux.dev wrote:
From: Luka Gejak <redacted> Replace the explicit bit shift (1 << HSR_SEQ_BLOCK_SHIFT) with the standardized BIT() macro for defining HSR_SEQ_BLOCK_SIZE. This improves readability and aligns with kernel coding conventions.
I know that checkpatch suggests this, but I don't agree with it: HSR_SEQ_BLOCK_SHIFT is not a bitmap but a number, so in my opinion the BIT() macro makes this particular define harder to read/understand.
Signed-off-by: Luka Gejak <redacted> --- net/hsr/hsr_framereg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h index c65ecb925734..cb731ee0ce5c 100644 --- a/net/hsr/hsr_framereg.h +++ b/net/hsr/hsr_framereg.h@@ -79,7 +79,7 @@ struct hsr_seq_block *hsr_get_seq_block(struct hsr_node *node, u16 block_idx); #endif #define HSR_SEQ_BLOCK_SHIFT 7 /* 128 bits */ -#define HSR_SEQ_BLOCK_SIZE (1 << HSR_SEQ_BLOCK_SHIFT) +#define HSR_SEQ_BLOCK_SIZE BIT(HSR_SEQ_BLOCK_SHIFT) #define HSR_SEQ_BLOCK_MASK (HSR_SEQ_BLOCK_SIZE - 1) #define HSR_MAX_SEQ_BLOCKS 64 --2.53.0