[Intel-gfx] [PATCH 3/4] drm/i915: Rename local struct intel_ringbuffer variables

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Mar 16 15:40:54 UTC 2016


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Majority of the code calls these ringbuf so fix up a few
places which use something else to be consistent.

Coccinelle script of:

@@
expression E;
identifier r;
@@
- struct intel_ringbuffer *r = E;
+ struct intel_ringbuffer *ringbuf = E;
<+...
- r
+ ringbuf
...+>
@@
identifier r;
@@
- struct intel_ringbuffer *r;
+ struct intel_ringbuffer *ringbuf;
<+...
- r
+ ringbuf
...+>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c         |  8 ++++----
 drivers/gpu/drm/i915/intel_lrc.c        |  3 ++-
 drivers/gpu/drm/i915/intel_mocs.c       | 11 +++++++----
 drivers/gpu/drm/i915/intel_ringbuffer.c | 28 ++++++++++++++--------------
 4 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 042cb412e652..4a0f9bd87c34 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2821,7 +2821,7 @@ static void i915_gem_reset_engine_status(struct drm_i915_private *dev_priv,
 static void i915_gem_reset_engine_cleanup(struct drm_i915_private *dev_priv,
 					struct intel_engine_cs *engine)
 {
-	struct intel_ringbuffer *buffer;
+	struct intel_ringbuffer *ringbuf;
 
 	while (!list_empty(&engine->active_list)) {
 		struct drm_i915_gem_object *obj;
@@ -2874,9 +2874,9 @@ static void i915_gem_reset_engine_cleanup(struct drm_i915_private *dev_priv,
 	 * upon reset is less than when we start. Do one more pass over
 	 * all the ringbuffers to reset last_retired_head.
 	 */
-	list_for_each_entry(buffer, &engine->buffers, link) {
-		buffer->last_retired_head = buffer->tail;
-		intel_ring_update_space(buffer);
+	list_for_each_entry(ringbuf, &engine->buffers, link) {
+		ringbuf->last_retired_head = ringbuf->tail;
+		intel_ring_update_space(ringbuf);
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 7c636b3db156..bc3183e1c0af 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1001,7 +1001,8 @@ int intel_execlists_submission(struct i915_execbuffer_params *params,
 		intel_logical_ring_emit(ringbuf, MI_NOOP);
 		intel_logical_ring_emit(ringbuf, MI_LOAD_REGISTER_IMM(1));
 		intel_logical_ring_emit_reg(ringbuf, INSTPM);
-		intel_logical_ring_emit(ringbuf, instp_mask << 16 | instp_mode);
+		intel_logical_ring_emit(ringbuf,
+					instp_mask << 16 | instp_mode);
 		intel_logical_ring_advance(ringbuf);
 
 		dev_priv->relative_constants_mode = instp_mode;
diff --git a/drivers/gpu/drm/i915/intel_mocs.c b/drivers/gpu/drm/i915/intel_mocs.c
index 3c725dde16ed..8ef7e2b29d71 100644
--- a/drivers/gpu/drm/i915/intel_mocs.c
+++ b/drivers/gpu/drm/i915/intel_mocs.c
@@ -210,7 +210,8 @@ static int emit_mocs_control_table(struct drm_i915_gem_request *req,
 				MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES));
 
 	for (index = 0; index < table->size; index++) {
-		intel_logical_ring_emit_reg(ringbuf, mocs_register(ring, index));
+		intel_logical_ring_emit_reg(ringbuf,
+					    mocs_register(ring, index));
 		intel_logical_ring_emit(ringbuf,
 					table->table[index].control_value);
 	}
@@ -224,8 +225,10 @@ static int emit_mocs_control_table(struct drm_i915_gem_request *req,
 	 * that value to all the used entries.
 	 */
 	for (; index < GEN9_NUM_MOCS_ENTRIES; index++) {
-		intel_logical_ring_emit_reg(ringbuf, mocs_register(ring, index));
-		intel_logical_ring_emit(ringbuf, table->table[0].control_value);
+		intel_logical_ring_emit_reg(ringbuf,
+					    mocs_register(ring, index));
+		intel_logical_ring_emit(ringbuf,
+					table->table[0].control_value);
 	}
 
 	intel_logical_ring_emit(ringbuf, MI_NOOP);
@@ -266,7 +269,7 @@ static int emit_mocs_l3cc_table(struct drm_i915_gem_request *req,
 	}
 
 	intel_logical_ring_emit(ringbuf,
-			MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES / 2));
+				MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES / 2));
 
 	for (i = 0, count = 0; i < table->size / 2; i++, count += 2) {
 		value = (table->table[count].l3cc_value & 0xffff) |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b7c8fc1a73a3..a78a8fae4780 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2177,41 +2177,41 @@ static int intel_alloc_ringbuffer_obj(struct drm_device *dev,
 struct intel_ringbuffer *
 intel_engine_create_ringbuffer(struct intel_engine_cs *engine, int size)
 {
-	struct intel_ringbuffer *ring;
+	struct intel_ringbuffer *ringbuf;
 	int ret;
 
-	ring = kzalloc(sizeof(*ring), GFP_KERNEL);
-	if (ring == NULL) {
+	ringbuf = kzalloc(sizeof(*ringbuf), GFP_KERNEL);
+	if (ringbuf == NULL) {
 		DRM_DEBUG_DRIVER("Failed to allocate ringbuffer %s\n",
 				 engine->name);
 		return ERR_PTR(-ENOMEM);
 	}
 
-	ring->engine = engine;
-	list_add(&ring->link, &engine->buffers);
+	ringbuf->engine = engine;
+	list_add(&ringbuf->link, &engine->buffers);
 
-	ring->size = size;
+	ringbuf->size = size;
 	/* Workaround an erratum on the i830 which causes a hang if
 	 * the TAIL pointer points to within the last 2 cachelines
 	 * of the buffer.
 	 */
-	ring->effective_size = size;
+	ringbuf->effective_size = size;
 	if (IS_I830(engine->dev) || IS_845G(engine->dev))
-		ring->effective_size -= 2 * CACHELINE_BYTES;
+		ringbuf->effective_size -= 2 * CACHELINE_BYTES;
 
-	ring->last_retired_head = -1;
-	intel_ring_update_space(ring);
+	ringbuf->last_retired_head = -1;
+	intel_ring_update_space(ringbuf);
 
-	ret = intel_alloc_ringbuffer_obj(engine->dev, ring);
+	ret = intel_alloc_ringbuffer_obj(engine->dev, ringbuf);
 	if (ret) {
 		DRM_DEBUG_DRIVER("Failed to allocate ringbuffer %s: %d\n",
 				 engine->name, ret);
-		list_del(&ring->link);
-		kfree(ring);
+		list_del(&ringbuf->link);
+		kfree(ringbuf);
 		return ERR_PTR(ret);
 	}
 
-	return ring;
+	return ringbuf;
 }
 
 void
-- 
1.9.1



More information about the Intel-gfx mailing list