lkml.org 
[lkml]   [2014]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] cmpxchg: Discard unnecessary cast to volatile
ping.

On Wed, Oct 1, 2014 at 1:57 PM, Pranith Kumar <bobby.prani@gmail.com> wrote:
> 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
>



--
Pranith


\
 
 \ /
  Last update: 2014-10-20 22:41    [W:0.569 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site