diff mbox

[02/14] drm/exynos: remove function convert_to_vm_err_msg

Message ID 1438073609-32664-2-git-send-email-jy0922.shim@samsung.com
State New, archived
Headers show

Commit Message

Joonyoung Shim July 28, 2015, 8:53 a.m. UTC
The convert_to_vm_err_msg is called just once by exynos_drm_gem_fault,
so it's simple not to use the function.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

Comments

Inki Dae Aug. 16, 2015, 4:39 a.m. UTC | #1
On 2015? 07? 28? 17:53, Joonyoung Shim wrote:
> The convert_to_vm_err_msg is called just once by exynos_drm_gem_fault,
> so it's simple not to use the function.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 33 +++++++++------------------------
>  1 file changed, 9 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index d320acd..752cb7c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -20,29 +20,6 @@
>  #include "exynos_drm_buf.h"
>  #include "exynos_drm_iommu.h"
>  
> -static unsigned int convert_to_vm_err_msg(int msg)
> -{
> -	unsigned int out_msg;
> -
> -	switch (msg) {
> -	case 0:
> -	case -ERESTARTSYS:
> -	case -EINTR:
> -		out_msg = VM_FAULT_NOPAGE;
> -		break;
> -
> -	case -ENOMEM:
> -		out_msg = VM_FAULT_OOM;
> -		break;
> -
> -	default:
> -		out_msg = VM_FAULT_SIGBUS;
> -		break;
> -	}
> -
> -	return out_msg;
> -}
> -
>  static int check_gem_flags(unsigned int flags)
>  {
>  	if (flags & ~(EXYNOS_BO_MASK)) {
> @@ -600,7 +577,15 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>  
>  	mutex_unlock(&dev->struct_mutex);
>  
> -	return convert_to_vm_err_msg(ret);
> +	switch (ret) {
> +	case 0:
> +	case -ERESTARTSYS:

You missed -EINTR but I can modify it.

Thanks,
Inki Dae

> +		return VM_FAULT_NOPAGE;
> +	case -ENOMEM:
> +		return VM_FAULT_OOM;
> +	default:
> +		return VM_FAULT_SIGBUS;
> +	}
>  }
>  
>  int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index d320acd..752cb7c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -20,29 +20,6 @@ 
 #include "exynos_drm_buf.h"
 #include "exynos_drm_iommu.h"
 
-static unsigned int convert_to_vm_err_msg(int msg)
-{
-	unsigned int out_msg;
-
-	switch (msg) {
-	case 0:
-	case -ERESTARTSYS:
-	case -EINTR:
-		out_msg = VM_FAULT_NOPAGE;
-		break;
-
-	case -ENOMEM:
-		out_msg = VM_FAULT_OOM;
-		break;
-
-	default:
-		out_msg = VM_FAULT_SIGBUS;
-		break;
-	}
-
-	return out_msg;
-}
-
 static int check_gem_flags(unsigned int flags)
 {
 	if (flags & ~(EXYNOS_BO_MASK)) {
@@ -600,7 +577,15 @@  int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
 	mutex_unlock(&dev->struct_mutex);
 
-	return convert_to_vm_err_msg(ret);
+	switch (ret) {
+	case 0:
+	case -ERESTARTSYS:
+		return VM_FAULT_NOPAGE;
+	case -ENOMEM:
+		return VM_FAULT_OOM;
+	default:
+		return VM_FAULT_SIGBUS;
+	}
 }
 
 int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)