diff options
Diffstat (limited to 'include/linux/seqlock.h')
-rw-r--r-- | include/linux/seqlock.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index e98cd2e57194..c6db9fb33c44 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/preempt.h> | 30 | #include <linux/preempt.h> |
31 | #include <asm/processor.h> | ||
31 | 32 | ||
32 | typedef struct { | 33 | typedef struct { |
33 | unsigned sequence; | 34 | unsigned sequence; |
@@ -41,9 +42,6 @@ typedef struct { | |||
41 | #define __SEQLOCK_UNLOCKED(lockname) \ | 42 | #define __SEQLOCK_UNLOCKED(lockname) \ |
42 | { 0, __SPIN_LOCK_UNLOCKED(lockname) } | 43 | { 0, __SPIN_LOCK_UNLOCKED(lockname) } |
43 | 44 | ||
44 | #define SEQLOCK_UNLOCKED \ | ||
45 | __SEQLOCK_UNLOCKED(old_style_seqlock_init) | ||
46 | |||
47 | #define seqlock_init(x) \ | 45 | #define seqlock_init(x) \ |
48 | do { \ | 46 | do { \ |
49 | (x)->sequence = 0; \ | 47 | (x)->sequence = 0; \ |
@@ -88,12 +86,12 @@ static __always_inline unsigned read_seqbegin(const seqlock_t *sl) | |||
88 | unsigned ret; | 86 | unsigned ret; |
89 | 87 | ||
90 | repeat: | 88 | repeat: |
91 | ret = sl->sequence; | 89 | ret = ACCESS_ONCE(sl->sequence); |
92 | smp_rmb(); | ||
93 | if (unlikely(ret & 1)) { | 90 | if (unlikely(ret & 1)) { |
94 | cpu_relax(); | 91 | cpu_relax(); |
95 | goto repeat; | 92 | goto repeat; |
96 | } | 93 | } |
94 | smp_rmb(); | ||
97 | 95 | ||
98 | return ret; | 96 | return ret; |
99 | } | 97 | } |