summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-10-30 10:06:57 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2015-11-05 02:26:05 -0800
commitd85780521a600b14bcfac6fc1252c78031834193 (patch)
tree2a034e25dcd0fc9fe494591457565407513c4b5f
parent10f9aa87a6b19b0a538aa78b9b907de78903b920 (diff)
vmwgfx: Introduce compatibility versions of memremap and [READ|WRITE]_ONCE
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
-rw-r--r--vmwgfx_compat.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/vmwgfx_compat.h b/vmwgfx_compat.h
index 158f42d..41a2c96 100644
--- a/vmwgfx_compat.h
+++ b/vmwgfx_compat.h
@@ -488,4 +488,19 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags);
#define smp_mb__after_atomic() smp_mb__after_atomic_inc()
#endif
+/* memremap appeared in 4.3 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))
+#define memremap(_offset, _size, _flag) \
+ (void __force *)ioremap_cache(_offset, _size)
+#define memunmap(_addr) \
+ iounmap((void __iomem *) _addr)
+#endif
+
+/*
+ * READ_ONCE, WRITE_ONCE appeared in 3.19.
+ * This is a simplified version for scalar use only.
+ */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0))
+#define READ_ONCE(_x) (*(volatile typeof(_x) *)&(_x))
+#define WRITE_ONCE(_x, _val) READ_ONCE(_x) = _val
#endif