Skip to content

Commit

Permalink
x86: reintroduce volatile keyword in prototype to clflush()
Browse files Browse the repository at this point in the history
The volatile keyword was removed from the clflush() prototype
in commit e34907a; the comment there
states:

    x86: remove volatile keyword from clflush.

    the p parameter is an explicit memory reference, and is
    enough to prevent gcc to being nasty here. The volatile
    seems completely not needed.

This reflects incorrect understanding of the function of the volatile
keyword there.  The purpose of the volatile keyword is informing gcc
that it is safe to pass a volatile pointer to this function.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
H. Peter Anvin authored and Ingo Molnar committed Feb 4, 2008
1 parent 2b06ac8 commit 84fb144
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/asm-x86/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ static inline void native_wbinvd(void)

#endif /* __KERNEL__ */

static inline void clflush(void *__p)
static inline void clflush(volatile void *__p)
{
asm volatile("clflush %0" : "+m" (*(char __force *)__p));
asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
}

#define nop() __asm__ __volatile__ ("nop")
Expand Down

0 comments on commit 84fb144

Please sign in to comment.