diff mbox

[24/41] drm/rockchip: Use .dumb_map_offset and .dumb_destroy defaults

Message ID 1500837417-40580-25-git-send-email-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show

Commit Message

Noralf Trønnes July 23, 2017, 7:16 p.m. UTC
This driver can use the drm_driver.dumb_destroy and
drm_driver.dumb_map_offset defaults, so no need to set them.

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  2 --
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 26 --------------------------
 drivers/gpu/drm/rockchip/rockchip_drm_gem.h |  3 ---
 3 files changed, 31 deletions(-)

Comments

Sean Paul July 26, 2017, 2:19 p.m. UTC | #1
On Sun, Jul 23, 2017 at 09:16:40PM +0200, Noralf Trønnes wrote:
> This driver can use the drm_driver.dumb_destroy and
> drm_driver.dumb_map_offset defaults, so no need to set them.
> 
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  2 --
>  drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 26 --------------------------
>  drivers/gpu/drm/rockchip/rockchip_drm_gem.h |  3 ---
>  3 files changed, 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 131cb5c..848edcf 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -233,8 +233,6 @@ static struct drm_driver rockchip_drm_driver = {
>  	.gem_vm_ops		= &drm_gem_cma_vm_ops,
>  	.gem_free_object_unlocked = rockchip_gem_free_object,
>  	.dumb_create		= rockchip_gem_dumb_create,
> -	.dumb_map_offset	= rockchip_gem_dumb_map_offset,
> -	.dumb_destroy		= drm_gem_dumb_destroy,
>  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
>  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
>  	.gem_prime_import	= drm_gem_prime_import,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> index b74ac71..f74333e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> @@ -393,32 +393,6 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
>  	return ERR_PTR(ret);
>  }
>  
> -int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
> -				 struct drm_device *dev, uint32_t handle,
> -				 uint64_t *offset)
> -{
> -	struct drm_gem_object *obj;
> -	int ret;
> -
> -	obj = drm_gem_object_lookup(file_priv, handle);
> -	if (!obj) {
> -		DRM_ERROR("failed to lookup gem object.\n");
> -		return -EINVAL;
> -	}
> -
> -	ret = drm_gem_create_mmap_offset(obj);
> -	if (ret)
> -		goto out;
> -
> -	*offset = drm_vma_node_offset_addr(&obj->vma_node);
> -	DRM_DEBUG_KMS("offset = 0x%llx\n", *offset);
> -
> -out:
> -	drm_gem_object_unreference_unlocked(obj);
> -
> -	return 0;

Bonus points for fixing a bug in rockchip where this function returns success
when gem_create_mmap_offset fails :)

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> -}
> -
>  /*
>   * rockchip_gem_dumb_create - (struct drm_driver)->dumb_create callback
>   * function
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
> index 3f6ea4d..f237375 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
> @@ -57,7 +57,4 @@ void rockchip_gem_free_object(struct drm_gem_object *obj);
>  int rockchip_gem_dumb_create(struct drm_file *file_priv,
>  			     struct drm_device *dev,
>  			     struct drm_mode_create_dumb *args);
> -int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
> -				 struct drm_device *dev, uint32_t handle,
> -				 uint64_t *offset);
>  #endif /* _ROCKCHIP_DRM_GEM_H */
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 131cb5c..848edcf 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -233,8 +233,6 @@  static struct drm_driver rockchip_drm_driver = {
 	.gem_vm_ops		= &drm_gem_cma_vm_ops,
 	.gem_free_object_unlocked = rockchip_gem_free_object,
 	.dumb_create		= rockchip_gem_dumb_create,
-	.dumb_map_offset	= rockchip_gem_dumb_map_offset,
-	.dumb_destroy		= drm_gem_dumb_destroy,
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import	= drm_gem_prime_import,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index b74ac71..f74333e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -393,32 +393,6 @@  rockchip_gem_create_with_handle(struct drm_file *file_priv,
 	return ERR_PTR(ret);
 }
 
-int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
-				 struct drm_device *dev, uint32_t handle,
-				 uint64_t *offset)
-{
-	struct drm_gem_object *obj;
-	int ret;
-
-	obj = drm_gem_object_lookup(file_priv, handle);
-	if (!obj) {
-		DRM_ERROR("failed to lookup gem object.\n");
-		return -EINVAL;
-	}
-
-	ret = drm_gem_create_mmap_offset(obj);
-	if (ret)
-		goto out;
-
-	*offset = drm_vma_node_offset_addr(&obj->vma_node);
-	DRM_DEBUG_KMS("offset = 0x%llx\n", *offset);
-
-out:
-	drm_gem_object_unreference_unlocked(obj);
-
-	return 0;
-}
-
 /*
  * rockchip_gem_dumb_create - (struct drm_driver)->dumb_create callback
  * function
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
index 3f6ea4d..f237375 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.h
@@ -57,7 +57,4 @@  void rockchip_gem_free_object(struct drm_gem_object *obj);
 int rockchip_gem_dumb_create(struct drm_file *file_priv,
 			     struct drm_device *dev,
 			     struct drm_mode_create_dumb *args);
-int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
-				 struct drm_device *dev, uint32_t handle,
-				 uint64_t *offset);
 #endif /* _ROCKCHIP_DRM_GEM_H */