summaryrefslogtreecommitdiffstats
path: root/qemu/include/qemu/seqlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/include/qemu/seqlock.h')
-rw-r--r--qemu/include/qemu/seqlock.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/qemu/include/qemu/seqlock.h b/qemu/include/qemu/seqlock.h
index 3ff118a1a..70b01fd60 100644
--- a/qemu/include/qemu/seqlock.h
+++ b/qemu/include/qemu/seqlock.h
@@ -55,18 +55,18 @@ static inline void seqlock_write_unlock(QemuSeqLock *sl)
static inline unsigned seqlock_read_begin(QemuSeqLock *sl)
{
/* Always fail if a write is in progress. */
- unsigned ret = sl->sequence & ~1;
+ unsigned ret = atomic_read(&sl->sequence);
/* Read sequence before reading other fields. */
smp_rmb();
- return ret;
+ return ret & ~1;
}
-static int seqlock_read_retry(const QemuSeqLock *sl, unsigned start)
+static inline int seqlock_read_retry(const QemuSeqLock *sl, unsigned start)
{
/* Read other fields before reading final sequence. */
smp_rmb();
- return unlikely(sl->sequence != start);
+ return unlikely(atomic_read(&sl->sequence) != start);
}
#endif