mm, drm/udl: fixup vma flags on mmap
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Sat, 31 Mar 2012 09:29:25 +0000 (13:29 +0400)
committerDave Airlie <airlied@redhat.com>
Mon, 2 Apr 2012 10:08:17 +0000 (11:08 +0100)
There should be VM_MIXEDMAP, not VM_PFNMAP, because udl_gem_fault() inserts
pages via vm_insert_page(). Other drm/gem drivers already do this.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/udl/udl_drv.c
drivers/gpu/drm/udl/udl_drv.h
drivers/gpu/drm/udl/udl_gem.c

index 5340c5f3987b0831d7d11f9c7a8c55735f14c4f5..53673907a6a0d93cf9367b62fdad247939bc70d3 100644 (file)
@@ -47,7 +47,7 @@ static struct vm_operations_struct udl_gem_vm_ops = {
 static const struct file_operations udl_driver_fops = {
        .owner = THIS_MODULE,
        .open = drm_open,
-       .mmap = drm_gem_mmap,
+       .mmap = udl_drm_gem_mmap,
        .poll = drm_poll,
        .read = drm_read,
        .unlocked_ioctl = drm_ioctl,
index 1612954a5bc4452e20bffdb30ab8e66b86f9e4cf..96820d03a30394a9e6b5eb8c42e528b5459ff931 100644 (file)
@@ -121,6 +121,7 @@ struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev,
 
 int udl_gem_vmap(struct udl_gem_object *obj);
 void udl_gem_vunmap(struct udl_gem_object *obj);
+int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
 int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 
 int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
index 852642dc11878ff912682628c097e8757bc7acb5..92f19ef329b0319819e47b57a007538275c93eaa 100644 (file)
@@ -71,6 +71,20 @@ int udl_dumb_destroy(struct drm_file *file, struct drm_device *dev,
        return drm_gem_handle_delete(file, handle);
 }
 
+int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+       int ret;
+
+       ret = drm_gem_mmap(filp, vma);
+       if (ret)
+               return ret;
+
+       vma->vm_flags &= ~VM_PFNMAP;
+       vma->vm_flags |= VM_MIXEDMAP;
+
+       return ret;
+}
+
 int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data);