[PATCH RFC 056/111] staging: etnaviv: call the DRM device 'drm'

Lucas Stach l.stach at pengutronix.de
Thu Apr 2 08:29:58 PDT 2015


From: Russell King <rmk+kernel at arm.linux.org.uk>

Call the DRM device 'drm' in the etnaviv_gpu structure, so that we can
add a struct device pointer.

Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_buffer.c |  2 +-
 drivers/staging/etnaviv/etnaviv_gpu.c    | 74 ++++++++++++++++----------------
 drivers/staging/etnaviv/etnaviv_gpu.h    |  2 +-
 3 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/etnaviv/etnaviv_buffer.c b/drivers/staging/etnaviv/etnaviv_buffer.c
index 96661e513d7d..ad8ff55a59b4 100644
--- a/drivers/staging/etnaviv/etnaviv_buffer.c
+++ b/drivers/staging/etnaviv/etnaviv_buffer.c
@@ -135,7 +135,7 @@ static void etnaviv_buffer_dump(struct etnaviv_gpu *gpu,
 	u32 size = obj->base.size;
 	u32 *ptr = obj->vaddr + off;
 
-	dev_info(gpu->dev->dev, "virt %p phys 0x%08x free 0x%08x\n",
+	dev_info(gpu->drm->dev, "virt %p phys 0x%08x free 0x%08x\n",
 			ptr, obj->paddr + off, size - len * 4 - off);
 
 	print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4,
diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c
index 91dc44f35a49..7ef9120bd7de 100644
--- a/drivers/staging/etnaviv/etnaviv_gpu.c
+++ b/drivers/staging/etnaviv/etnaviv_gpu.c
@@ -157,7 +157,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
 		gpu->identity.vertex_output_buffer_size =
 			1 << gpu->identity.vertex_output_buffer_size;
 	} else {
-		dev_err(gpu->dev->dev, "TODO: determine GPU specs based on model\n");
+		dev_err(gpu->drm->dev, "TODO: determine GPU specs based on model\n");
 	}
 
 	switch (gpu->identity.instruction_count) {
@@ -178,25 +178,25 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
 		break;
 	}
 
-	dev_info(gpu->dev->dev, "stream_count:  %x\n",
+	dev_info(gpu->drm->dev, "stream_count:  %x\n",
 		 gpu->identity.stream_count);
-	dev_info(gpu->dev->dev, "register_max: %x\n",
+	dev_info(gpu->drm->dev, "register_max: %x\n",
 		 gpu->identity.register_max);
-	dev_info(gpu->dev->dev, "thread_count: %x\n",
+	dev_info(gpu->drm->dev, "thread_count: %x\n",
 		 gpu->identity.thread_count);
-	dev_info(gpu->dev->dev, "vertex_cache_size: %x\n",
+	dev_info(gpu->drm->dev, "vertex_cache_size: %x\n",
 		 gpu->identity.vertex_cache_size);
-	dev_info(gpu->dev->dev, "shader_core_count: %x\n",
+	dev_info(gpu->drm->dev, "shader_core_count: %x\n",
 		 gpu->identity.shader_core_count);
-	dev_info(gpu->dev->dev, "pixel_pipes: %x\n",
+	dev_info(gpu->drm->dev, "pixel_pipes: %x\n",
 		 gpu->identity.pixel_pipes);
-	dev_info(gpu->dev->dev, "vertex_output_buffer_size: %x\n",
+	dev_info(gpu->drm->dev, "vertex_output_buffer_size: %x\n",
 		 gpu->identity.vertex_output_buffer_size);
-	dev_info(gpu->dev->dev, "buffer_size: %x\n",
+	dev_info(gpu->drm->dev, "buffer_size: %x\n",
 		 gpu->identity.buffer_size);
-	dev_info(gpu->dev->dev, "instruction_count: %x\n",
+	dev_info(gpu->drm->dev, "instruction_count: %x\n",
 		 gpu->identity.instruction_count);
-	dev_info(gpu->dev->dev, "num_constants: %x\n",
+	dev_info(gpu->drm->dev, "num_constants: %x\n",
 		 gpu->identity.num_constants);
 }
 
@@ -242,8 +242,8 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
 		}
 	}
 
-	dev_info(gpu->dev->dev, "model: %x\n", gpu->identity.model);
-	dev_info(gpu->dev->dev, "revision: %x\n", gpu->identity.revision);
+	dev_info(gpu->drm->dev, "model: %x\n", gpu->identity.model);
+	dev_info(gpu->drm->dev, "revision: %x\n", gpu->identity.revision);
 
 	gpu->identity.features = gpu_read(gpu, VIVS_HI_CHIP_FEATURE);
 
@@ -275,13 +275,13 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
 				gpu_read(gpu, VIVS_HI_CHIP_MINOR_FEATURE_3);
 	}
 
-	dev_info(gpu->dev->dev, "minor_features:  %x\n",
+	dev_info(gpu->drm->dev, "minor_features:  %x\n",
 		 gpu->identity.minor_features0);
-	dev_info(gpu->dev->dev, "minor_features1: %x\n",
+	dev_info(gpu->drm->dev, "minor_features1: %x\n",
 		 gpu->identity.minor_features1);
-	dev_info(gpu->dev->dev, "minor_features2: %x\n",
+	dev_info(gpu->drm->dev, "minor_features2: %x\n",
 		 gpu->identity.minor_features2);
-	dev_info(gpu->dev->dev, "minor_features3: %x\n",
+	dev_info(gpu->drm->dev, "minor_features3: %x\n",
 		 gpu->identity.minor_features3);
 
 	etnaviv_hw_specs(gpu);
@@ -334,7 +334,7 @@ static void etnaviv_hw_reset(struct etnaviv_gpu *gpu)
 
 		/* try reseting again if FE it not idle */
 		if ((idle & VIVS_HI_IDLE_STATE_FE) == 0) {
-			dev_dbg(gpu->dev->dev, "%s: FE is not idle\n",
+			dev_dbg(gpu->drm->dev, "%s: FE is not idle\n",
 				gpu->name);
 			continue;
 		}
@@ -345,7 +345,7 @@ static void etnaviv_hw_reset(struct etnaviv_gpu *gpu)
 		/* is the GPU idle? */
 		if (((control & VIVS_HI_CLOCK_CONTROL_IDLE_3D) == 0)
 		|| ((control & VIVS_HI_CLOCK_CONTROL_IDLE_2D) == 0)) {
-			dev_dbg(gpu->dev->dev, "%s: GPU is not idle\n",
+			dev_dbg(gpu->drm->dev, "%s: GPU is not idle\n",
 				gpu->name);
 			continue;
 		}
@@ -385,7 +385,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 	 * simple and to get something working, just use a single address space:
 	 */
 	mmuv2 = gpu->identity.minor_features1 & chipMinorFeatures1_MMU_VERSION;
-	dev_dbg(gpu->dev->dev, "mmuv2: %d\n", mmuv2);
+	dev_dbg(gpu->drm->dev, "mmuv2: %d\n", mmuv2);
 
 	if (!mmuv2) {
 		iommu = etnaviv_iommu_domain_alloc(gpu);
@@ -402,19 +402,19 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 
 	/* TODO: we will leak here memory - fix it! */
 
-	gpu->mmu = etnaviv_iommu_new(gpu->dev, iommu);
+	gpu->mmu = etnaviv_iommu_new(gpu->drm, iommu);
 	if (!gpu->mmu) {
 		ret = -ENOMEM;
 		goto fail;
 	}
-	etnaviv_register_mmu(gpu->dev, gpu->mmu);
+	etnaviv_register_mmu(gpu->drm, gpu->mmu);
 
 	/* Create buffer: */
-	gpu->buffer = etnaviv_gem_new(gpu->dev, PAGE_SIZE, ETNA_BO_CMDSTREAM);
+	gpu->buffer = etnaviv_gem_new(gpu->drm, PAGE_SIZE, ETNA_BO_CMDSTREAM);
 	if (IS_ERR(gpu->buffer)) {
 		ret = PTR_ERR(gpu->buffer);
 		gpu->buffer = NULL;
-		dev_err(gpu->dev->dev, "could not create buffer: %d\n", ret);
+		dev_err(gpu->drm->dev, "could not create buffer: %d\n", ret);
 		goto fail;
 	}
 
@@ -547,7 +547,7 @@ void etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
 static int enable_pwrrail(struct etnaviv_gpu *gpu)
 {
 #if 0
-	struct drm_device *dev = gpu->dev;
+	struct drm_device *dev = gpu->drm;
 	int ret = 0;
 
 	if (gpu->gpu_reg) {
@@ -667,7 +667,7 @@ static void recover_worker(struct work_struct *work)
 {
 	struct etnaviv_gpu *gpu = container_of(work, struct etnaviv_gpu,
 					       recover_work);
-	struct drm_device *dev = gpu->dev;
+	struct drm_device *dev = gpu->drm;
 
 	dev_err(dev->dev, "%s: hangcheck recover!\n", gpu->name);
 
@@ -688,7 +688,7 @@ static void hangcheck_timer_reset(struct etnaviv_gpu *gpu)
 static void hangcheck_handler(unsigned long data)
 {
 	struct etnaviv_gpu *gpu = (struct etnaviv_gpu *)data;
-	struct drm_device *dev = gpu->dev;
+	struct drm_device *dev = gpu->drm;
 	struct etnaviv_drm_private *priv = dev->dev_private;
 	uint32_t fence = gpu->retired_fence;
 
@@ -724,7 +724,7 @@ static unsigned int event_alloc(struct etnaviv_gpu *gpu)
 	ret = wait_for_completion_timeout(&gpu->event_free,
 					  msecs_to_jiffies(10 * 10000));
 	if (!ret)
-		dev_err(gpu->dev->dev, "wait_for_completion_timeout failed");
+		dev_err(gpu->drm->dev, "wait_for_completion_timeout failed");
 
 	spin_lock_irqsave(&gpu->event_spinlock, flags);
 
@@ -749,7 +749,7 @@ static void event_free(struct etnaviv_gpu *gpu, unsigned int event)
 	spin_lock_irqsave(&gpu->event_spinlock, flags);
 
 	if (gpu->event[event].used == false) {
-		dev_warn(gpu->dev->dev, "event %u is already marked as free",
+		dev_warn(gpu->drm->dev, "event %u is already marked as free",
 			 event);
 		spin_unlock_irqrestore(&gpu->event_spinlock, flags);
 	} else {
@@ -768,10 +768,10 @@ static void retire_worker(struct work_struct *work)
 {
 	struct etnaviv_gpu *gpu = container_of(work, struct etnaviv_gpu,
 					       retire_work);
-	struct drm_device *dev = gpu->dev;
+	struct drm_device *dev = gpu->drm;
 	uint32_t fence = gpu->retired_fence;
 
-	etnaviv_update_fence(gpu->dev, fence);
+	etnaviv_update_fence(gpu->drm, fence);
 
 	mutex_lock(&dev->struct_mutex);
 
@@ -798,7 +798,7 @@ static void retire_worker(struct work_struct *work)
 /* call from irq handler to schedule work to retire bo's */
 void etnaviv_gpu_retire(struct etnaviv_gpu *gpu)
 {
-	struct etnaviv_drm_private *priv = gpu->dev->dev_private;
+	struct etnaviv_drm_private *priv = gpu->drm->dev_private;
 
 	queue_work(priv->wq, &gpu->retire_work);
 }
@@ -807,7 +807,7 @@ void etnaviv_gpu_retire(struct etnaviv_gpu *gpu)
 int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
 	struct etnaviv_gem_submit *submit, struct etnaviv_file_private *ctx)
 {
-	struct drm_device *dev = gpu->dev;
+	struct drm_device *dev = gpu->drm;
 	struct etnaviv_drm_private *priv = dev->dev_private;
 	int ret = 0;
 	unsigned int event, i;
@@ -878,14 +878,14 @@ static irqreturn_t irq_handler(int irq, void *data)
 	u32 intr = gpu_read(gpu, VIVS_HI_INTR_ACKNOWLEDGE);
 
 	if (intr != 0) {
-		dev_dbg(gpu->dev->dev, "intr 0x%08x\n", intr);
+		dev_dbg(gpu->drm->dev, "intr 0x%08x\n", intr);
 
 		if (intr & VIVS_HI_INTR_ACKNOWLEDGE_AXI_BUS_ERROR)
-			dev_err(gpu->dev->dev, "AXI bus error\n");
+			dev_err(gpu->drm->dev, "AXI bus error\n");
 		else {
 			uint8_t event = __fls(intr);
 
-			dev_dbg(gpu->dev->dev, "event %u\n", event);
+			dev_dbg(gpu->drm->dev, "event %u\n", event);
 			gpu->retired_fence = gpu->event[event].fence;
 			gpu->last_ring_pos = gpu->event[event].ring_pos;
 			event_free(gpu, event);
@@ -918,7 +918,7 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
 
 	dev_info(dev, "post gpu[idx]: %p\n", priv->gpu[idx]);
 
-	gpu->dev = drm;
+	gpu->drm = drm;
 
 	INIT_LIST_HEAD(&gpu->active_list);
 	INIT_WORK(&gpu->retire_work, retire_worker);
diff --git a/drivers/staging/etnaviv/etnaviv_gpu.h b/drivers/staging/etnaviv/etnaviv_gpu.h
index a26d0ded1019..c9c482a8d569 100644
--- a/drivers/staging/etnaviv/etnaviv_gpu.h
+++ b/drivers/staging/etnaviv/etnaviv_gpu.h
@@ -86,7 +86,7 @@ struct etnaviv_event {
 
 struct etnaviv_gpu {
 	const char *name;
-	struct drm_device *dev;
+	struct drm_device *drm;
 	struct etnaviv_chip_identity identity;
 	int pipe;
 
-- 
2.1.4



More information about the dri-devel mailing list