summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2021-04-19 17:02:09 -0500
committerSuman Anna <s-anna@ti.com>2021-04-20 15:49:01 -0500
commit848305ff419af69b2a88f2da081b603f19eb2c09 (patch)
treeef7b741e2c40060f5eb1c4635308ddd964089a00
parentebe913b4124e7fcfc20481257e32feb686d3a1b4 (diff)
downloadlinuxutils-848305ff419af69b2a88f2da081b603f19eb2c09.tar.gz
cmemk: Fix usage of mmap_sem for 5.8+ kernels
The mmap_sem locking semantics were abstracted out in preparation for some scalability work in v5.8 kernel. The mmap_sem field is no longer defined (renamed), and is abstracted out through newly introduced mmap_read_{lock,unlock} wrappers in a new mmap_lock.h file in commit 9740ca4e95b4 ("mmap locking API: initial implementation as rwsem wrappers"). Adopt to these new wrappers to fix the CMEM kernel module build against these newer kernels. Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--src/cmem/module/cmemk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmem/module/cmemk.c b/src/cmem/module/cmemk.c
index 7e3042b..6295a9e 100644
--- a/src/cmem/module/cmemk.c
+++ b/src/cmem/module/cmemk.c
@@ -625,12 +625,20 @@ void HeapMem_free(int bi, phys_addr_t block, size_t size)
static inline void cmem_mmap_read_lock(struct mm_struct *mm)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
down_read(&mm->mmap_sem);
+#else
+ mmap_read_lock(mm);
+#endif
}
static inline void cmem_mmap_read_unlock(struct mm_struct *mm)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
up_read(&mm->mmap_sem);
+#else
+ mmap_read_unlock(mm);
+#endif
}
/* Traverses the page tables and translates a virtual address to a physical. */