drm/amdgpu: fix ring debugfs bug
authorMonk Liu <Monk.Liu@amd.com>
Tue, 14 Jun 2016 16:02:21 +0000 (12:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:51:12 +0000 (14:51 -0400)
debugfs file added but not released after driver unloaded

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index b6c8309ce89105bffc2f784cfa9161be73fde7ea..f41d23139a3a768d60fe5a629c71fef0c932d73c 100644 (file)
@@ -798,6 +798,9 @@ struct amdgpu_ring {
        unsigned                cond_exe_offs;
        u64                             cond_exe_gpu_addr;
        volatile u32    *cond_exe_cpu_addr;
+#if defined(CONFIG_DEBUG_FS)
+       struct dentry *ent;
+#endif
 };
 
 /*
index 942111517e409d29916841a651c704c3bfcf63e2..c38203e04efe5d7ba2d407ccf0a9fc59aff77a22 100644 (file)
@@ -49,6 +49,7 @@
  */
 static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
                                    struct amdgpu_ring *ring);
+static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
 
 /**
  * amdgpu_ring_alloc - allocate space on the ring buffer
@@ -362,6 +363,7 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
                }
                amdgpu_bo_unref(&ring_obj);
        }
+       amdgpu_debugfs_ring_fini(ring);
 }
 
 /*
@@ -445,6 +447,14 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
                return PTR_ERR(ent);
 
        i_size_write(ent->d_inode, ring->ring_size + 12);
+       ring->ent = ent;
 #endif
        return 0;
 }
+
+static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
+{
+#if defined(CONFIG_DEBUG_FS)
+       debugfs_remove(ring->ent);
+#endif
+}