mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro
@ 2024-09-03  3:53 Jinjie Ruan
  2024-09-03  7:49 ` John Ogness
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jinjie Ruan @ 2024-09-03  3:53 UTC (permalink / raw)
  To: pmladek, rostedt, john.ogness, senozhatsky, linux-kernel; +Cc: ruanjinjie

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>
---
v2:
- Add include.
---
 kernel/printk/printk_ringbuffer.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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))
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro
  2024-09-03  3:53 [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro Jinjie Ruan
@ 2024-09-03  7:49 ` John Ogness
  2024-09-04 10:04 ` Petr Mladek
  2024-09-09 17:27 ` [tip: sched/rt] " tip-bot2 for Jinjie Ruan
  2 siblings, 0 replies; 4+ messages in thread
From: John Ogness @ 2024-09-03  7:49 UTC (permalink / raw)
  To: Jinjie Ruan, pmladek, rostedt, senozhatsky, linux-kernel; +Cc: ruanjinjie

On 2024-09-03, Jinjie Ruan <ruanjinjie@huawei.com> wrote:
> 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>
> ---
> v2:
> - Add include.

Thanks.

Reviewed-by: John Ogness <john.ogness@linutronix.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro
  2024-09-03  3:53 [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro Jinjie Ruan
  2024-09-03  7:49 ` John Ogness
@ 2024-09-04 10:04 ` Petr Mladek
  2024-09-09 17:27 ` [tip: sched/rt] " tip-bot2 for Jinjie Ruan
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Mladek @ 2024-09-04 10:04 UTC (permalink / raw)
  To: Jinjie Ruan; +Cc: rostedt, john.ogness, senozhatsky, linux-kernel

On Tue 2024-09-03 11:53:58, Jinjie Ruan wrote:
> 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: Petr Mladek <pmladek@suse.com>

JFYI, the patch has been committed into printk/linux.git,
branch rework/write_atomic. It is intended for 6.12 merge window.

I have chosen this branch because it modified the list of included
files in kernel/printk/printk_ringbuffer.h as well. It allowed to apply
the patch without conflicts.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: sched/rt] printk: Use the BITS_PER_LONG macro
  2024-09-03  3:53 [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro Jinjie Ruan
  2024-09-03  7:49 ` John Ogness
  2024-09-04 10:04 ` Petr Mladek
@ 2024-09-09 17:27 ` tip-bot2 for Jinjie Ruan
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Jinjie Ruan @ 2024-09-09 17:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jinjie Ruan, John Ogness, Petr Mladek, x86, linux-kernel

The following commit has been merged into the sched/rt branch of tip:

Commit-ID:     85a147a986e4feafb9286fabaf03a302a611cd85
Gitweb:        https://git.kernel.org/tip/85a147a986e4feafb9286fabaf03a302a611cd85
Author:        Jinjie Ruan <ruanjinjie@huawei.com>
AuthorDate:    Tue, 03 Sep 2024 11:53:58 +08:00
Committer:     Petr Mladek <pmladek@suse.com>
CommitterDate: Wed, 04 Sep 2024 11:57:48 +02:00

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>
---
 kernel/printk/printk_ringbuffer.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/printk_ringbuffer.h b/kernel/printk/printk_ringbuffer.h
index bd2a892..8de6c49 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))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-09 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-03  3:53 [PATCH -next v2 RESEND] printk: Use the BITS_PER_LONG macro Jinjie Ruan
2024-09-03  7:49 ` John Ogness
2024-09-04 10:04 ` Petr Mladek
2024-09-09 17:27 ` [tip: sched/rt] " tip-bot2 for Jinjie Ruan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®