Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make <asm-x86/spinlock.h> use ACCESS_ONCE()

..instead of cooking up its own uglier local version of it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+4 -14
+4 -14
include/asm-x86/spinlock.h
··· 20 20 */ 21 21 22 22 #ifdef CONFIG_X86_32 23 - typedef char _slock_t; 24 - # define LOCK_INS_DEC "decb" 25 - # define LOCK_INS_XCH "xchgb" 26 - # define LOCK_INS_MOV "movb" 27 - # define LOCK_INS_CMP "cmpb" 28 23 # define LOCK_PTR_REG "a" 29 24 #else 30 - typedef int _slock_t; 31 - # define LOCK_INS_DEC "decl" 32 - # define LOCK_INS_XCH "xchgl" 33 - # define LOCK_INS_MOV "movl" 34 - # define LOCK_INS_CMP "cmpl" 35 25 # define LOCK_PTR_REG "D" 36 26 #endif 37 27 ··· 56 66 #if (NR_CPUS < 256) 57 67 static inline int __raw_spin_is_locked(raw_spinlock_t *lock) 58 68 { 59 - int tmp = *(volatile signed int *)(&(lock)->slock); 69 + int tmp = ACCESS_ONCE(lock->slock); 60 70 61 71 return (((tmp >> 8) & 0xff) != (tmp & 0xff)); 62 72 } 63 73 64 74 static inline int __raw_spin_is_contended(raw_spinlock_t *lock) 65 75 { 66 - int tmp = *(volatile signed int *)(&(lock)->slock); 76 + int tmp = ACCESS_ONCE(lock->slock); 67 77 68 78 return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; 69 79 } ··· 120 130 #else 121 131 static inline int __raw_spin_is_locked(raw_spinlock_t *lock) 122 132 { 123 - int tmp = *(volatile signed int *)(&(lock)->slock); 133 + int tmp = ACCESS_ONCE(lock->slock); 124 134 125 135 return (((tmp >> 16) & 0xffff) != (tmp & 0xffff)); 126 136 } 127 137 128 138 static inline int __raw_spin_is_contended(raw_spinlock_t *lock) 129 139 { 130 - int tmp = *(volatile signed int *)(&(lock)->slock); 140 + int tmp = ACCESS_ONCE(lock->slock); 131 141 132 142 return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; 133 143 }