Commit 8a8d9b2c authored by Souptick Joarder's avatar Souptick Joarder Committed by Inki Dae

gpu: drm: exynos: Change return type to vm_fault_t

Use new return type vm_fault_t for fault handler
in struct vm_operations_struct.
Signed-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent bec923c5
...@@ -431,37 +431,24 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, ...@@ -431,37 +431,24 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
return 0; return 0;
} }
int exynos_drm_gem_fault(struct vm_fault *vmf) vm_fault_t exynos_drm_gem_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct drm_gem_object *obj = vma->vm_private_data; struct drm_gem_object *obj = vma->vm_private_data;
struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
unsigned long pfn; unsigned long pfn;
pgoff_t page_offset; pgoff_t page_offset;
int ret;
page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT; page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
if (page_offset >= (exynos_gem->size >> PAGE_SHIFT)) { if (page_offset >= (exynos_gem->size >> PAGE_SHIFT)) {
DRM_ERROR("invalid page offset\n"); DRM_ERROR("invalid page offset\n");
ret = -EINVAL; return VM_FAULT_SIGBUS;
goto out;
} }
pfn = page_to_pfn(exynos_gem->pages[page_offset]); pfn = page_to_pfn(exynos_gem->pages[page_offset]);
ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV)); return vmf_insert_mixed(vma, vmf->address,
__pfn_to_pfn_t(pfn, PFN_DEV));
out:
switch (ret) {
case 0:
case -ERESTARTSYS:
case -EINTR:
return VM_FAULT_NOPAGE;
case -ENOMEM:
return VM_FAULT_OOM;
default:
return VM_FAULT_SIGBUS;
}
} }
static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj, static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define _EXYNOS_DRM_GEM_H_ #define _EXYNOS_DRM_GEM_H_
#include <drm/drm_gem.h> #include <drm/drm_gem.h>
#include <linux/mm_types.h>
#define to_exynos_gem(x) container_of(x, struct exynos_drm_gem, base) #define to_exynos_gem(x) container_of(x, struct exynos_drm_gem, base)
...@@ -111,7 +112,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, ...@@ -111,7 +112,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
struct drm_mode_create_dumb *args); struct drm_mode_create_dumb *args);
/* page fault handler and mmap fault address(virtual) to physical memory. */ /* page fault handler and mmap fault address(virtual) to physical memory. */
int exynos_drm_gem_fault(struct vm_fault *vmf); vm_fault_t exynos_drm_gem_fault(struct vm_fault *vmf);
/* set vm_flags and we can change the vm attribute to other one at here. */ /* set vm_flags and we can change the vm attribute to other one at here. */
int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
......
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