[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFqt6zZJPPBbOV21+Hu6jfuSW7p4Ym=SiKH5GtdXuCprP=CeZQ@mail.gmail.com>
Date: Wed, 4 Jul 2018 20:17:17 +0530
From: Souptick Joarder <jrdr.linux@...il.com>
To: Matthew Wilcox <willy@...radead.org>,
Eric Anholt <eric@...olt.net>, airlied@...ux.ie
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
SUMAN TRIPATHI <svptas.linux@...il.com>,
brajeswar.linux@...il.com,
Sabyasachi Gupta <sabyasachi.linux@...il.com>,
ajitn.linux@...il.com
Subject: Re: [PATCH v2] gpu: drm: v3d: use new return type vm_fault_t
please ignore this mail.
On Wed, Jul 4, 2018 at 8:18 PM, Souptick Joarder <jrdr.linux@...il.com> wrote:
> Convert v3d_gem_fault to return vm_fault_t
>
> Instead of converting an errno into a vm_fault_t ourselves, use
> vmf_insert_mixed() which returns a vm_fault_t directly.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@...il.com>
> ---
> drivers/gpu/drm/v3d/v3d_bo.c | 28 +++++-----------------------
> drivers/gpu/drm/v3d/v3d_drv.h | 3 ++-
> 2 files changed, 7 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
> index 7b1e2a5..54d9651 100644
> --- a/drivers/gpu/drm/v3d/v3d_bo.c
> +++ b/drivers/gpu/drm/v3d/v3d_bo.c
> @@ -227,37 +227,19 @@ struct reservation_object *v3d_prime_res_obj(struct drm_gem_object *obj)
> vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> }
>
> -int v3d_gem_fault(struct vm_fault *vmf)
> +vm_fault_t v3d_gem_fault(struct vm_fault *vmf)
> {
> struct vm_area_struct *vma = vmf->vma;
> struct drm_gem_object *obj = vma->vm_private_data;
> struct v3d_bo *bo = to_v3d_bo(obj);
> - unsigned long pfn;
> + pfn_t pfn;
> pgoff_t pgoff;
> - int ret;
>
> /* We don't use vmf->pgoff since that has the fake offset: */
> pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
> - pfn = page_to_pfn(bo->pages[pgoff]);
> -
> - ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
> -
> - switch (ret) {
> - case -EAGAIN:
> - case 0:
> - case -ERESTARTSYS:
> - case -EINTR:
> - case -EBUSY:
> - /*
> - * EBUSY is ok: this just means that another thread
> - * already did the job.
> - */
> - return VM_FAULT_NOPAGE;
> - case -ENOMEM:
> - return VM_FAULT_OOM;
> - default:
> - return VM_FAULT_SIGBUS;
> - }
> + pfn = __pfn_to_pfn_t(page_to_pfn(bo->pages[pgoff]), PFN_DEV);
> +
> + return vmf_insert_mixed(vma, vmf->address, pfn);
> }
>
> int v3d_mmap(struct file *filp, struct vm_area_struct *vma)
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h
> index a043ac3..09aa634 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.h
> +++ b/drivers/gpu/drm/v3d/v3d_drv.h
> @@ -2,6 +2,7 @@
> /* Copyright (C) 2015-2018 Broadcom */
>
> #include <linux/reservation.h>
> +#include <linux/mm_types.h>
> #include <drm/drmP.h>
> #include <drm/drm_encoder.h>
> #include <drm/drm_gem.h>
> @@ -248,7 +249,7 @@ int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
> int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
> -int v3d_gem_fault(struct vm_fault *vmf);
> +vm_fault_t v3d_gem_fault(struct vm_fault *vmf);
> int v3d_mmap(struct file *filp, struct vm_area_struct *vma);
> struct reservation_object *v3d_prime_res_obj(struct drm_gem_object *obj);
> int v3d_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
> --
> 1.9.1
>
Powered by blists - more mailing lists