[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range



Convert to use vm_insert_range() to map range of kernel
memory to user vma.

Signed-off-by: Souptick Joarder <jrdr.linux@xxxxxxxxx>
Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
---
 drivers/gpu/drm/xen/xen_drm_front_gem.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c 
b/drivers/gpu/drm/xen/xen_drm_front_gem.c
index 47ff019..c21e5d1 100644
--- a/drivers/gpu/drm/xen/xen_drm_front_gem.c
+++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c
@@ -225,8 +225,7 @@ struct drm_gem_object *
 static int gem_mmap_obj(struct xen_gem_object *xen_obj,
                        struct vm_area_struct *vma)
 {
-       unsigned long addr = vma->vm_start;
-       int i;
+       int ret;
 
        /*
         * clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
@@ -247,18 +246,11 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj,
         * FIXME: as we insert all the pages now then no .fault handler must
         * be called, so don't provide one
         */
-       for (i = 0; i < xen_obj->num_pages; i++) {
-               int ret;
-
-               ret = vm_insert_page(vma, addr, xen_obj->pages[i]);
-               if (ret < 0) {
-                       DRM_ERROR("Failed to insert pages into vma: %d\n", ret);
-                       return ret;
-               }
-
-               addr += PAGE_SIZE;
-       }
-       return 0;
+       ret = vm_insert_range(vma, vma->vm_start, xen_obj->pages,
+                               xen_obj->num_pages);
+       if (ret < 0)
+               DRM_ERROR("Failed to insert pages into vma: %d\n", ret);
+       return ret;
 }
 
 int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma)
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.