From 481a6f7dcf43c73644e483c7b736cafd1bc305a2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 16 Jan 2017 15:21:31 +0000 Subject: [PATCH] drm/i915: Remove i915_gem_object_to_ggtt() With the last user of this convenience wrapper gone, we can kill the wrapper and in the process make the lookup function static. Signed-off-by: Chris Wilson Link: http://patchwork.freedesktop.org/patch/msgid/20170116152131.18089-5-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_drv.h | 7 ------- drivers/gpu/drm/i915/i915_vma.c | 27 ++++++--------------------- drivers/gpu/drm/i915/i915_vma.h | 5 ----- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 566adcc8a0eb..15078f8a577a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3380,13 +3380,6 @@ i915_vm_to_ppgtt(struct i915_address_space *vm) return container_of(vm, struct i915_hw_ppgtt, base); } -static inline struct i915_vma * -i915_gem_object_to_ggtt(struct drm_i915_gem_object *obj, - const struct i915_ggtt_view *view) -{ - return i915_vma_lookup(obj, &to_i915(obj->base.dev)->ggtt.base, view); -} - /* i915_gem_fence_reg.c */ int __must_check i915_vma_get_fence(struct i915_vma *vma); int __must_check i915_vma_put_fence(struct i915_vma *vma); diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index cb415bfe22d7..635f2635b1f2 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -144,28 +144,13 @@ vma_create(struct drm_i915_gem_object *obj, return vma; } -/** - * i915_vma_lookup - finds a matching VMA - * @obj: parent &struct drm_i915_gem_object to be mapped - * @vm: address space in which the mapping is located - * @view: additional mapping requirements - * - * i915_vma_lookup() looks up an existing VMA of the @obj in the @vm with - * the same @view characteristics. - * - * Must be called with struct_mutex held. - * - * Returns the vma if found, or NULL. - */ -struct i915_vma * -i915_vma_lookup(struct drm_i915_gem_object *obj, - struct i915_address_space *vm, - const struct i915_ggtt_view *view) +static struct i915_vma * +vma_lookup(struct drm_i915_gem_object *obj, + struct i915_address_space *vm, + const struct i915_ggtt_view *view) { struct rb_node *rb; - lockdep_assert_held(&obj->base.dev->struct_mutex); - rb = obj->vma_tree.rb_node; while (rb) { struct i915_vma *vma = rb_entry(rb, struct i915_vma, obj_node); @@ -210,13 +195,13 @@ i915_vma_instance(struct drm_i915_gem_object *obj, GEM_BUG_ON(view && !i915_is_ggtt(vm)); GEM_BUG_ON(vm->closed); - vma = i915_vma_lookup(obj, vm, view); + vma = vma_lookup(obj, vm, view); if (!vma) vma = vma_create(obj, vm, view); GEM_BUG_ON(!IS_ERR(vma) && i915_vma_is_closed(vma)); GEM_BUG_ON(!IS_ERR(vma) && i915_vma_compare(vma, vm, view)); - GEM_BUG_ON(!IS_ERR(vma) && i915_vma_lookup(obj, vm, view) != vma); + GEM_BUG_ON(!IS_ERR(vma) && vma_lookup(obj, vm, view) != vma); return vma; } diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h index 82a56193985c..e39d922cfb6f 100644 --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -111,11 +111,6 @@ struct i915_vma { struct drm_i915_gem_exec_object2 *exec_entry; }; -struct i915_vma * -i915_vma_lookup(struct drm_i915_gem_object *obj, - struct i915_address_space *vm, - const struct i915_ggtt_view *view); - struct i915_vma * i915_vma_instance(struct drm_i915_gem_object *obj, struct i915_address_space *vm,