diff mbox series

[v2] drm/vkms: Use new return type vm_fault_t

Message ID 20180726144549.GA9434@jordon-HP-15-Notebook-PC (mailing list archive)
State New, archived
Headers show
Series [v2] drm/vkms: Use new return type vm_fault_t | expand

Commit Message

Souptick Joarder July 26, 2018, 2:45 p.m. UTC
Use new return type vm_fault_t for fault handler.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
v2: Updated patch title

 drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
 drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Rodrigo Siqueira July 29, 2018, 12:38 p.m. UTC | #1
On 07/26, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> v2: Updated patch title
> 
>  drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
>  drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 07be29f..d5d04a8 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -65,7 +65,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
>  				       u32 *handle,
>  				       u64 size);
>  
> -int vkms_gem_fault(struct vm_fault *vmf);
> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
>  
>  int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
>  		     struct drm_mode_create_dumb *args);
> diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
> index c7e3836..62e05dc 100644
> --- a/drivers/gpu/drm/vkms/vkms_gem.c
> +++ b/drivers/gpu/drm/vkms/vkms_gem.c
> @@ -43,14 +43,14 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
>  	kfree(gem);
>  }
>  
> -int vkms_gem_fault(struct vm_fault *vmf)
> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct vkms_gem_object *obj = vma->vm_private_data;
>  	unsigned long vaddr = vmf->address;
>  	pgoff_t page_offset;
>  	loff_t num_pages;
> -	int ret;
> +	vm_fault_t ret = VM_FAULT_SIGBUS;
>  
>  	page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
>  	num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
> @@ -58,7 +58,6 @@ int vkms_gem_fault(struct vm_fault *vmf)
>  	if (page_offset > num_pages)
>  		return VM_FAULT_SIGBUS;
>  
> -	ret = -ENOENT;
>  	mutex_lock(&obj->pages_lock);
>  	if (obj->pages) {
>  		get_page(obj->pages[page_offset]);
> -- 
> 1.9.1
>

Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Souptick Joarder July 30, 2018, 4:45 a.m. UTC | #2
On Sun, Jul 29, 2018 at 6:08 PM, Rodrigo Siqueira
<rodrigosiqueiramelo@gmail.com> wrote:
> On 07/26, Souptick Joarder wrote:
>> Use new return type vm_fault_t for fault handler.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> ---
>> v2: Updated patch title
>>
>>  drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
>>  drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
>>  2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
>> index 07be29f..d5d04a8 100644
>> --- a/drivers/gpu/drm/vkms/vkms_drv.h
>> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
>> @@ -65,7 +65,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
>>                                      u32 *handle,
>>                                      u64 size);
>>
>> -int vkms_gem_fault(struct vm_fault *vmf);
>> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
>>
>>  int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
>>                    struct drm_mode_create_dumb *args);
>> diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
>> index c7e3836..62e05dc 100644
>> --- a/drivers/gpu/drm/vkms/vkms_gem.c
>> +++ b/drivers/gpu/drm/vkms/vkms_gem.c
>> @@ -43,14 +43,14 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
>>       kfree(gem);
>>  }
>>
>> -int vkms_gem_fault(struct vm_fault *vmf)
>> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
>>  {
>>       struct vm_area_struct *vma = vmf->vma;
>>       struct vkms_gem_object *obj = vma->vm_private_data;
>>       unsigned long vaddr = vmf->address;
>>       pgoff_t page_offset;
>>       loff_t num_pages;
>> -     int ret;
>> +     vm_fault_t ret = VM_FAULT_SIGBUS;
>>
>>       page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
>>       num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
>> @@ -58,7 +58,6 @@ int vkms_gem_fault(struct vm_fault *vmf)
>>       if (page_offset > num_pages)
>>               return VM_FAULT_SIGBUS;
>>
>> -     ret = -ENOENT;
>>       mutex_lock(&obj->pages_lock);
>>       if (obj->pages) {
>>               get_page(obj->pages[page_offset]);
>> --
>> 1.9.1
>>
>
> Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>

Rodrigo, can we get this patch in queue for 4.19 ?
Gustavo Padovan July 30, 2018, 6:34 p.m. UTC | #3
Hi Souptick,

On Thu, Jul 26, 2018 at 08:15:49PM +0530, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> v2: Updated patch title
> 
>  drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
>  drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 07be29f..d5d04a8 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -65,7 +65,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
>  				       u32 *handle,
>  				       u64 size);
>  
> -int vkms_gem_fault(struct vm_fault *vmf);
> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
>  
>  int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
>  		     struct drm_mode_create_dumb *args);
> diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
> index c7e3836..62e05dc 100644
> --- a/drivers/gpu/drm/vkms/vkms_gem.c
> +++ b/drivers/gpu/drm/vkms/vkms_gem.c
> @@ -43,14 +43,14 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
>  	kfree(gem);
>  }
>  
> -int vkms_gem_fault(struct vm_fault *vmf)
> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct vkms_gem_object *obj = vma->vm_private_data;
>  	unsigned long vaddr = vmf->address;
>  	pgoff_t page_offset;
>  	loff_t num_pages;
> -	int ret;
> +	vm_fault_t ret = VM_FAULT_SIGBUS;
>  
>  	page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
>  	num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
> @@ -58,7 +58,6 @@ int vkms_gem_fault(struct vm_fault *vmf)
>  	if (page_offset > num_pages)
>  		return VM_FAULT_SIGBUS;
>  
> -	ret = -ENOENT;
>  	mutex_lock(&obj->pages_lock);
>  	if (obj->pages) {
>  		get_page(obj->pages[page_offset]);
> -- 
> 1.9.1

Patch pushed to drm-misc-next. vkms is still experimental so I'm not
queueing this for 4.19. Thanks.

Gustavo
Souptick Joarder Aug. 28, 2018, 4:53 p.m. UTC | #4
On Tue, Jul 31, 2018 at 12:05 AM Gustavo Padovan <gustavo@padovan.org> wrote:
>
> Hi Souptick,
>
> On Thu, Jul 26, 2018 at 08:15:49PM +0530, Souptick Joarder wrote:
> > Use new return type vm_fault_t for fault handler.
> >
> > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > ---
> > v2: Updated patch title
> >
> >  drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
> >  drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
> >  2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> > index 07be29f..d5d04a8 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.h
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> > @@ -65,7 +65,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
> >                                      u32 *handle,
> >                                      u64 size);
> >
> > -int vkms_gem_fault(struct vm_fault *vmf);
> > +vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
> >
> >  int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
> >                    struct drm_mode_create_dumb *args);
> > diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
> > index c7e3836..62e05dc 100644
> > --- a/drivers/gpu/drm/vkms/vkms_gem.c
> > +++ b/drivers/gpu/drm/vkms/vkms_gem.c
> > @@ -43,14 +43,14 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
> >       kfree(gem);
> >  }
> >
> > -int vkms_gem_fault(struct vm_fault *vmf)
> > +vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
> >  {
> >       struct vm_area_struct *vma = vmf->vma;
> >       struct vkms_gem_object *obj = vma->vm_private_data;
> >       unsigned long vaddr = vmf->address;
> >       pgoff_t page_offset;
> >       loff_t num_pages;
> > -     int ret;
> > +     vm_fault_t ret = VM_FAULT_SIGBUS;
> >
> >       page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
> >       num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
> > @@ -58,7 +58,6 @@ int vkms_gem_fault(struct vm_fault *vmf)
> >       if (page_offset > num_pages)
> >               return VM_FAULT_SIGBUS;
> >
> > -     ret = -ENOENT;
> >       mutex_lock(&obj->pages_lock);
> >       if (obj->pages) {
> >               get_page(obj->pages[page_offset]);
> > --
> > 1.9.1
>
> Patch pushed to drm-misc-next. vkms is still experimental so I'm not
> queueing this for 4.19. Thanks.
>
> Gustavo

Gustavo, can we get this patch into 4.19-rc-x ?
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 07be29f..d5d04a8 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -65,7 +65,7 @@  struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
 				       u32 *handle,
 				       u64 size);
 
-int vkms_gem_fault(struct vm_fault *vmf);
+vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
 
 int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
 		     struct drm_mode_create_dumb *args);
diff --git a/drivers/gpu/drm/vkms/vkms_gem.c b/drivers/gpu/drm/vkms/vkms_gem.c
index c7e3836..62e05dc 100644
--- a/drivers/gpu/drm/vkms/vkms_gem.c
+++ b/drivers/gpu/drm/vkms/vkms_gem.c
@@ -43,14 +43,14 @@  void vkms_gem_free_object(struct drm_gem_object *obj)
 	kfree(gem);
 }
 
-int vkms_gem_fault(struct vm_fault *vmf)
+vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct vkms_gem_object *obj = vma->vm_private_data;
 	unsigned long vaddr = vmf->address;
 	pgoff_t page_offset;
 	loff_t num_pages;
-	int ret;
+	vm_fault_t ret = VM_FAULT_SIGBUS;
 
 	page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
 	num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
@@ -58,7 +58,6 @@  int vkms_gem_fault(struct vm_fault *vmf)
 	if (page_offset > num_pages)
 		return VM_FAULT_SIGBUS;
 
-	ret = -ENOENT;
 	mutex_lock(&obj->pages_lock);
 	if (obj->pages) {
 		get_page(obj->pages[page_offset]);