mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
gpu: drm: udl: Adding new typedef vm_fault_t
Use new return type vm_fault_t for fault and huge_fault
handler. For now, this is just documenting that the
function returns a VM_FAULT value rather than an errno.
Once all instances are converted, vm_fault_t will become
a distinct type.
Commit 1c8f422059
("mm: change return type to vm_fault_t")
Previously vm_insert_page() returns err which driver
mapped into VM_FAULT_* type. The new function vmf_
insert_page() will replace this inefficiency by
returning VM_FAULT_* type.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180425045922.GA21590@jordon-HP-15-Notebook-PC
This commit is contained in:
parent
ca510ead96
commit
3c5f134ac9
2 changed files with 4 additions and 14 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
#include <drm/drm_gem.h>
|
#include <drm/drm_gem.h>
|
||||||
|
#include <linux/mm_types.h>
|
||||||
|
|
||||||
#define DRIVER_NAME "udl"
|
#define DRIVER_NAME "udl"
|
||||||
#define DRIVER_DESC "DisplayLink"
|
#define DRIVER_DESC "DisplayLink"
|
||||||
|
@ -136,7 +137,7 @@ void udl_gem_put_pages(struct udl_gem_object *obj);
|
||||||
int udl_gem_vmap(struct udl_gem_object *obj);
|
int udl_gem_vmap(struct udl_gem_object *obj);
|
||||||
void udl_gem_vunmap(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_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||||
int udl_gem_fault(struct vm_fault *vmf);
|
vm_fault_t udl_gem_fault(struct vm_fault *vmf);
|
||||||
|
|
||||||
int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
|
int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
|
@ -100,13 +100,12 @@ int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int udl_gem_fault(struct vm_fault *vmf)
|
vm_fault_t udl_gem_fault(struct vm_fault *vmf)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma = vmf->vma;
|
struct vm_area_struct *vma = vmf->vma;
|
||||||
struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data);
|
struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data);
|
||||||
struct page *page;
|
struct page *page;
|
||||||
unsigned int page_offset;
|
unsigned int page_offset;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
|
page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
|
||||||
|
|
||||||
|
@ -114,17 +113,7 @@ int udl_gem_fault(struct vm_fault *vmf)
|
||||||
return VM_FAULT_SIGBUS;
|
return VM_FAULT_SIGBUS;
|
||||||
|
|
||||||
page = obj->pages[page_offset];
|
page = obj->pages[page_offset];
|
||||||
ret = vm_insert_page(vma, vmf->address, page);
|
return vmf_insert_page(vma, vmf->address, page);
|
||||||
switch (ret) {
|
|
||||||
case -EAGAIN:
|
|
||||||
case 0:
|
|
||||||
case -ERESTARTSYS:
|
|
||||||
return VM_FAULT_NOPAGE;
|
|
||||||
case -ENOMEM:
|
|
||||||
return VM_FAULT_OOM;
|
|
||||||
default:
|
|
||||||
return VM_FAULT_SIGBUS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int udl_gem_get_pages(struct udl_gem_object *obj)
|
int udl_gem_get_pages(struct udl_gem_object *obj)
|
||||||
|
|
Loading…
Reference in a new issue