* cast inside __pcpu_cast_1 macro
@ 2023-12-12 11:49 Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2023-12-12 11:49 UTC (permalink / raw)
To: Brian Gerst
Cc: linux-kernel, linux-mm, Dennis Zhou, Tejun Heo, Christoph Lameter, x86
Hi, Brian.
You've added the following macros in
commit 6865dc3ae93b9acb336ca48bd7b2db3446d89370
x86/percpu: Introduce size abstraction macros
+#define __pcpu_cast_1(val) ((u8)(((unsigned long) val) & 0xff))
+#define __pcpu_cast_2(val) ((u16)(((unsigned long) val) & 0xffff))
+#define __pcpu_cast_4(val) ((u32)(((unsigned long) val) & 0xffffffff))
+#define __pcpu_cast_8(val) ((u64)(val))
They break complation if "val" is something complex like
this_cpu_write(pcp, *x = 1);
Only __pcpu_cast_8() is correct in this regard.
"val" should be in parenthesis at least.
Is there a reason for casts to "unsigned long"?
Why not just
#define __pcpu_cast_1(val) ((u8)(val))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-12 11:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12 11:49 cast inside __pcpu_cast_1 macro Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox