diff mbox

[v2] gpu: drm: virtio: code cleanup

Message ID 20180703153353.GA3375@jordon-HP-15-Notebook-PC (mailing list archive)
State New, archived
Headers show

Commit Message

Souptick Joarder July 3, 2018, 3:33 p.m. UTC
The fault handler code is commented since v4.2.
If there is no plan to enable the fault handler
code in future, we can remove this dead code.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
v2: corrected subject line

 drivers/gpu/drm/virtio/virtgpu_ttm.c | 36 +-----------------------------------
 1 file changed, 1 insertion(+), 35 deletions(-)

Comments

Souptick Joarder July 17, 2018, 11:34 a.m. UTC | #1
On Tue, Jul 3, 2018 at 9:03 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> The fault handler code is commented since v4.2.
> If there is no plan to enable the fault handler
> code in future, we can remove this dead code.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> v2: corrected subject line
>

Any further comment on this patch ?

>  drivers/gpu/drm/virtio/virtgpu_ttm.c | 36 +-----------------------------------
>  1 file changed, 1 insertion(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
> index 11f8ae5..b6f021c 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
> @@ -106,29 +106,6 @@ static void virtio_gpu_ttm_global_fini(struct virtio_gpu_device *vgdev)
>         }
>  }
>
> -#if 0
> -/*
> - * Hmm, seems to not do anything useful.  Leftover debug hack?
> - * Something like printing pagefaults to kernel log?
> - */
> -static struct vm_operations_struct virtio_gpu_ttm_vm_ops;
> -static const struct vm_operations_struct *ttm_vm_ops;
> -
> -static int virtio_gpu_ttm_fault(struct vm_fault *vmf)
> -{
> -       struct ttm_buffer_object *bo;
> -       struct virtio_gpu_device *vgdev;
> -       int r;
> -
> -       bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data;
> -       if (bo == NULL)
> -               return VM_FAULT_NOPAGE;
> -       vgdev = virtio_gpu_get_vgdev(bo->bdev);
> -       r = ttm_vm_ops->fault(vmf);
> -       return r;
> -}
> -#endif
> -
>  int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>  {
>         struct drm_file *file_priv;
> @@ -143,19 +120,8 @@ int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>                 return -EINVAL;
>         }
>         r = ttm_bo_mmap(filp, vma, &vgdev->mman.bdev);
> -#if 0
> -       if (unlikely(r != 0))
> -               return r;
> -       if (unlikely(ttm_vm_ops == NULL)) {
> -               ttm_vm_ops = vma->vm_ops;
> -               virtio_gpu_ttm_vm_ops = *ttm_vm_ops;
> -               virtio_gpu_ttm_vm_ops.fault = &virtio_gpu_ttm_fault;
> -       }
> -       vma->vm_ops = &virtio_gpu_ttm_vm_ops;
> -       return 0;
> -#else
> +
>         return r;
> -#endif
>  }
>
>  static int virtio_gpu_invalidate_caches(struct ttm_bo_device *bdev,
> --
> 1.9.1
>
Souptick Joarder July 24, 2018, 6:03 a.m. UTC | #2
On Tue, Jul 17, 2018 at 5:04 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Tue, Jul 3, 2018 at 9:03 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> The fault handler code is commented since v4.2.
>> If there is no plan to enable the fault handler
>> code in future, we can remove this dead code.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> ---
>> v2: corrected subject line
>>
>
> Any further comment on this patch ?

If no further comment, can we get this patch in queue for 4.19 ?

>
>>  drivers/gpu/drm/virtio/virtgpu_ttm.c | 36 +-----------------------------------
>>  1 file changed, 1 insertion(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
>> index 11f8ae5..b6f021c 100644
>> --- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
>> +++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
>> @@ -106,29 +106,6 @@ static void virtio_gpu_ttm_global_fini(struct virtio_gpu_device *vgdev)
>>         }
>>  }
>>
>> -#if 0
>> -/*
>> - * Hmm, seems to not do anything useful.  Leftover debug hack?
>> - * Something like printing pagefaults to kernel log?
>> - */
>> -static struct vm_operations_struct virtio_gpu_ttm_vm_ops;
>> -static const struct vm_operations_struct *ttm_vm_ops;
>> -
>> -static int virtio_gpu_ttm_fault(struct vm_fault *vmf)
>> -{
>> -       struct ttm_buffer_object *bo;
>> -       struct virtio_gpu_device *vgdev;
>> -       int r;
>> -
>> -       bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data;
>> -       if (bo == NULL)
>> -               return VM_FAULT_NOPAGE;
>> -       vgdev = virtio_gpu_get_vgdev(bo->bdev);
>> -       r = ttm_vm_ops->fault(vmf);
>> -       return r;
>> -}
>> -#endif
>> -
>>  int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>>  {
>>         struct drm_file *file_priv;
>> @@ -143,19 +120,8 @@ int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>>                 return -EINVAL;
>>         }
>>         r = ttm_bo_mmap(filp, vma, &vgdev->mman.bdev);
>> -#if 0
>> -       if (unlikely(r != 0))
>> -               return r;
>> -       if (unlikely(ttm_vm_ops == NULL)) {
>> -               ttm_vm_ops = vma->vm_ops;
>> -               virtio_gpu_ttm_vm_ops = *ttm_vm_ops;
>> -               virtio_gpu_ttm_vm_ops.fault = &virtio_gpu_ttm_fault;
>> -       }
>> -       vma->vm_ops = &virtio_gpu_ttm_vm_ops;
>> -       return 0;
>> -#else
>> +
>>         return r;
>> -#endif
>>  }
>>
>>  static int virtio_gpu_invalidate_caches(struct ttm_bo_device *bdev,
>> --
>> 1.9.1
>>
Souptick Joarder July 30, 2018, 4:46 a.m. UTC | #3
On Tue, Jul 24, 2018 at 11:33 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Tue, Jul 17, 2018 at 5:04 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> On Tue, Jul 3, 2018 at 9:03 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>>> The fault handler code is commented since v4.2.
>>> If there is no plan to enable the fault handler
>>> code in future, we can remove this dead code.
>>>
>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>> ---
>>> v2: corrected subject line
>>>
>>
>> Any further comment on this patch ?
>
> If no further comment, can we get this patch in queue for 4.19 ?
>

Gerd, can we get this patch in queue for 4.19 ?

>>
>>>  drivers/gpu/drm/virtio/virtgpu_ttm.c | 36 +-----------------------------------
>>>  1 file changed, 1 insertion(+), 35 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
>>> index 11f8ae5..b6f021c 100644
>>> --- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
>>> +++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
>>> @@ -106,29 +106,6 @@ static void virtio_gpu_ttm_global_fini(struct virtio_gpu_device *vgdev)
>>>         }
>>>  }
>>>
>>> -#if 0
>>> -/*
>>> - * Hmm, seems to not do anything useful.  Leftover debug hack?
>>> - * Something like printing pagefaults to kernel log?
>>> - */
>>> -static struct vm_operations_struct virtio_gpu_ttm_vm_ops;
>>> -static const struct vm_operations_struct *ttm_vm_ops;
>>> -
>>> -static int virtio_gpu_ttm_fault(struct vm_fault *vmf)
>>> -{
>>> -       struct ttm_buffer_object *bo;
>>> -       struct virtio_gpu_device *vgdev;
>>> -       int r;
>>> -
>>> -       bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data;
>>> -       if (bo == NULL)
>>> -               return VM_FAULT_NOPAGE;
>>> -       vgdev = virtio_gpu_get_vgdev(bo->bdev);
>>> -       r = ttm_vm_ops->fault(vmf);
>>> -       return r;
>>> -}
>>> -#endif
>>> -
>>>  int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>>>  {
>>>         struct drm_file *file_priv;
>>> @@ -143,19 +120,8 @@ int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
>>>                 return -EINVAL;
>>>         }
>>>         r = ttm_bo_mmap(filp, vma, &vgdev->mman.bdev);
>>> -#if 0
>>> -       if (unlikely(r != 0))
>>> -               return r;
>>> -       if (unlikely(ttm_vm_ops == NULL)) {
>>> -               ttm_vm_ops = vma->vm_ops;
>>> -               virtio_gpu_ttm_vm_ops = *ttm_vm_ops;
>>> -               virtio_gpu_ttm_vm_ops.fault = &virtio_gpu_ttm_fault;
>>> -       }
>>> -       vma->vm_ops = &virtio_gpu_ttm_vm_ops;
>>> -       return 0;
>>> -#else
>>> +
>>>         return r;
>>> -#endif
>>>  }
>>>
>>>  static int virtio_gpu_invalidate_caches(struct ttm_bo_device *bdev,
>>> --
>>> 1.9.1
>>>
diff mbox

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 11f8ae5..b6f021c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -106,29 +106,6 @@  static void virtio_gpu_ttm_global_fini(struct virtio_gpu_device *vgdev)
 	}
 }
 
