Commit 34911fd3 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Rename drm_gem_object_unreference_unlocked in preparation for lockless free

Whilst this ultimately wraps kref_put_mutex(), our goal here is the
lockless variant, so keep the _unlocked() suffix until we need it no
more.

s/drm_gem_object_unreference_unlocked/i915_gem_object_put_unlocked/
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1469005202-9659-7-git-send-email-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1469017917-15134-6-git-send-email-chris@chris-wilson.co.uk
parent f8c417cd
...@@ -2327,6 +2327,16 @@ i915_gem_object_put(struct drm_i915_gem_object *obj) ...@@ -2327,6 +2327,16 @@ i915_gem_object_put(struct drm_i915_gem_object *obj)
__deprecated __deprecated
extern void drm_gem_object_unreference(struct drm_gem_object *); extern void drm_gem_object_unreference(struct drm_gem_object *);
__attribute__((nonnull))
static inline void
i915_gem_object_put_unlocked(struct drm_i915_gem_object *obj)
{
drm_gem_object_unreference_unlocked(&obj->base);
}
__deprecated
extern void drm_gem_object_unreference_unlocked(struct drm_gem_object *);
static inline bool static inline bool
i915_gem_object_has_struct_page(const struct drm_i915_gem_object *obj) i915_gem_object_has_struct_page(const struct drm_i915_gem_object *obj)
{ {
......
...@@ -410,7 +410,7 @@ i915_gem_create(struct drm_file *file, ...@@ -410,7 +410,7 @@ i915_gem_create(struct drm_file *file,
ret = drm_gem_handle_create(file, &obj->base, &handle); ret = drm_gem_handle_create(file, &obj->base, &handle);
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
if (ret) if (ret)
return ret; return ret;
...@@ -1604,7 +1604,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -1604,7 +1604,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
* pages from. * pages from.
*/ */
if (!obj->base.filp) { if (!obj->base.filp) {
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return -EINVAL; return -EINVAL;
} }
...@@ -1616,7 +1616,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -1616,7 +1616,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
struct vm_area_struct *vma; struct vm_area_struct *vma;
if (down_write_killable(&mm->mmap_sem)) { if (down_write_killable(&mm->mmap_sem)) {
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return -EINTR; return -EINTR;
} }
vma = find_vma(mm, addr); vma = find_vma(mm, addr);
...@@ -1630,7 +1630,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -1630,7 +1630,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
/* This may race, but that's ok, it only gets set */ /* This may race, but that's ok, it only gets set */
WRITE_ONCE(obj->has_wc_mmap, true); WRITE_ONCE(obj->has_wc_mmap, true);
} }
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
if (IS_ERR((void *)addr)) if (IS_ERR((void *)addr))
return addr; return addr;
...@@ -3615,7 +3615,7 @@ int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, ...@@ -3615,7 +3615,7 @@ int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data,
break; break;
} }
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return 0; return 0;
} }
......
...@@ -172,7 +172,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, ...@@ -172,7 +172,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
if (!i915_tiling_ok(dev, if (!i915_tiling_ok(dev,
args->stride, obj->base.size, args->tiling_mode)) { args->stride, obj->base.size, args->tiling_mode)) {
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return -EINVAL; return -EINVAL;
} }
......
...@@ -845,7 +845,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file ...@@ -845,7 +845,7 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file
ret = drm_gem_handle_create(file, &obj->base, &handle); ret = drm_gem_handle_create(file, &obj->base, &handle);
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
if (ret) if (ret)
return ret; return ret;
......
...@@ -10442,7 +10442,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, ...@@ -10442,7 +10442,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
fb = intel_framebuffer_create(dev, &mode_cmd, obj); fb = intel_framebuffer_create(dev, &mode_cmd, obj);
if (IS_ERR(fb)) if (IS_ERR(fb))
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return fb; return fb;
} }
...@@ -11756,7 +11756,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11756,7 +11756,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
crtc->primary->fb = old_fb; crtc->primary->fb = old_fb;
update_state_fb(crtc->primary); update_state_fb(crtc->primary);
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
drm_framebuffer_unreference(work->old_fb); drm_framebuffer_unreference(work->old_fb);
spin_lock_irq(&dev->event_lock); spin_lock_irq(&dev->event_lock);
...@@ -15094,7 +15094,7 @@ intel_user_framebuffer_create(struct drm_device *dev, ...@@ -15094,7 +15094,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
fb = intel_framebuffer_create(dev, &mode_cmd, obj); fb = intel_framebuffer_create(dev, &mode_cmd, obj);
if (IS_ERR(fb)) if (IS_ERR(fb))
drm_gem_object_unreference_unlocked(&obj->base); i915_gem_object_put_unlocked(obj);
return fb; return fb;
} }
......
...@@ -1460,7 +1460,7 @@ void intel_cleanup_overlay(struct drm_i915_private *dev_priv) ...@@ -1460,7 +1460,7 @@ void intel_cleanup_overlay(struct drm_i915_private *dev_priv)
* hardware should be off already */ * hardware should be off already */
WARN_ON(dev_priv->overlay->active); WARN_ON(dev_priv->overlay->active);
drm_gem_object_unreference_unlocked(&dev_priv->overlay->reg_bo->base); i915_gem_object_put_unlocked(dev_priv->overlay->reg_bo);
kfree(dev_priv->overlay); kfree(dev_priv->overlay);
} }
......
...@@ -5709,7 +5709,7 @@ static void valleyview_cleanup_pctx(struct drm_i915_private *dev_priv) ...@@ -5709,7 +5709,7 @@ static void valleyview_cleanup_pctx(struct drm_i915_private *dev_priv)
if (WARN_ON(!dev_priv->vlv_pctx)) if (WARN_ON(!dev_priv->vlv_pctx))
return; return;
drm_gem_object_unreference_unlocked(&dev_priv->vlv_pctx->base); i915_gem_object_put_unlocked(dev_priv->vlv_pctx);
dev_priv->vlv_pctx = NULL; dev_priv->vlv_pctx = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment