summaryrefslogtreecommitdiff
path: root/include/linux/seqlock.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-17 01:05:20 +0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-24 02:01:54 +0400
commit0ea5a520f73ca31abc4c10b6d5bc14a884a0641b (patch)
tree8d97283712062b622411281cd5bb7f19e9447689 /include/linux/seqlock.h
parent0e5ac3a8b100469ea154f87dd57b685fbdd356f6 (diff)
downloadlinux-0ea5a520f73ca31abc4c10b6d5bc14a884a0641b.tar.xz
seqcount: Provide raw_read_seqcount()
raw_read_seqcount opens a read critical section of the given seqcount without any lockdep checking and without checking or masking the LSB. Calling code is responsible for handling that. Preparatory patch to provide a NMI safe clock monotonic accessor function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/seqlock.h')
-rw-r--r--include/linux/seqlock.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..dcc64b9bfc41 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -117,6 +117,22 @@ repeat:
}
/**
+ * raw_read_seqcount - Read the raw seqcount
+ * @s: pointer to seqcount_t
+ * Returns: count to be passed to read_seqcount_retry
+ *
+ * raw_read_seqcount opens a read critical section of the given
+ * seqcount without any lockdep checking and without checking or
+ * masking the LSB. Calling code is responsible for handling that.
+ */
+static inline unsigned raw_read_seqcount(const seqcount_t *s)
+{
+ unsigned ret = ACCESS_ONCE(s->sequence);
+ smp_rmb();
+ return ret;
+}
+
+/**
* raw_read_seqcount_begin - start seq-read critical section w/o lockdep
* @s: pointer to seqcount_t
* Returns: count to be passed to read_seqcount_retry