Move from the deprecated mmap hook to the new mmap_prepare hook.

The hook only sets VMA flags and operations. The VMA private data is
already NULL at this point, so we no longer explicitly clear it.

Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
---
 drivers/xen/privcmd.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 5e56fbc93447..16f96c05af2d 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -1630,14 +1630,13 @@ static const struct vm_operations_struct privcmd_vm_ops 
= {
        .fault = privcmd_fault
 };
 
-static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+static int privcmd_mmap_prepare(struct vm_area_desc *desc)
 {
        /* DONTCOPY is essential for Xen because copy_page_range doesn't know
         * how to recreate these mappings */
-       vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTCOPY |
-                        VM_DONTEXPAND | VM_DONTDUMP);
-       vma->vm_ops = &privcmd_vm_ops;
-       vma->vm_private_data = NULL;
+       vma_desc_set_flags(desc, VMA_IO_BIT, VMA_PFNMAP_BIT, VMA_DONTCOPY_BIT,
+                          VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT);
+       desc->vm_ops = &privcmd_vm_ops;
 
        return 0;
 }
@@ -1666,7 +1665,7 @@ const struct file_operations xen_privcmd_fops = {
        .unlocked_ioctl = privcmd_ioctl,
        .open = privcmd_open,
        .release = privcmd_release,
-       .mmap = privcmd_mmap,
+       .mmap_prepare = privcmd_mmap_prepare,
 };
 EXPORT_SYMBOL_GPL(xen_privcmd_fops);
 

-- 
2.56.0


Reply via email to