Commit 7794ec77 authored by Souptick Joarder's avatar Souptick Joarder Committed by Russell King

drm/armada: Adding new typedef vm_fault_t

Use new return type vm_fault_t for fault handler in struct
vm_operations_struct. 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 1c8f4220 ("mm: change return type to vm_fault_t")

Previously vm_insert_pfn() returns err which driver mapped into
VM_FAULT_* type. The new function vmf_insert_pfn() will replace this
inefficiency by returning VM_FAULT_* type.
Signed-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 830aadce
...@@ -13,25 +13,14 @@ ...@@ -13,25 +13,14 @@
#include <drm/armada_drm.h> #include <drm/armada_drm.h>
#include "armada_ioctlP.h" #include "armada_ioctlP.h"
static int armada_gem_vm_fault(struct vm_fault *vmf) static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
{ {
struct drm_gem_object *gobj = vmf->vma->vm_private_data; struct drm_gem_object *gobj = vmf->vma->vm_private_data;
struct armada_gem_object *obj = drm_to_armada_gem(gobj); struct armada_gem_object *obj = drm_to_armada_gem(gobj);
unsigned long pfn = obj->phys_addr >> PAGE_SHIFT; unsigned long pfn = obj->phys_addr >> PAGE_SHIFT;
int ret;
pfn += (vmf->address - vmf->vma->vm_start) >> PAGE_SHIFT; pfn += (vmf->address - vmf->vma->vm_start) >> PAGE_SHIFT;
ret = vm_insert_pfn(vmf->vma, vmf->address, pfn); return vmf_insert_pfn(vmf->vma, vmf->address, pfn);
switch (ret) {
case 0:
case -EBUSY:
return VM_FAULT_NOPAGE;
case -ENOMEM:
return VM_FAULT_OOM;
default:
return VM_FAULT_SIGBUS;
}
} }
const struct vm_operations_struct armada_gem_vm_ops = { const struct vm_operations_struct armada_gem_vm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment