drm/amdgpu: fix ring debugfs bug

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>
This commit is contained in:
Monk Liu 2016-06-14 12:02:21 -04:00 committed by Alex Deucher
parent c71dbd93eb
commit a909c6bd9f
2 changed files with 13 additions and 0 deletions

View File

@ -798,6 +798,9 @@ struct amdgpu_ring {
unsigned cond_exe_offs; unsigned cond_exe_offs;
u64 cond_exe_gpu_addr; u64 cond_exe_gpu_addr;
volatile u32 *cond_exe_cpu_addr; volatile u32 *cond_exe_cpu_addr;
#if defined(CONFIG_DEBUG_FS)
struct dentry *ent;
#endif
}; };
/* /*

View File

@ -49,6 +49,7 @@
*/ */
static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
struct amdgpu_ring *ring); struct amdgpu_ring *ring);
static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
/** /**
* amdgpu_ring_alloc - allocate space on the ring buffer * 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_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); return PTR_ERR(ent);
i_size_write(ent->d_inode, ring->ring_size + 12); i_size_write(ent->d_inode, ring->ring_size + 12);
ring->ent = ent;
#endif #endif
return 0; return 0;
} }
static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
{
#if defined(CONFIG_DEBUG_FS)
debugfs_remove(ring->ent);
#endif
}