diff mbox

drm/ttm: inline drm_bo_setup_vm()

Message ID 1374754131-24104-1-git-send-email-dh.herrmann@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Herrmann July 25, 2013, 12:08 p.m. UTC
This helper is used only once and just wraps a call to
drm_vma_offset_add(). Remove this unneeded indirection to safe 10 lines of
code.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

Comments

Jerome Glisse July 25, 2013, 2:06 p.m. UTC | #1
On Thu, Jul 25, 2013 at 8:08 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> This helper is used only once and just wraps a call to
> drm_vma_offset_add(). Remove this unneeded indirection to safe 10 lines of
> code.
>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

Review-by: Jerome Glisse <jglisse@redhat.com>

> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 22 ++--------------------
>  1 file changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 050edfa..f1a857e 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -45,7 +45,6 @@
>  #define TTM_DEBUG(fmt, arg...)
>  #define TTM_BO_HASH_ORDER 13
>
> -static int ttm_bo_setup_vm(struct ttm_buffer_object *bo);
>  static int ttm_bo_swapout(struct ttm_mem_shrink *shrink);
>  static void ttm_bo_global_kobj_release(struct kobject *kobj);
>
> @@ -1134,7 +1133,8 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
>         if (likely(!ret) &&
>             (bo->type == ttm_bo_type_device ||
>              bo->type == ttm_bo_type_sg))
> -               ret = ttm_bo_setup_vm(bo);
> +               ret = drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
> +                                        bo->mem.num_pages);
>
>         locked = ww_mutex_trylock(&bo->resv->lock);
>         WARN_ON(!locked);
> @@ -1506,24 +1506,6 @@ void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo)
>
>  EXPORT_SYMBOL(ttm_bo_unmap_virtual);
>
> -/**
> - * ttm_bo_setup_vm:
> - *
> - * @bo: the buffer to allocate address space for
> - *
> - * Allocate address space in the drm device so that applications
> - * can mmap the buffer and access the contents. This only
> - * applies to ttm_bo_type_device objects as others are not
> - * placed in the drm device address space.
> - */
> -
> -static int ttm_bo_setup_vm(struct ttm_buffer_object *bo)
> -{
> -       struct ttm_bo_device *bdev = bo->bdev;
> -
> -       return drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
> -                                 bo->mem.num_pages);
> -}
>
>  int ttm_bo_wait(struct ttm_buffer_object *bo,
>                 bool lazy, bool interruptible, bool no_wait)
> --
> 1.8.3.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 050edfa..f1a857e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -45,7 +45,6 @@ 
 #define TTM_DEBUG(fmt, arg...)
 #define TTM_BO_HASH_ORDER 13
 
-static int ttm_bo_setup_vm(struct ttm_buffer_object *bo);
 static int ttm_bo_swapout(struct ttm_mem_shrink *shrink);
 static void ttm_bo_global_kobj_release(struct kobject *kobj);
 
@@ -1134,7 +1133,8 @@  int ttm_bo_init(struct ttm_bo_device *bdev,
 	if (likely(!ret) &&
 	    (bo->type == ttm_bo_type_device ||
 	     bo->type == ttm_bo_type_sg))
-		ret = ttm_bo_setup_vm(bo);
+		ret = drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
+					 bo->mem.num_pages);
 
 	locked = ww_mutex_trylock(&bo->resv->lock);
 	WARN_ON(!locked);
@@ -1506,24 +1506,6 @@  void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo)
 
 EXPORT_SYMBOL(ttm_bo_unmap_virtual);
 
-/**
- * ttm_bo_setup_vm:
- *
- * @bo: the buffer to allocate address space for
- *
- * Allocate address space in the drm device so that applications
- * can mmap the buffer and access the contents. This only
- * applies to ttm_bo_type_device objects as others are not
- * placed in the drm device address space.
- */
-
-static int ttm_bo_setup_vm(struct ttm_buffer_object *bo)
-{
-	struct ttm_bo_device *bdev = bo->bdev;
-
-	return drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
-				  bo->mem.num_pages);
-}
 
 int ttm_bo_wait(struct ttm_buffer_object *bo,
 		bool lazy, bool interruptible, bool no_wait)