-#if 0
-/*
- * Hmm, seems to not do anything useful.  Leftover debug hack?
- * Something like printing pagefaults to kernel log?
- */
-static struct vm_operations_struct virtio_gpu_ttm_vm_ops;
-static const struct vm_operations_struct *ttm_vm_ops;
-
-static int virtio_gpu_ttm_fault(struct vm_fault *vmf)
-{
-	struct ttm_buffer_object *bo;
-	struct virtio_gpu_device *vgdev;
-	int r;
-
-	bo = (struct ttm_buffer_object *)vmf->vma->vm_private_data;
-	if (bo == NULL)
-		return VM_FAULT_NOPAGE;
-	vgdev = virtio_gpu_get_vgdev(bo->bdev);
-	r = ttm_vm_ops->fault(vmf);
-	return r;
-}
-#endif
-
 int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
 {
 	struct drm_file *file_priv;
@@ -143,19 +120,8 @@  int virtio_gpu_mmap(struct file *filp, struct vm_area_struct *vma)
 		return -EINVAL;
 	}
 	r = ttm_bo_mmap(filp, vma, &vgdev->mman.bdev);
-#if 0
-	if (unlikely(r != 0))
-		return r;
-	if (unlikely(ttm_vm_ops == NULL)) {
-		ttm_vm_ops = vma->vm_ops;
-		virtio_gpu_ttm_vm_ops = *ttm_vm_ops;
-		virtio_gpu_ttm_vm_ops.fault = &virtio_gpu_ttm_fault;
-	}
-	vma->vm_ops = &virtio_gpu_ttm_vm_ops;
-	return 0;
-#else
+
 	return r;
-#endif
 }
 
 static int virtio_gpu_invalidate_caches(struct ttm_bo_device *bdev,