From: Thomas Gleixner <tglx@linutronix.de>
To: Alexey Dobriyan <adobriyan@gmail.com>,
dennis@kernel.org, tj@kernel.org, cl@linux.com
Cc: linux-mm@kvack.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com
Subject: Re: [PATCH] x86/percpu: fix cast in __pcpu_cast_* macros
Date: Wed, 29 May 2024 09:54:33 +0200 [thread overview]
Message-ID: <87cyp59hom.ffs@tglx> (raw)
In-Reply-To: <c818d685-6609-450b-a695-44b5c57518a7@p183>
On Mon, May 27 2024 at 08:51, Alexey Dobriyan wrote:
> Fix compile failure
>
> this_cpu_add(*p, x = 1);
>
> kernel/test.c:7:29: error: lvalue required as left operand of assignment
> 7 | this_cpu_add(*p, x = 1);
> | ^
> arch/x86/include/asm/percpu.h:134:51: note: in definition of macro '__pcpu_cast_1'
> 134 | #define __pcpu_cast_1(val) ((u8)(((unsigned long) val) & 0xff))
>
>
> This pattern is almost always wrong:
>
> #define M(x) ((T)x)
>
> also because it can't be used with assignment expressions: cast makes
> left part of it non-lvalue and assignment to non-lvalue has to break
> compilation.
In principle I agree with the change itself, but I really don't see the
point for
this_cpu_add(*p, x = 1);
Even if C supports it, it's just nasty and tasteless.
Thanks,
tglx
prev parent reply other threads:[~2024-05-29 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 5:51 [PATCH] x86/percpu: fix cast in __pcpu_cast_* macros Alexey Dobriyan
[not found] ` <81264b6c-fd23-2ee5-52cd-249047e317a7@linux.com>
2024-05-28 20:49 ` Dennis Zhou
2024-05-29 7:54 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyp59hom.ffs@tglx \
--to=tglx@linutronix.de \
--cc=adobriyan@gmail.com \
--cc=bp@alien8.de \
--cc=cl@linux.com \
--cc=dave.hansen@linux.intel.com \
--cc=dennis@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.