From: Pranith Kumar <bobby.prani@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org (maintainer:X86 ARCHITECTURE...),
Borislav Petkov <bp@suse.de>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE...)
Subject: [PATCH] cmpxchg: Discard unnecessary cast to volatile
Date: Wed, 1 Oct 2014 13:57:27 -0400 [thread overview]
Message-ID: <1412186248-18672-1-git-send-email-bobby.prani@gmail.com> (raw)
Generating a volatile pointer is really not necessary here. This is the only
location where a volatile pointer is being generated for use in asm.
This commit removes the unnecessary volatile pointer being created.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
arch/x86/include/asm/cmpxchg.h | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index 99c105d7..f0baea8 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -90,36 +90,32 @@ extern void __add_wrong_size(void)
switch (size) { \
case __X86_CASE_B: \
{ \
- volatile u8 *__ptr = (volatile u8 *)(ptr); \
asm volatile(lock "cmpxchgb %2,%1" \
- : "=a" (__ret), "+m" (*__ptr) \
+ : "=a" (__ret), "+m" (*ptr) \
: "q" (__new), "0" (__old) \
: "memory"); \
break; \
} \
case __X86_CASE_W: \
{ \
- volatile u16 *__ptr = (volatile u16 *)(ptr); \
asm volatile(lock "cmpxchgw %2,%1" \
- : "=a" (__ret), "+m" (*__ptr) \
+ : "=a" (__ret), "+m" (*ptr) \
: "r" (__new), "0" (__old) \
: "memory"); \
break; \
} \
case __X86_CASE_L: \
{ \
- volatile u32 *__ptr = (volatile u32 *)(ptr); \
asm volatile(lock "cmpxchgl %2,%1" \
- : "=a" (__ret), "+m" (*__ptr) \
+ : "=a" (__ret), "+m" (*ptr) \
: "r" (__new), "0" (__old) \
: "memory"); \
break; \
} \
case __X86_CASE_Q: \
{ \
- volatile u64 *__ptr = (volatile u64 *)(ptr); \
asm volatile(lock "cmpxchgq %2,%1" \
- : "=a" (__ret), "+m" (*__ptr) \
+ : "=a" (__ret), "+m" (*ptr) \
: "r" (__new), "0" (__old) \
: "memory"); \
break; \
--
1.9.1
next reply other threads:[~2014-10-01 17:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 17:57 Pranith Kumar [this message]
2014-10-20 20:22 ` Pranith Kumar
2014-10-21 10:14 ` Peter Zijlstra
2014-10-21 15:48 ` H. Peter Anvin
2014-10-21 22:15 ` Pranith Kumar
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=1412186248-18672-1-git-send-email-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome