Move from the deprecated mmap hook to the new mmap_prepare hook, using the
PFN remap mmap action to map the region.

Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
---
 drivers/soc/qcom/rmtfs_mem.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index 342c0845134e..5e2ac75f41d5 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -129,24 +129,22 @@ static const struct class rmtfs_class = {
        .name           = "rmtfs",
 };
 
-static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma)
+static int qcom_rmtfs_mem_mmap_prepare(struct vm_area_desc *desc)
 {
-       struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data;
+       struct qcom_rmtfs_mem *rmtfs_mem = desc->file->private_data;
 
-       if (vma->vm_end - vma->vm_start > rmtfs_mem->size) {
+       if (vma_desc_size(desc) > rmtfs_mem->size) {
                dev_dbg(&rmtfs_mem->dev,
                        "vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n",
-                       vma->vm_end, vma->vm_start,
-                       (vma->vm_end - vma->vm_start), &rmtfs_mem->size);
+                       desc->end, desc->start, vma_desc_size(desc),
+                       &rmtfs_mem->size);
                return -EINVAL;
        }
 
-       vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
-       return remap_pfn_range(vma,
-                              vma->vm_start,
-                              rmtfs_mem->addr >> PAGE_SHIFT,
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot);
+       desc->page_prot = pgprot_writecombine(desc->page_prot);
+       mmap_action_remap_full(desc, rmtfs_mem->addr >> PAGE_SHIFT);
+
+       return 0;
 }
 
 static const struct file_operations qcom_rmtfs_mem_fops = {
@@ -156,7 +154,7 @@ static const struct file_operations qcom_rmtfs_mem_fops = {
        .write = qcom_rmtfs_mem_write,
        .release = qcom_rmtfs_mem_release,
        .llseek = default_llseek,
-       .mmap = qcom_rmtfs_mem_mmap,
+       .mmap_prepare = qcom_rmtfs_mem_mmap_prepare,
 };
 
 static void qcom_rmtfs_mem_release_device(struct device *dev)

-- 
2.56.0


Reply via email to