drm/i915: Use drm_i915_gem_object as the preferred type
A glorified s/obj_priv/obj/ with a net reduction of over a 100 lines and
many characters!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 0b34a1a..71c2b0f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -32,71 +32,67 @@
void i915_gem_restore_gtt_mappings(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- struct drm_i915_gem_object *obj_priv;
+ struct drm_i915_gem_object *obj;
- list_for_each_entry(obj_priv,
- &dev_priv->mm.gtt_list,
- gtt_list) {
+ list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
if (dev_priv->mm.gtt->needs_dmar) {
- BUG_ON(!obj_priv->sg_list);
+ BUG_ON(!obj->sg_list);
- intel_gtt_insert_sg_entries(obj_priv->sg_list,
- obj_priv->num_sg,
- obj_priv->gtt_space->start
+ intel_gtt_insert_sg_entries(obj->sg_list,
+ obj->num_sg,
+ obj->gtt_space->start
>> PAGE_SHIFT,
- obj_priv->agp_type);
+ obj->agp_type);
} else
- intel_gtt_insert_pages(obj_priv->gtt_space->start
+ intel_gtt_insert_pages(obj->gtt_space->start
>> PAGE_SHIFT,
- obj_priv->base.size >> PAGE_SHIFT,
- obj_priv->pages,
- obj_priv->agp_type);
+ obj->base.size >> PAGE_SHIFT,
+ obj->pages,
+ obj->agp_type);
}
/* Be paranoid and flush the chipset cache. */
intel_gtt_chipset_flush();
}
-int i915_gem_gtt_bind_object(struct drm_gem_object *obj)
+int i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj)
{
- struct drm_device *dev = obj->dev;
+ struct drm_device *dev = obj->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
- struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
int ret;
if (dev_priv->mm.gtt->needs_dmar) {
- ret = intel_gtt_map_memory(obj_priv->pages,
- obj->size >> PAGE_SHIFT,
- &obj_priv->sg_list,
- &obj_priv->num_sg);
+ ret = intel_gtt_map_memory(obj->pages,
+ obj->base.size >> PAGE_SHIFT,
+ &obj->sg_list,
+ &obj->num_sg);
if (ret != 0)
return ret;
- intel_gtt_insert_sg_entries(obj_priv->sg_list, obj_priv->num_sg,
- obj_priv->gtt_space->start
- >> PAGE_SHIFT,
- obj_priv->agp_type);
+ intel_gtt_insert_sg_entries(obj->sg_list,
+ obj->num_sg,
+ obj->gtt_space->start >> PAGE_SHIFT,
+ obj->agp_type);
} else
- intel_gtt_insert_pages(obj_priv->gtt_space->start >> PAGE_SHIFT,
- obj->size >> PAGE_SHIFT,
- obj_priv->pages,
- obj_priv->agp_type);
+ intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
+ obj->base.size >> PAGE_SHIFT,
+ obj->pages,
+ obj->agp_type);
return 0;
}
-void i915_gem_gtt_unbind_object(struct drm_gem_object *obj)
+void i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj)
{
- struct drm_device *dev = obj->dev;
+ struct drm_device *dev = obj->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
- struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (dev_priv->mm.gtt->needs_dmar) {
- intel_gtt_unmap_memory(obj_priv->sg_list, obj_priv->num_sg);
- obj_priv->sg_list = NULL;
- obj_priv->num_sg = 0;
+ intel_gtt_unmap_memory(obj->sg_list, obj->num_sg);
+ obj->sg_list = NULL;
+ obj->num_sg = 0;
}
- intel_gtt_clear_range(obj_priv->gtt_space->start >> PAGE_SHIFT,
- obj->size >> PAGE_SHIFT);
+ intel_gtt_clear_range(obj->gtt_space->start >> PAGE_SHIFT,
+ obj->base.size >> PAGE_SHIFT);
}